DXUserClient

This class is responsible for making requests to the DX user API.

public final class DXUserClient

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.

Properties

public static let shared: DXUserClient

Singleton instance of DXUserClient. You will access all the available DXUserClient methods through this instance.

Methods

getProfile

public func getProfile(
    completion: @escaping (_ error: Error?, _ userProfile: DXProfile?) -> Void
) -> Void

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.

getFriendProfiles

public func getFriendProfiles(
    completion: @escaping (_ error: Error?, _ friendProfiles: [DXProfile]?) -> Void
) -> Void

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.

searchUsers

public func searchUsers(
    searchTerm: String, 
    page: Int? = nil, 
    limit: Int? = nil, 
    completion: @escaping (_ error: Error?, _ users: [DXProfile]?) -> Void
) -> Void

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.

searchRandomUsers

public func searchRandomUsers(
    count: Int, 
    completion: @escaping (_ error: Error?, _ users: [DXProfile]?) -> Void
) -> Void

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.

Last updated