From e1e5a9a36d84c521bc0df640be27564703b21e85 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Mon, 10 Apr 2023 13:12:28 +0200 Subject: [PATCH] Declared the Endpoint protocol and the HTTPRequestMethod enumeration. --- .../Enumerations/HTTPRequestMethod.swift | 12 +++++++++++ .../Libraries/Sources/APICore/Libraries.swift | 6 ------ .../Sources/APICore/Protocols/Endpoint.swift | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 Apps/Locations/Libraries/Sources/APICore/Enumerations/HTTPRequestMethod.swift delete mode 100644 Apps/Locations/Libraries/Sources/APICore/Libraries.swift create mode 100644 Apps/Locations/Libraries/Sources/APICore/Protocols/Endpoint.swift diff --git a/Apps/Locations/Libraries/Sources/APICore/Enumerations/HTTPRequestMethod.swift b/Apps/Locations/Libraries/Sources/APICore/Enumerations/HTTPRequestMethod.swift new file mode 100644 index 0000000..f45d043 --- /dev/null +++ b/Apps/Locations/Libraries/Sources/APICore/Enumerations/HTTPRequestMethod.swift @@ -0,0 +1,12 @@ +// +// HTTPRequestMethod.swift +// APICore +// +// Created by Javier Cicchelli on 10/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +/// Enumeration that represents the available HTTP request methods to use in this library. +public enum HTTPRequestMethod: String { + case get = "GET" +} diff --git a/Apps/Locations/Libraries/Sources/APICore/Libraries.swift b/Apps/Locations/Libraries/Sources/APICore/Libraries.swift deleted file mode 100644 index c1536b6..0000000 --- a/Apps/Locations/Libraries/Sources/APICore/Libraries.swift +++ /dev/null @@ -1,6 +0,0 @@ -public struct Libraries { - public private(set) var text = "Hello, World!" - - public init() { - } -} diff --git a/Apps/Locations/Libraries/Sources/APICore/Protocols/Endpoint.swift b/Apps/Locations/Libraries/Sources/APICore/Protocols/Endpoint.swift new file mode 100644 index 0000000..4e7df7d --- /dev/null +++ b/Apps/Locations/Libraries/Sources/APICore/Protocols/Endpoint.swift @@ -0,0 +1,20 @@ +// +// Endpoint.swift +// APICore +// +// Created by Javier Cicchelli on 10/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// + +import Foundation + +/// This protocol defines an endpoint to be used in an API call. +public protocol Endpoint { + var scheme: String { get } + var host: String { get } + var port: Int? { get } + var path: String { get } + var method: HTTPRequestMethod { get } + var headers: [String: String] { get } + var body: Data? { get } +}