OffersAPI
public enum OffersAPI
Caseless enumeration with static methods to send Offer Requests.
-
Sends a request to get offers from the API.
Declaration
Swift
public static func getOffers(with parameters: Parameters? = nil, completion: ResponseCompletion<[Offer]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get favorited offers from the API.
Declaration
Swift
public static func getFavedOffers(with parameters: Parameters? = nil, completion: ResponseCompletion<[Offer]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get an offer from the API.
Declaration
Swift
public static func getOffer(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Offer> = nil)
Parameters
id
The id of the offer.
parameters
The
Parameters
to apply. Commonly used parameter keys are:completion
The closure to be executed once the request has finished.
-
Sends a request to mark an offer as favorite from the API.
Declaration
Swift
public static func favoriteOffer(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the offer.
completion
The closure to be executed once the request has finished.
-
Sends a request to unmark an offer as favorite from the API.
Declaration
Swift
public static func unfavoriteOffer(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the offer.
completion
The closure to be executed once the request has finished.
-
Sends a request to clip an offer as favorite from the API.
Declaration
Swift
public static func clipOffer(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the offer.
completion
The closure to be executed once the request has finished.
-
Sends a request to unclip an offer as favorite from the API.
Declaration
Swift
public static func unclipOffer(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the offer.
completion
The closure to be executed once the request has finished.
-
Sends a request to respond to an offer from the API.
Declaration
Swift
public static func respondToOffer(id: Int, completion: ResponseCompletion<Offer.ResponseInfo> = nil)
Parameters
id
The id of the offer.
completion
The closure to be executed once the request has finished.
-
Sends a request to get offer responses from the API.
Declaration
Swift
public static func getOfferResponses(with parameters: Parameters? = nil, completion: ResponseCompletion<[Offer.Response]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get an offer response from the API.
Declaration
Swift
public static func getOfferResponse(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Offer.Response> = nil)
Parameters
id
The id of the offer.
parameters
The
Parameters
to apply. Commonly used parameter keys are:completion
The closure to be executed once the request has finished.
-
Sends a request to get offer categories from the API.
Declaration
Swift
public static func getOffersCategories(completion: ResponseCompletion<[Offer.Category]> = nil)
Parameters
completion
The closure to be executed once the request has finished.