Family Cloud
The CloudikePhotos SDK provides features for managing a Family cloud.
#
Initialization import CLPhotos from 'web_photos';
let photosApp; const options = { logLevel: 'error' // 'trace' | 'debug' | 'info' | 'warn' | 'error' }; const config = { authToken: '', // user auth token baseUrl: '', // api base url required userAgent: '' // user agent name required } try { photosApp = CLPhotos.init(options, config); } catch (e) { // catch photo sdk InternalError }
#
Create Family CloudThe following code example demonstrates how to create a new Family Cloud1
const params = {name: 'new family', is_opened: true}; // ICreateFamilySchemaphotosApp.family.createUserFamily(params).then(({data}) => { const family = data; // IFamilySchema});
#
Copy to Family CloudThe following code example demonstrates adding items to Family Cloud1 timeline.
const items = [item1, item2]; // IItemSchema[]photosApp.familyTimeline.addItemsToTimeline(items).then(({data}) => { const operations = data; // IOperationResult[]});
#
Copy to Personal CloudThe following code example demonstrates adding items to Personal timeline.
const items = [item1, item2]; // IItemSchema[]photosApp.timeline.addItemsToTimeline(items).then(({data}) => { const operations = data; // IOperationResult[]});
#
Read Family Cloud from Cloud StorageThe following code example demonstrates how to get a Family Cloud1 data for owner
const familyId = 'sdfsf9938434sdf';photosApp.family.getUserFamily(familyId).then(({data}) => { const familyData = data; // IFamilySchema});
#
Get List of Family Cloud MembersThe following code example demonstrates how to get a Family Cloud1 Members2 list
const familyId = 'sdfsf9938434sdf';const params = {limit: 10};photosApp.family .getFamilyMembers(familyId, params) .then(({data}) => { const { _embedded: {members}, } = data; });
1#
Get Information About the Current Family CloudThe following code example demonstrates how to get a family cloud data for owner
const familyId = 'sdfsf9938434sdf';photosApp.family.getUserFamily(familyId).then(({data}) => { const familyData = data; // IFamilySchema});
#
Invite Family MembersThe following code example demonstrates how to create an invitation link (invite_hash) to a Family Cloud1
const familyId = 'sdfsf9938434sdf';photosApp.family.unlockUserFamily(familyId).then(({data}) => { const {invite_hash} = data; // IFamilySchema // for domain saas.cloudike.com invite link will look like const inviteLink = `https://saas.cloudike.com/invite?fchash=${invite_hash}`;});
#
Remove an Invitation link from Family CloudThe following code example demonstrates how to remove an invitation link (invite_hash) to a Family Cloud1
const familyId = 'sdfsf9938434sdf';photosApp.family.lockUserFamily(familyId).then(({data}) => { const family = data; // IFamilySchema});
#
Remove Family CloudThe following code example demonstrates how to remove a Family Cloud1
const familyId = 'sdfsf9938434sdf';photosApp.family.deleteUserFamily(familyId).then(() => { // family cloud is successfully deleted});
#
Remove Family Cloud MembersThe following code example demonstrates how to remove Member from Family Cloud1 by memberId and familyId
const familyId = 'sdfsf9938434sdf';const memberId = 'egser65665dfd6f';photosApp.family.deleteFamilyMember(familyId, memberId).then(() => { // member with memberId = 'egser65665dfd6f' is successfully // removed from a family with familyId = 'sdfsf9938434sdf'});
#
Join a new member to FamilyThe following code example demonstrates how to send a request to join Family Cloud1 by invite hash
const hash = '56sfsfer5df4';const params = {name: 'Member name'};photosApp.family.joinFamilyMember(hash, params).then(({data}) => { const joinedMember = data; // IMemberSchema});