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
parametersThe
Parametersto apply.completionThe 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
parametersThe
Parametersto apply.completionThe 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
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge.
parametersThe
Parametersto apply.completionThe 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
nameThe internal name of the challenge.
parametersThe
Parametersto apply.completionThe 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
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge response.
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge.
completionThe 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
idThe id of the challenge.
completionThe 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
idThe id of the challenge.
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge.
imageThe image to send.
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge.
videoUrlThe url of the video to send.
parametersThe
Parametersto apply.completionThe 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
idThe id of the challenge.
responseIdThe id of the response to the challenge.
parametersThe
Parametersto apply.completionThe closure to be executed once the request has finished.
View on GitHub
ChallengesAPI Enumeration Reference