ProfileAPI

public enum ProfileAPI

Caseless enumeration with static methods to send Profile Requests

  • Sends a request to change the user’s password.

    Declaration

    Swift

    public static func change(password oldPassword: String,
                              to newPassword: String,
                              with confirmPassword: String,
                              completion: ResponseCompletion<Bool> = nil)

    Parameters

    oldPassword

    The user’s current password.

    newPassword

    The user’s new password.

    confirmPassword

    The confirmation password.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to connect a social / third-party identity to the user’s profile.

    Declaration

    Swift

    public static func connect(provider: String, token: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    token

    The access token of the provider.

    provider

    The social media / third-party site the user wishes to connect to.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to disconnect a social / third-party identity from the user’s profile.

    Declaration

    Swift

    public static func disconnect(provider: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    provider

    The social media / third-party site the user wishes to disconnect from.

    completion

    The closure to be executed once the request has finished.

  • Sends a request get the user’s account summary which includes current tier, points, etc.

    Declaration

    Swift

    public static func getAccountSummary(completion: ResponseCompletion<AccountSummary> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get another member’s profile given his member ID.

    Declaration

    Swift

    public static func getMemberProfile(memberID: String, completion: ResponseCompletion<AnyCodable> = nil)

    Parameters

    memberID

    The member ID of another user.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get the user’s profile.

    Note that it will return an Any Codable type. Usage is as follows: cast as [String: Any] then proceed with accessing using keys e.g. (response.value.value as? [String:Any])?[“first_name”]

    Declaration

    Swift

    public static func getProfile(completion: ResponseCompletion<AnyCodable> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get the list of social / third-party identities that the user has connected to his profile.

    Declaration

    Swift

    public static func getProfileIdentities(with parameters: Parameters? = nil, completion: ResponseCompletion<[UserIdentity]> = nil)

    Parameters

    parameters

    The Parameters to apply.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get the list of profile attributes of a user profile.

    Declaration

    Swift

    public static func getProfileMetadata(completion: ResponseCompletion<[ProfileAttribute]> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to submit a referral code.

    Declaration

    Swift

    public static func submit(referralCode: String, completion: ResponseCompletion<Bool> = nil)

    Parameters

    referralCode

    The referral code to submit.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to tell if the user is active.

    Declaration

    Swift

    public static func trackActiveUser(completion: ResponseCompletion<Bool> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to update the user’s profile attributes.

    Declaration

    Swift

    public static func update(profileAttributes: Parameters?, completion: ResponseCompletion<Bool> = nil)

    Parameters

    profileAttributes

    The list of attributes to change.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to update the user’s profile avatar.

    Declaration

    Swift

    public static func update(avatar: UIImage, completion: ResponseCompletion<String> = nil)

    Parameters

    avatar

    The UIImage you want to upload.

    completion

    The closure to be executed once the request has finished.