From 6245e87a983d7aa0f0b7eb3484fbeb78556cf33c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sun, 17 Mar 2024 16:07:08 +0100 Subject: [PATCH] Defined the Endpoint protocol in the Feed library. --- .../Feed/Kit/Sources/Protocols/Endpoint.swift | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Libraries/Feed/Kit/Sources/Protocols/Endpoint.swift diff --git a/Libraries/Feed/Kit/Sources/Protocols/Endpoint.swift b/Libraries/Feed/Kit/Sources/Protocols/Endpoint.swift new file mode 100644 index 0000000..44f59f2 --- /dev/null +++ b/Libraries/Feed/Kit/Sources/Protocols/Endpoint.swift @@ -0,0 +1,32 @@ +// +// 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 {}