iOS SDK Samples - Organization Operations

Get Company Info
          
          
ZCRMSDKUtil.getCompanyDetails { ( result ) in
            switch result
                        {
                        case .success(let company, let response) :
                            print("ResponseJSON : \( response.responseJSON )")
                        case .failure(let error) :
                            print( "get companyDetails failed : \( error )")
                    }
}
 
Get Company Info through ID
          
          
ZCRMSDKUtil.getCompanyDetails(forId : 1234567876543) { ( result ) in
            switch result
                        {
                        case .success(let company, let response) :
                            print("ResponseJSON : \( response.responseJSON )")
                        case .failure(let error) :
                            print( "get companyDetails failed : \( error )")
                    }
}
Get Company Info from the Server
          
          
ZCRMSDKUtil.getCompanyDetailsFromServer { ( result ) in
            switch result
                        {
                        case .success(let company, let response) :
                            print("ResponseJSON : \( response.responseJSON )")
                        case .failure(let error) :
                            print( "get companyDetails failed : \( error )")
                    }
}
Get Company Info from the Server through ID
          
          
ZCRMSDKUtil. getCompanyDetailsFromServer(forId: 12345678987654) { ( result ) in
            switch result
                        {
                        case .success(let company, let response) :
                            print("ResponseJSON : \( response.responseJSON )")
                        case .failure(let error) :
                            print( "get companyDetails failed : \( error )")
                    }
}
 
Upload Company Photo using filePath
          
          
/*- Parameters:
     filePath - path where the file should be uploaded.*/
//company is the object of getCompanyInfoDelegate()
$company.uploadPhoto(filePath:"/Users/abcxxx/Desktop/test.png") { ( result ) in
                    switch result
                    {
                    case .success(let response ) :
        print ("Attachment upload successfully")
                
                    case .failure( let error ) :
            print("Throws exception : \(error)")
                    }
                }
 
Upload Company Photo Using fileName and fileData
          
          
let filePath = testBundle.path( forResource : "photos/org_photo", ofType : "png", inDirectory: "resources" )
let data = try! Data(contentsOf: URL(fileURLWithPath: filePath!))
     /*- Parameters:
        - fileName - name of the file should be uploaded
        - fileData : Data object of the image to be uploaded*/ 
//company is the object of getCompanyInfoDelegate()
$company.uploadPhoto(fileName: "invoice", fileData : data) { ( result ) in
                    switch result
                    {
                    case .success(let response ) :
        print ("Attachment upload successfully")
                
                    case .failure( let error ) :
            print("Throws exception : \(error)")
                    }
                }