From 83a4c1b37ba2b3028103c192ca16ba99d718c953 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:44:59 +0200 Subject: [PATCH 01/11] Removed boilerplate files from the project. --- Sources/AmiiboService/AmiiboService.swift | 6 ------ Tests/AmiiboServiceTests/AmiiboServiceTests.swift | 11 ----------- 2 files changed, 17 deletions(-) delete mode 100644 Sources/AmiiboService/AmiiboService.swift delete mode 100644 Tests/AmiiboServiceTests/AmiiboServiceTests.swift diff --git a/Sources/AmiiboService/AmiiboService.swift b/Sources/AmiiboService/AmiiboService.swift deleted file mode 100644 index 48d14a1..0000000 --- a/Sources/AmiiboService/AmiiboService.swift +++ /dev/null @@ -1,6 +0,0 @@ -public struct AmiiboService { - public private(set) var text = "Hello, World!" - - public init() { - } -} diff --git a/Tests/AmiiboServiceTests/AmiiboServiceTests.swift b/Tests/AmiiboServiceTests/AmiiboServiceTests.swift deleted file mode 100644 index 4aecad6..0000000 --- a/Tests/AmiiboServiceTests/AmiiboServiceTests.swift +++ /dev/null @@ -1,11 +0,0 @@ -import XCTest -@testable import AmiiboService - -final class AmiiboServiceTests: XCTestCase { - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - XCTAssertEqual(AmiiboService().text, "Hello, World!") - } -} -- 2.47.1 From 30dbaa3cc62be659e3e12a064e21d5e5b13e3ea3 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:46:10 +0200 Subject: [PATCH 02/11] Added the SwiftLibs package as a dependency and set the minimum platform targets in the Package file. --- Package.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 94de2e6..7ed4db2 100644 --- a/Package.swift +++ b/Package.swift @@ -4,6 +4,12 @@ import PackageDescription let package = Package( name: "AmiiboService", + platforms: [ + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v8) + ], products: [ .library( name: "AmiiboService", @@ -12,11 +18,15 @@ let package = Package( ] ), ], - dependencies: [], + dependencies: [ + .package(url: "https://github.com/rock-n-code/swift-libs.git", from: "0.1.0") + ], targets: [ .target( name: "AmiiboService", - dependencies: [], + dependencies: [ + .product(name: "SwiftLibs", package: "swift-libs") + ], path: "Sources" ), .testTarget( -- 2.47.1 From 247049268c29a9162fa33d7d23a458dfb16a83fa Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:48:10 +0200 Subject: [PATCH 03/11] Defined the constants for the String+Scheme extension. --- Sources/Extensions/String+Scheme.swift | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Sources/Extensions/String+Scheme.swift diff --git a/Sources/Extensions/String+Scheme.swift b/Sources/Extensions/String+Scheme.swift new file mode 100644 index 0000000..e5291e3 --- /dev/null +++ b/Sources/Extensions/String+Scheme.swift @@ -0,0 +1,5 @@ +extension String { + enum Scheme { + static let https = "https" + } +} -- 2.47.1 From ebcb7439d6fa60b65874d70c38fa30d29effd0b9 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:48:22 +0200 Subject: [PATCH 04/11] Defined the constants for the String+Host extension. --- Sources/Extensions/String+Host.swift | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Sources/Extensions/String+Host.swift diff --git a/Sources/Extensions/String+Host.swift b/Sources/Extensions/String+Host.swift new file mode 100644 index 0000000..1e2c023 --- /dev/null +++ b/Sources/Extensions/String+Host.swift @@ -0,0 +1,5 @@ +extension String { + enum Host { + static let amiiboApi = "www.amiiboapi.com" + } +} -- 2.47.1 From 0780c09c018962b8775f5b52ca631e88e13cb14b Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:48:33 +0200 Subject: [PATCH 05/11] Defined the constants for the String+Path extension. --- Sources/Extensions/String+Path.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Sources/Extensions/String+Path.swift diff --git a/Sources/Extensions/String+Path.swift b/Sources/Extensions/String+Path.swift new file mode 100644 index 0000000..fbd2a7f --- /dev/null +++ b/Sources/Extensions/String+Path.swift @@ -0,0 +1,10 @@ +extension String { + enum Path { + static let amiibo = "/api/amiibo/" + static let type = "/api/type" + static let gameSeries = "/api/gameseries" + static let series = "/api/amiiboseries" + static let character = "/api/character" + static let lastUpdated = "/api/lastupdated" + } +} -- 2.47.1 From 34eca0b427f5a891024823b1742619f04224a7fb Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:48:57 +0200 Subject: [PATCH 06/11] Implemented the GetAmiiboEndpoint endpoint. --- Sources/Endpoints/GetAmiiboEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetAmiiboEndpoint.swift diff --git a/Sources/Endpoints/GetAmiiboEndpoint.swift b/Sources/Endpoints/GetAmiiboEndpoint.swift new file mode 100644 index 0000000..fb3046f --- /dev/null +++ b/Sources/Endpoints/GetAmiiboEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetAmiiboEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.type + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1 From 6b1384cf28216c6c2a168da5fadffef9bfc6cef3 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:49:15 +0200 Subject: [PATCH 07/11] Implemented the GetTypeEndpoint endpoint. --- Sources/Endpoints/GetTypeEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetTypeEndpoint.swift diff --git a/Sources/Endpoints/GetTypeEndpoint.swift b/Sources/Endpoints/GetTypeEndpoint.swift new file mode 100644 index 0000000..677f0d2 --- /dev/null +++ b/Sources/Endpoints/GetTypeEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetTypeEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.type + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1 From 316447f98e1c60ff77997157116cd6ae7fda458c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:49:34 +0200 Subject: [PATCH 08/11] Implemented the GetGameSeriesEndpoint endpoint. --- Sources/Endpoints/GetGameSeriesEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetGameSeriesEndpoint.swift diff --git a/Sources/Endpoints/GetGameSeriesEndpoint.swift b/Sources/Endpoints/GetGameSeriesEndpoint.swift new file mode 100644 index 0000000..033ba65 --- /dev/null +++ b/Sources/Endpoints/GetGameSeriesEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetGameSeriesEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.gameSeries + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1 From c697d3fd1effc7365c051943bb3012af41398799 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:49:54 +0200 Subject: [PATCH 09/11] Implemented the GetSeriesEndpoint endpoint. --- Sources/Endpoints/GetSeriesEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetSeriesEndpoint.swift diff --git a/Sources/Endpoints/GetSeriesEndpoint.swift b/Sources/Endpoints/GetSeriesEndpoint.swift new file mode 100644 index 0000000..f791566 --- /dev/null +++ b/Sources/Endpoints/GetSeriesEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetSeriesEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.series + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1 From 6b3ea5419aeddf60d2589ff1f98d8ad65bba9397 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:50:09 +0200 Subject: [PATCH 10/11] Implemented the GetCharacterEndpoint endpoint. --- Sources/Endpoints/GetCharacterEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetCharacterEndpoint.swift diff --git a/Sources/Endpoints/GetCharacterEndpoint.swift b/Sources/Endpoints/GetCharacterEndpoint.swift new file mode 100644 index 0000000..8b08a7b --- /dev/null +++ b/Sources/Endpoints/GetCharacterEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetCharacterEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.character + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1 From dee2c5b4cef858466a3da6dd64e81eecca9455c4 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 18 Apr 2023 21:50:34 +0200 Subject: [PATCH 11/11] Implemented the GetLastUpdatedEndpoint endpoint. --- Sources/Endpoints/GetLastUpdatedEndpoint.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Sources/Endpoints/GetLastUpdatedEndpoint.swift diff --git a/Sources/Endpoints/GetLastUpdatedEndpoint.swift b/Sources/Endpoints/GetLastUpdatedEndpoint.swift new file mode 100644 index 0000000..1d7d0a2 --- /dev/null +++ b/Sources/Endpoints/GetLastUpdatedEndpoint.swift @@ -0,0 +1,16 @@ +import Communications +import Foundation + +struct GetLastUpdatedEndpoint: Endpoint { + + // MARK: Properties + + let scheme: String = .Scheme.https + let host: String = .Host.amiiboApi + let port: Int? + let path: String = .Path.lastUpdated + let method: HTTPRequestMethod = .get + let headers: [String : String] = [:] + let body: Data? + +} -- 2.47.1