GET
To configure a route with the get method just configure your httpMethod with .get and task with .request.
enum HomeAPI {
case home
}
extension HomeAPI: APIBuilder {
var path: URLPath {
switch self {
case .home:
return .plain("jokes/random")
}
}
var httpMethod: HTTPMethods {
switch self {
case .home:
return .get // Define method GET
}
}
var headers: HTTPHeader {
.empty
}
var task: HTTPTask {
switch self {
case .home:
return .request // This performs a request without a body
}
}
}