From a164fc78a9d27986b4b7ca862b08a09418ec57e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Cordeiro?= Date: Fri, 6 May 2022 13:06:58 +0200 Subject: [PATCH] Update to latest MicroClient --- .gitignore | 1 + Package.resolved | 6 +- Package.swift | 4 +- .../API/PinboardAPIFactory.swift | 5 +- .../MicroPinboard/API/PostsAPIFactory.swift | 60 +++++++++---------- .../MicroPinboard/API/TagsAPIFactory.swift | 10 ++-- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 113a587..67ed7c0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /Packages /*.xcodeproj xcuserdata/ +DerivedData/ diff --git a/Package.resolved b/Package.resolved index f45766b..f043e40 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,11 +3,11 @@ "pins": [ { "package": "MicroClient", - "repositoryURL": "https://github.com/MicroClientSwift/MicroClient", + "repositoryURL": "https://github.com/otaviocc/MicroClient", "state": { "branch": null, - "revision": "d959c10b6160de50cfa9ef300bb45ddec607cd7b", - "version": "0.0.6" + "revision": "758df84c38dc663cc00b49b377fc8a033a8d4100", + "version": "0.0.12" } } ] diff --git a/Package.swift b/Package.swift index a12b032..12adfad 100644 --- a/Package.swift +++ b/Package.swift @@ -16,8 +16,8 @@ let package = Package( ], dependencies: [ .package( - url: "https://github.com/MicroClientSwift/MicroClient", - from: "0.0.3" + url: "https://github.com/otaviocc/MicroClient", + from: "0.0.12" ) ], targets: [ diff --git a/Sources/MicroPinboard/API/PinboardAPIFactory.swift b/Sources/MicroPinboard/API/PinboardAPIFactory.swift index 1f6d692..c8741e8 100644 --- a/Sources/MicroPinboard/API/PinboardAPIFactory.swift +++ b/Sources/MicroPinboard/API/PinboardAPIFactory.swift @@ -59,10 +59,9 @@ public struct PinboardAPIFactory: PinboardAPIFactoryProtocol { ) -> NetworkConfiguration { .init( session: .shared, - defaultDecoder: JSONDecoder.defaultJSONDecoder, + defaultDecoder: .defaultJSONDecoder, defaultEncoder: JSONEncoder(), - scheme: "https", - hostname: "api.pinboard.in" + baseURL: URL(string: "api.pinboard.in")! ) } } diff --git a/Sources/MicroPinboard/API/PostsAPIFactory.swift b/Sources/MicroPinboard/API/PostsAPIFactory.swift index 35ffed3..019a932 100644 --- a/Sources/MicroPinboard/API/PostsAPIFactory.swift +++ b/Sources/MicroPinboard/API/PostsAPIFactory.swift @@ -17,15 +17,15 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/add", method: .get, - parameters: [ - "url": url.absoluteString, - "description": description, - "extended": extended, - "tags": tags, - "dt": date.map(DateFormatter.defaultAPIFormatter.string), - "replace": replace, - "shared": shared, - "toread": toread + queryItems: [ + .init(name: "url", value: url.absoluteString), + .init(name: "description", value: description), + .init(name: "extended", value: extended), + .init(name: "tags", value: tags), + .init(name: "dt", value: date.map(DateFormatter.defaultAPIFormatter.string)), + .init(name: "replace", value: replace), + .init(name: "shared", value: shared), + .init(name: "toread", value: toread) ] ) } @@ -37,8 +37,8 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/delete", method: .get, - parameters: [ - "url": url.absoluteString + queryItems: [ + .init(name: "url", value: url.absoluteString) ] ) } @@ -53,11 +53,11 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/get", method: .get, - parameters: [ - "tag": tag, - "dt": date.map(DateFormatter.defaultAPIFormatter.string), - "url": url?.absoluteString, - "meta": meta + queryItems: [ + .init(name: "tag", value: tag), + .init(name: "dt", value: date.map(DateFormatter.defaultAPIFormatter.string)), + .init(name: "url", value: url?.absoluteString), + .init(name: "meta", value: meta) ] ) } @@ -69,8 +69,8 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/dates", method: .get, - parameters: [ - "tag": tag + queryItems: [ + .init(name: "tag", value: tag) ] ) } @@ -83,9 +83,9 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/recent", method: .get, - parameters: [ - "tag": tag, - "count": count.map(String.init) + queryItems: [ + .init(name: "tag", value: tag), + .init(name: "count", value: count.map(String.init)) ] ) } @@ -102,13 +102,13 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/all", method: .get, - parameters: [ - "tag": tag, - "start": start.map(String.init), - "results": results.map(String.init), - "fromdt": fromDate.map(DateFormatter.defaultAPIFormatter.string), - "todt": toDate.map(DateFormatter.defaultAPIFormatter.string), - "meta": meta.map(String.init) + queryItems: [ + .init(name: "tag", value: tag), + .init(name: "start", value: start.map(String.init)), + .init(name: "results", value: results.map(String.init)), + .init(name: "fromdt", value: fromDate.map(DateFormatter.defaultAPIFormatter.string)), + .init(name: "todt", value: toDate.map(DateFormatter.defaultAPIFormatter.string)), + .init(name: "meta", value: meta.map(String.init)), ] ) } @@ -120,8 +120,8 @@ public enum PostsAPIFactory { .init( path: "/v1/posts/suggest", method: .get, - parameters: [ - "url": url.absoluteString + queryItems: [ + .init(name: "url", value: url.absoluteString) ] ) } diff --git a/Sources/MicroPinboard/API/TagsAPIFactory.swift b/Sources/MicroPinboard/API/TagsAPIFactory.swift index c0eb749..a8e1a4c 100644 --- a/Sources/MicroPinboard/API/TagsAPIFactory.swift +++ b/Sources/MicroPinboard/API/TagsAPIFactory.swift @@ -20,8 +20,8 @@ public enum TagsAPIFactory { .init( path: "/v1/tags/delete", method: .get, - parameters: [ - "tag": tag + queryItems: [ + .init(name: "tag", value: "tag") ] ) } @@ -34,9 +34,9 @@ public enum TagsAPIFactory { .init( path: "/v1/tags/rename", method: .get, - parameters: [ - "old": old, - "new": new + queryItems: [ + .init(name: "old", value: old), + .init(name: "new", value: new), ] ) }