Skip to main content

Family Cloud

To interact with Family Cloud, there are two classes CloudikeFamily and FamilyPhotosManager.

Let's assume that a CloudikeFamily instance has been created to manage Family Cloud:

let familyManager = CloudikeFamily(core: CloudikeCoreLibraryHelper.core)

Working with FamilyPhotosManager is identical to working with CloudikePhotos. It provides an API for working with photos / albums in FamilyCloud.

let familyPhotosManager = CloudikeFamilyPhotos(settings: settings, core: core)
photos.configureWithUploadSettings {
// completion block
}

Create Family Cloud

To create Family Cloud, you need to call the createFamily method:

familyManager.createFamily(name: name) { result in
switch result {
case .success(let familyItem):
print(familyItem)
case .failure(let error):
print(error)
}
}

The parameters of the createFamily function are as follows:

  • name: String - A name of family cloud.
  • completion: (Swift.Result<CloudikeFamilyDto, Error>) -> () - The completion handler to receive the result CloudikeFamilyDto and the error objects.

Delete Family Cloud

To delete Family Cloud, you need to call the deleteFamily method:

familyManager.deleteFamily(familyId) { result in
switch result {
case .success(()):
break
case .failure(let error):
print(error)
}
}

The parameters of the deleteFamily function are as follows:

  • identifier: String - An identifier of family Cloud.
  • completion: (Swift.Result<Void, Error>) -> () - The completion handler to receive the result and the error objects.

Copy to Family Cloud

Copying a photo / video to Family Cloud is done by using the addItems method, which is called on the TimelineService object used in the FamilyPhotosManager instance:

familyPhotosManager.timelineService.addItems(items, to: userId) { result in
switch result {
case .success(()):
break
case .failure(let error):
print(error)
}
  • items: [CloudikeMediaItem] - Items to copy.
  • userId: String - An identifier of Family Cloud.
  • completion: (Swift.Result<Void, Error>) -> () - The completion handler to receive the result and the error objects.

Copy to Personal Cloud

Copying a photo / video to the personal cloud is done by using the addItems method, which is called on the TimelineService object used in the CloudikePhotos instance:

personalPhotosManager.timelineService.addItems(items, to: userId) { result in
switch result {
case .success(()):
break
case .failure(let error):
print(errir)
}
  • items: [CloudikeMediaItem] - Items to copy.
  • userId: String - An identifier of personal cloud user.
  • completion: (Swift.Result<Void, Error>) -> () - The completion handler to receive the result and the error objects.

Read Family from Cloud Storage

Downloading photos / albums from Family Cloud is similar to CloudikePhotos.

Get List of Family Members

To get a list of family Cloud members, call the getFamilyInfoWithMembers method:

familyManager.getFamilyInfoWithMembers { result in
switch result {
case .success((let info, let members)):
print(info)
print(members)
case .failure(let error):
print(error)
}
}

The parameters of the getFamilyInfoWithMembers function are as follows:

  • completion: (Swift.Result<(CloudikeFamilyItem?, [CloudikeFamilyMember]?), Error>) -> () - The completion handler to receive the result tuple with CloudikeFamilyItem and [CloudikeFamilyMember] and the error objects.

Get Information About the Current Family

To get data about Family Cloud, you need to call the getFamilyInfo method:

familyManager.getFamilyInfo { result in
switch result {
case .success(let info):
print(info)
case .failure(let error):
print(info)
}
}

The parameters of the getFamilyInfo function are as follows:

  • completion: (Swift.Result<CloudikeFamilyItem?, Error>) -> () - The completion handler to receive the result CloudikeFamilyItem and the error objects.

Invite Family Members

An invitation to Family Cloud is done by building a link using the string inviteHash contained in the object CloudikeFamilyItem. You can build invite url link like : https://saas.cloudike.com/invite?fchash=<inviteHash>

Remove Family Members

To delete a user from Family Cloud, call the deleteFamilyMember method:

familyManager.deleteFamilyMember(memberId, from: familyId) { (result) in
switch result {
case .success():
break
case .failure(let error):
break
}
}

The parameters of the deleteFamilyMember function are as follows:

  • memberId: String - The identifier of the user to delete.
  • familyId: String - The identifier of Family Cloud.
  • completion: (Swift.Result<CloudikeFamilyItem?, Error>) -> () - The completion handler to receive the result CloudikeFamilyItem and the error objects.