This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum HTTPMethod: String { | |
case GET | |
case POST | |
case PUT | |
case DELETE | |
} | |
protocol HTTPRequestRepresentable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
typealias JSON = [String: Any] | |
enum Result<T> { | |
case Value(T) | |
case Error(ErrorRepresentable) | |
case None | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol RequestPreparator { | |
func prepareRequest(_ request: inout HTTPRequestRepresentable) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol SuccessResponseChecker { | |
func isSuccessResponse(_ response: ResponseRepresentable) -> Bool | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ErrorHandler { | |
var errorCodeHandler: ErrorCodeHandler { get set } | |
var errorCodeGetter: ErrorCodeGetter { get set } | |
var errorMessageGetter: ErrorMessageGetter { get set } | |
func handleErrorResponse(_ response: ResponseRepresentable, completion: (ErrorRepresentable) -> ()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol DecodingProcessor { | |
associatedtype DecodingResult | |
func decodeFrom(_ data: Data) throws -> DecodingResult | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ErrorCodeGetter { | |
func errorCodeFrom(_ response: ResponseRepresentable) -> Int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ErrorMessageGetter { | |
func messageFromErrorData(_ data: Data) -> String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol ErrorCodeHandler { | |
func handleError(with code: Int) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol Service { | |
associatedtype ResultTypeValue: Decodable | |
typealias SuccessHandlerBlock = (ResultTypeValue) -> () | |
typealias FailureHandlerBlock = (ErrorRepresentable) -> () | |
var request: HTTPRequestRepresentable? { get set } | |
var responseHandler: HTTPResponseHandler<ResultTypeValue>? { get set } |
OlderNewer