Hello, World!
I wonder how many other programmers have started a blog like that.
This post will probably be me testing out the platform, seeing how it handles code snippets, then calling it a day.
/// A protocol that declares how an API Client will function.
public protocol RequestSending {
// use this method for a request that you require parsed data from.
@discardableResult
func sendRequest<Decoder: JSONParsing>(_ apiRequest: APIRequest,
decodeJSONWith decodingType: Decoder.Type,
completion: @escaping (APIResult<Decoder.ResultType>) -> Void) -> URLSessionTask?
// use this method for requests where just the response status code is enough.
@discardableResult
func sendRequest(_ apiRequest: APIRequest,
completion: @escaping (EmptyAPIResult) -> Void) -> URLSessionTask?
}
public protocol AuthenticatedRequestSending: RequestSending {
var authentication: AuthCredentials? { get set }
}
public protocol AuthCredentials {
var authToken: String { get }
}
ooh! Now wasn't that pretty.
I'm calling it a day. It's Beer O'Clock somewhere...