iOS SDK Samples - Share Operations
// record is the object of ZCRMRecord
$record.getSharedDetails() { result in
switch result
{
case .success(let sharedDetails,let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
// record is the object of ZCRMRecord
// user is the object of ZCRMUserDelegate
let sharedDetails = ZCRMRecord.SharedDetails( user : user, permission : AccessPermission.Writable.fullAccess, isSharedWithRelatedRecords : true)
$record.share( details : [sharedDetails] ) { result in
switch result
{
case .success( let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
// record is the object of ZCRMRecord
// user is the object of ZCRMUserDelegate
let shareDetails = ZCRMRecord.SharedDetails( user : user, permission : AccessPermission.Writable.fullAccess, isSharedWithRelatedRecords : true)
$record.updateShare(details: [shareDetails] ) { result in
switch result
{
case .success( let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Revoke Shared Records
// record is the object of ZCRMRecord
$record.revokeShare() { result in
switch result
{
case .success( let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
let shareableUserDetails = tryshareRecordDetails.getDictionary(key: "ShareableUserDetails")
// record is the object of ZCRMRecord
$record.id = try shareableUserDetails.getInt64(key: "recordId")
$record.getShareableUsers { result in
switch result
{
case .success(let userDetails, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}