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
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 idcompletion
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.
-
Sends a request to get awards from the API.
Declaration
Swift
public static func getAwards(with parameters: Parameters? = nil, completion: ResponseCompletion<[Award]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The 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
id
ID of the award 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 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.