DXUserClient
This class is responsible for making requests to the DX user API.
Last updated
This class is responsible for making requests to the DX user API.
Last updated
The DXUserClient
class allows your app to request the current user's profile, request the current user's friends, and search for other DX users, giving your app access to the DX social network.
You will need to enable the "Profile" and "Smart Search" scopes for your app in the developer dashboard before using the user API.
Singleton instance of DXUserClient
. You will access all the available DXUserClient
methods through this instance.
Request the currently authenticated user's profile. It's unlikely that you will need to directly use this method, as the isAuthenticated method on DXAuthClient
will pass an instance of DXProfile
representing the current user.
Request the current user's friends list. When running in sandbox mode, you can created friendship links between sandbox users in the developer dashboard, allowing you to create and test a social network in your app.
Search for DX users by a search term. The search term will be compared against users' handle, first name, and last name. Supports pagination through the page
and limit
parameters.
Request a number of random users. This is useful if you want to display a number of random profiles without requiring the user to search for them.
Parameter
Type
Description
completion
(Error?, DXProfile?) -> Void
The closure that will be invoked once the request finishes.
error
Error?
The error returned for an unsuccessful request.
userProfile
DXProfile?
An instance of DXProfile
representing the current user that will be returned for a successful request.
Parameter
Type
Description
completion
(Error?, [DXProfile]?) -> Void
The closure that will be invoked once the request finishes.
error
Error?
The error returned for an unsuccessful request.
friendProfiles
[DXProfile]?
An array of DXProfile
representing the current user's friends returned for a successful request.
Parameter
Type
Description
searchTerm
String
What users will be searched by.
page
Int?
At what page to return users, where the page length is determined by limit
.
limit
Int?
The maximum number of users to return.
completion
(Error?, [DXProfile]?) -> Void
The closure that will be invoked once the request finishes.
error
Error?
The error returned for an unsuccessful request.
users
[DXProfile]?
An array of DXProfile
that matched the search term returned for a successful request.
Parameter
Type
Description
count
Int
The number of random users to return.
completion
(Error?, [DXProfile]?) -> Void
The closure that will be invoked once the request finishes.
error
Error?
The error returned for an unsuccessful request.
users
[DXProfile]?
An array of DXProfile
representing the random users returned for a successful request.