RewardsAPI

public enum RewardsAPI

Caseless enumeration with static methods to send Rewards Requests

Rewards

  • Sends a request to get rewards from the API.

    Declaration

    Swift

    public static func getRewards(with parameters: Parameters? = nil,
                                  showFavorites: Bool,
                                  completion: ResponseCompletion<[Reward]> = nil)

    Parameters

    parameters

    The Parameters to apply.

    showFavorites

    Bool value that specifies if favorites should be included.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get reward with name.

    Declaration

    Swift

    public static func getReward(name: String,
                                 with parameters: Parameters? = nil,
                                 completion: ResponseCompletion<Reward> = nil)

    Parameters

    name

    Name of the reward that will be fetched.

    parameters

    The Parameters to apply.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get reward with ID.

    Declaration

    Swift

    public static func getReward(id: Int,
                                 with parameters: Parameters? = nil,
                                 completion: ResponseCompletion<Reward> = nil)

    Parameters

    id

    ID of the reward that will be fetched.

    parameters

    The Parameters to apply.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to favorite a reward.

    Declaration

    Swift

    public static func favoriteReward(id: Int, completion: ResponseCompletion<Bool> = nil)

    Parameters

    reward

    Reward that will be favorited.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to unfavorite a reward.

    Declaration

    Swift

    public static func unfavoriteReward(id: Int, completion: ResponseCompletion<Bool> = nil)

    Parameters

    reward

    Reward that will be unfavorited.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to redeem an award.

    Declaration

    Swift

    public static func redeemReward(id: Int,
                                    awardId: Int?,
                                    address: [String: Any]?,
                                    isResponse: Bool,
                                    with parameters: Parameters? = nil,
                                    completion: ResponseCompletion<Reward.ResponseInfo> = nil)

    Parameters

    reward

    Reward tgat will be redeemed.

    awardId

    Award ID of reward to be redeemed.

    address

    Address of user.

    isResponse

    Bool value that specifies if object is a reward response.

    parameters

    The Parameters to apply. combination_id (optional): The combination of attributes id

    completion

    The closure to be executed once the request has finished.

  • Sends a request to redeem an award.

    Declaration

    Swift

    public static func redeemReward(id: Int,
                                    nonce: String,
                                    currency: String,
                                    value: Double,
                                    completion: ResponseCompletion<Reward.ResponseInfo> = nil)

    Parameters

    reward

    Reward tgat will be redeemed.

    nonce

    Nonce token.

    currency

    Currency.

    value

    Value to be redeemed.

    completion

    The closure to be executed once the request has finished.

Awards

Redemptions

  • Sends a request to get redemptions/responses from the API.

    Declaration

    Swift

    public static func getRedemptions(with parameters: Parameters? = nil,
                                      completion: ResponseCompletion<[Reward.Response]> = nil)

    Parameters

    parameters

    The Parameters to apply.

    completion

    The closure to be executed once the request has finished.

  • Sends a request to get redemption with ID.

    Declaration

    Swift

    public static func getRedemption(with id: Int, completion: ResponseCompletion<Reward.Response> = nil)

    Parameters

    completion

    The closure to be executed once the request has finished.

  • Sends a request to cancel redemption with ID.

    Declaration

    Swift

    public static func cancelRedemption(id: Int,
                                        completion: ResponseCompletion<Reward.Response> = nil)

    Parameters

    redemption

    Redemption to be cancelled.

    completion

    The closure to be executed once the request has finished.