This PR contains the work done to setup the library and also, the necessary protocols, model, structs, and error definitions to implement remote service clients. Reviewed-on: #4 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
33 lines
702 B
Swift
33 lines
702 B
Swift
//
|
|
// Endpoint.swift
|
|
// ReviewsFeedKit
|
|
//
|
|
// Created by Javier Cicchelli on 17/03/2024.
|
|
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public protocol Endpoint {
|
|
|
|
// MARK: Associated types
|
|
associatedtype Input: EndpointInput
|
|
associatedtype Output: EndpointOutput
|
|
|
|
// MARK: Properties
|
|
var host: URL { get }
|
|
var decoder: JSONDecoder { get }
|
|
var session: URLSession { get }
|
|
|
|
// MARK: Functions
|
|
func callAsFunction(_ input: Input) async throws -> Output
|
|
func makePath(with input: Input) throws -> String
|
|
|
|
}
|
|
|
|
// MARK: - Input
|
|
public protocol EndpointInput {}
|
|
|
|
// MARK: - Output
|
|
public protocol EndpointOutput {}
|