PersonClient
public class PersonClient
An iOS client wrapper of the Cisco Spark People REST API .
Since
1.2.0-
Lists people in the authenticated user’s organization.
Since
1.2.0Declaration
Swift
public func list(email: EmailAddress? = nil, displayName: String? = nil, id: String? = nil, orgId: String? = nil, max: Int? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<[Person]>) -> Void)
Parameters
email
if not nil, only list people with this email address.
displayName
if not nil, only list people whose name starts with this string.
id
List people by ID. Accepts up to 85 person IDs separated by commas.
orgId
List people in this organization. Only admin users of another organization (such as partners) may use this parameter.
max
The maximum number of people in the response.
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Void
-
Retrieves the details for a person by person id.
Since
1.2.0Declaration
Swift
public func get(personId: String, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Person>) -> Void)
Parameters
personId
The identifier of the person.
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Void
-
Retrieves the details for the authenticated user.
Since
1.2.0Declaration
Swift
public func getMe(queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Person>) -> Void)
Parameters
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Void
-
Create people in the authenticated user’s organization. Only admins are able to use this function
Since
1.4.0Declaration
Swift
public func create(email: EmailAddress, displayName: String? = nil, firstName: String? = nil, lastName: String? = nil, avatar: String? = nil, orgId: String? = nil, roles: String? = nil, licenses: String? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Person>) -> Void)
Parameters
email
Email address of the person.
displayName
Full name of the person.
firstName
firstName name of the person.
lastName
lastName firstName name of the person.
avatar
URL to the person’s avatar in PNG format.
orgId
ID of the organization to which this person belongs.
roles
Roles of the person.
licenses
Licenses allocated to the person.
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Person
-
update(personId:email:displayName:firstName:lastName:avatar:orgId:roles:licenses:queue:completionHandler:)
Update people in the authenticated user’s organization. Only admins are able to use this function
Since
1.4.0Declaration
Swift
public func update(personId: String, email: EmailAddress? = nil, displayName: String? = nil, firstName: String? = nil, lastName: String? = nil, avatar: String? = nil, orgId: String? = nil, roles: String? = nil, licenses: String? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Person>) -> Void)
Parameters
personId
The identifier of the person.
email
Email address of the person.
displayName
Full name of the person.
firstName
firstName name of the person.
lastName
lastName firstName name of the person.
avatar
URL to the person’s avatar in PNG format.
orgId
ID of the organization to which this person belongs.
roles
Roles of the person.
licenses
Licenses allocated to the person.
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Person
-
Delete the details of person by person id. Only admins are able to use this function
Since
1.4.0Declaration
Swift
public func delete(personId: String, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Any>) -> Void)
Parameters
personId
The identifier of the person.
queue
If not nil, the queue on which the completion handler is dispatched. Otherwise, the handler is dispatched on the application’s main thread.
completionHandler
A closure to be executed once the request has finished.
Return Value
Void