ChallengesAPI
public enum ChallengesAPI
Caseless enumeration with static methods to send Challenges Requests
-
Sends a request to get challenges from the API.
Declaration
Swift
public static func getChallenges(with parameters: Parameters? = nil, completion: ResponseCompletion<[Challenge]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get favorited challenges from the API.
Declaration
Swift
public static func getFavedChallenges(with parameters: Parameters? = nil, completion: ResponseCompletion<[Challenge]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get favorited challenges from the API.
Declaration
Swift
public static func getAlertChallenges(with parameters: Parameters? = nil, completion: ResponseCompletion<[Challenge]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get a challenge from the API.
Declaration
Swift
public static func getChallenge(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge> = nil)
Parameters
id
The id of the challenge.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get a challenge from the API.
Declaration
Swift
public static func getChallenge(name: String, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge> = nil)
Parameters
name
The internal name of the challenge.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get challenge responses from the API.
Declaration
Swift
public static func getChallengeResponses(with parameters: Parameters? = nil, completion: ResponseCompletion<[Challenge.Response]> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to get a challenge response from the API.
Declaration
Swift
public static func getChallengeResponse(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge.Response> = nil)
Parameters
id
The id of the challenge response.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to mark a challenge as favorite from the API.
Declaration
Swift
public static func favoriteChallenge(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the challenge.
completion
The closure to be executed once the request has finished.
-
Sends a request to unmark a challenge as favorite from the API.
Declaration
Swift
public static func unfavoriteChallenge(id: Int, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the challenge.
completion
The closure to be executed once the request has finished.
-
Sends a request to respond to a challenge from the API.
Declaration
Swift
public static func respondToChallenge(id: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge.ResponseInfo> = nil)
Parameters
id
The id of the challenge.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to respond to a challenge with an image from the API.
Declaration
Swift
public static func respondToChallengeWithImage(id: Int, image: UIImage, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge.ResponseInfo> = nil)
Parameters
id
The id of the challenge.
image
The image to send.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to respond to a challenge with a video from the API.
Declaration
Swift
public static func respondToChallengeWithVideo(id: Int, videoUrl: URL, with parameters: Parameters? = nil, completion: ResponseCompletion<Challenge.ResponseInfo> = nil)
Parameters
id
The id of the challenge.
videoUrl
The url of the video to send.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to re-enter a response to a challenge from the API. This is only allowed if the initial response was returned/unapproved.
Declaration
Swift
public static func reEnterResponseToChallenge(id: Int, responseId: Int, with parameters: Parameters? = nil, completion: ResponseCompletion<Bool> = nil)
Parameters
id
The id of the challenge.
responseId
The id of the response to the challenge.
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.