RewardsAPI
public enum RewardsAPI
Caseless enumeration with static methods to send Rewards Requests
-
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
parametersThe
Parametersto apply.showFavoritesBool value that specifies if favorites should be included.
completionThe 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
nameName of the reward that will be fetched.
parametersThe
Parametersto apply.completionThe 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
idID of the reward that will be fetched.
parametersThe
Parametersto apply.completionThe 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
rewardReward that will be favorited.
completionThe 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
rewardReward that will be unfavorited.
completionThe 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
rewardReward tgat will be redeemed.
awardIdAward ID of reward to be redeemed.
addressAddress of user.
isResponseBool value that specifies if object is a reward response.
parametersThe
Parametersto apply. combination_id (optional): The combination of attributes idcompletionThe 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
rewardReward tgat will be redeemed.
nonceNonce token.
currencyCurrency.
valueValue to be redeemed.
completionThe closure to be executed once the request has finished.
-
Sends a request to get awards from the API.
Declaration
Swift
public static func getAwards(with parameters: Parameters? = nil, completion: ResponseCompletion<[Award]> = nil)Parameters
parametersThe
Parametersto apply.completionThe closure to be executed once the request has finished.
-
Sends a request to get award with ID.
Declaration
Swift
public static func getAward(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Award> = nil)Parameters
idID of the award that will be fetched.
parametersThe
Parametersto apply.completionThe closure to be executed once the request has finished.
-
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
parametersThe
Parametersto apply.completionThe 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
completionThe 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
redemptionRedemption to be cancelled.
completionThe closure to be executed once the request has finished.
View on GitHub
RewardsAPI Enumeration Reference