From 4d6df1046d395a31dc95e698dae6440e00e1c5d3 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 03:34:32 +0900 Subject: [PATCH 1/9] `Review.submittedAt` may be nil when just only created --- OctoKit/Review.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 45cda9c..7ccd69b 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -9,7 +9,7 @@ public struct Review { public let commitID: String public let id: Int public let state: State - public let submittedAt: Date + public let submittedAt: Date? public let user: User public init(body: String, From 768132785da6847f18c7cec2f40b8a620870bfbc Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 03:45:14 +0900 Subject: [PATCH 2/9] add `Delete a pending review for a pull request` endpoint --- OctoKit/Review.swift | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 7ccd69b..7f655c5 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -116,7 +116,23 @@ public extension Octokit { } } - #if compiler(>=5.5.2) && canImport(_Concurrency) + @discardableResult + func deletePendingReview(owner: String, + repository: String, + pullRequestNumber: Int, + reviewId: Int, + completion: @escaping (_ response: Result) -> Void) -> URLSessionDataTaskProtocol? { + let router = ReviewsRouter.deletePendingReview(configuration, owner, repository, pullRequestNumber, reviewId) + return router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) { pullRequest, error in + if let error = error { + completion(.failure(error)) + } else if let pullRequest = pullRequest { + completion(.success(pullRequest)) + } + } + } + +#if compiler(>=5.5.2) && canImport(_Concurrency) @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) func reviews(owner: String, repository: String, @@ -137,12 +153,23 @@ public extension Octokit { let router = ReviewsRouter.postReview(configuration, owner, repository, pullRequestNumber, commitId, event, body, comments) return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) } - #endif + + @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) + @discardableResult + func deletePendingReview(owner: String, + repository: String, + pullRequestNumber: Int, + reviewId: Int) async throws -> Review { + let router = ReviewsRouter.deletePendingReview(configuration, owner, repository, pullRequestNumber, reviewId) + return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) + } +#endif } enum ReviewsRouter: JSONPostRouter { case listReviews(Configuration, String, String, Int) case postReview(Configuration, String, String, Int, String?, Review.Event?, String?, [Review.Comment]?) + case deletePendingReview(Configuration, String, String, Int, Int) var method: HTTPMethod { switch self { @@ -150,12 +177,14 @@ enum ReviewsRouter: JSONPostRouter { return .GET case .postReview: return .POST + case .deletePendingReview: + return .DELETE } } var encoding: HTTPEncoding { switch self { - case .postReview: + case .postReview, .deletePendingReview: return .json default: return .url @@ -168,6 +197,8 @@ enum ReviewsRouter: JSONPostRouter { return config case let .postReview(config, _, _, _, _, _, _, _): return config + case let .deletePendingReview(config, _, _, _, _): + return config } } @@ -211,6 +242,8 @@ enum ReviewsRouter: JSONPostRouter { } } return parameters + case .deletePendingReview: + return [:] } } @@ -220,6 +253,8 @@ enum ReviewsRouter: JSONPostRouter { return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews" case let .postReview(_, owner, repository, pullRequestNumber, _, _, _, _): return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews" + case let .deletePendingReview(_, owner, repository, pullRequestNumber, reviewId): + return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews/\(reviewId)" } } } From ed81a10801463a24d78e9d9ff5b4b7746b328fe0 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 04:04:34 +0900 Subject: [PATCH 3/9] add `Submit a review for a pull request` endpoint --- OctoKit/Review.swift | 51 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 7f655c5..983d4e6 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -132,6 +132,24 @@ public extension Octokit { } } + @discardableResult + func submitReview(owner: String, + repository: String, + pullRequestNumber: Int, + reviewId: Int, + event: Review.Event, + body: String? = nil, + completion: @escaping (_ response: Result) -> Void) -> URLSessionDataTaskProtocol? { + let router = ReviewsRouter.submitReview(configuration, owner, repository, pullRequestNumber, reviewId, event, body) + return router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) { pullRequest, error in + if let error = error { + completion(.failure(error)) + } else if let pullRequest = pullRequest { + completion(.success(pullRequest)) + } + } + } + #if compiler(>=5.5.2) && canImport(_Concurrency) @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) func reviews(owner: String, @@ -163,6 +181,18 @@ public extension Octokit { let router = ReviewsRouter.deletePendingReview(configuration, owner, repository, pullRequestNumber, reviewId) return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) } + + @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) + @discardableResult + func submitReview(owner: String, + repository: String, + pullRequestNumber: Int, + reviewId: Int, + event: Review.Event, + body: String? = nil) async throws -> Review { + let router = ReviewsRouter.submitReview(configuration, owner, repository, pullRequestNumber, reviewId, event, body) + return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) + } #endif } @@ -170,6 +200,7 @@ enum ReviewsRouter: JSONPostRouter { case listReviews(Configuration, String, String, Int) case postReview(Configuration, String, String, Int, String?, Review.Event?, String?, [Review.Comment]?) case deletePendingReview(Configuration, String, String, Int, Int) + case submitReview(Configuration, String, String, Int, Int, Review.Event, String?) var method: HTTPMethod { switch self { @@ -179,12 +210,14 @@ enum ReviewsRouter: JSONPostRouter { return .POST case .deletePendingReview: return .DELETE + case .submitReview: + return .POST } } var encoding: HTTPEncoding { switch self { - case .postReview, .deletePendingReview: + case .postReview, .deletePendingReview, .submitReview: return .json default: return .url @@ -199,12 +232,14 @@ enum ReviewsRouter: JSONPostRouter { return config case let .deletePendingReview(config, _, _, _, _): return config + case let .submitReview(config, _, _, _, _, _, _): + return config } } var params: [String: Any] { switch self { - case .listReviews: + case .listReviews, .deletePendingReview: return [:] case let .postReview(_, _, _, _, commitId, event, body, comments): var parameters = [String: Any]() @@ -242,8 +277,14 @@ enum ReviewsRouter: JSONPostRouter { } } return parameters - case .deletePendingReview: - return [:] + case let .submitReview(_, _, _, _, _, event, body): + var parameters: [String: Any] = [ + "event": event.rawValue + ] + if let body = body { + parameters["body"] = body + } + return parameters } } @@ -255,6 +296,8 @@ enum ReviewsRouter: JSONPostRouter { return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews" case let .deletePendingReview(_, owner, repository, pullRequestNumber, reviewId): return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews/\(reviewId)" + case let .submitReview(_, owner, repository, pullRequestNumber, reviewId, _, _): + return "repos/\(owner)/\(repository)/pulls/\(pullRequestNumber)/reviews/\(reviewId)/events" } } } From 537a88933801714fb351aca05279e4c446e679f5 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 05:08:03 +0900 Subject: [PATCH 4/9] add tests --- Tests/OctoKitTests/ReviewTests.swift | 130 +++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/Tests/OctoKitTests/ReviewTests.swift b/Tests/OctoKitTests/ReviewTests.swift index 22c3780..4bd5df1 100644 --- a/Tests/OctoKitTests/ReviewTests.swift +++ b/Tests/OctoKitTests/ReviewTests.swift @@ -133,4 +133,134 @@ class ReviewTests: XCTestCase { XCTAssertTrue(session.wasCalled) } #endif + + func testDeletePendingReview() { + let session = OctoKitURLTestSession(expectedURL: "https://api.github.com/repos/octocat/Hello-World/pulls/1/reviews/80", expectedHTTPMethod: "DELETE", jsonFile: "review", statusCode: 200) + let task = Octokit(session: session).deletePendingReview(owner: "octocat", + repository: "Hello-World", + pullRequestNumber: 1, + reviewId: 80) { + switch $0 { + case let .success(review): + XCTAssertEqual(review.body, "Here is the body for the review.") + XCTAssertEqual(review.commitID, "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091") + XCTAssertEqual(review.id, 80) + XCTAssertEqual(review.state, .approved) + XCTAssertEqual(review.submittedAt, Date(timeIntervalSince1970: 1_574_012_623.0)) + XCTAssertEqual(review.user.avatarURL, "https://github.com/images/error/octocat_happy.gif") + XCTAssertNil(review.user.blog) + XCTAssertNil(review.user.company) + XCTAssertNil(review.user.email) + XCTAssertEqual(review.user.gravatarID, "") + XCTAssertEqual(review.user.id, 1) + XCTAssertNil(review.user.location) + XCTAssertEqual(review.user.login, "octocat") + XCTAssertNil(review.user.name) + XCTAssertNil(review.user.numberOfPublicGists) + XCTAssertNil(review.user.numberOfPublicRepos) + XCTAssertNil(review.user.numberOfPrivateRepos) + XCTAssertEqual(review.user.type, "User") + case .failure: + XCTFail("should not get an error") + } + } + XCTAssertNotNil(task) + XCTAssertTrue(session.wasCalled) + } + + #if compiler(>=5.5.2) && canImport(_Concurrency) + @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) + func testDeletePendingReviewAsync() async throws { + let session = OctoKitURLTestSession(expectedURL: "https://api.github.com/repos/octocat/Hello-World/pulls/1/reviews/80", expectedHTTPMethod: "DELETE", jsonFile: "review", statusCode: 200) + let review = try await Octokit(session: session).deletePendingReview(owner: "octocat", + repository: "Hello-World", + pullRequestNumber: 1, + reviewId: 80) + XCTAssertEqual(review.body, "Here is the body for the review.") + XCTAssertEqual(review.commitID, "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091") + XCTAssertEqual(review.id, 80) + XCTAssertEqual(review.state, .approved) + XCTAssertEqual(review.submittedAt, Date(timeIntervalSince1970: 1_574_012_623.0)) + XCTAssertEqual(review.user.avatarURL, "https://github.com/images/error/octocat_happy.gif") + XCTAssertNil(review.user.blog) + XCTAssertNil(review.user.company) + XCTAssertNil(review.user.email) + XCTAssertEqual(review.user.gravatarID, "") + XCTAssertEqual(review.user.id, 1) + XCTAssertNil(review.user.location) + XCTAssertEqual(review.user.login, "octocat") + XCTAssertNil(review.user.name) + XCTAssertNil(review.user.numberOfPublicGists) + XCTAssertNil(review.user.numberOfPublicRepos) + XCTAssertNil(review.user.numberOfPrivateRepos) + XCTAssertEqual(review.user.type, "User") + XCTAssertTrue(session.wasCalled) + } + #endif + + func testSubmitReview() { + let session = OctoKitURLTestSession(expectedURL: "https://api.github.com/repos/octocat/Hello-World/pulls/1/reviews/80/events", expectedHTTPMethod: "POST", jsonFile: "review", statusCode: 200) + let task = Octokit(session: session).submitReview(owner: "octocat", + repository: "Hello-World", + pullRequestNumber: 1, + reviewId: 80, + event: .approve) { + switch $0 { + case let .success(review): + XCTAssertEqual(review.body, "Here is the body for the review.") + XCTAssertEqual(review.commitID, "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091") + XCTAssertEqual(review.id, 80) + XCTAssertEqual(review.state, .approved) + XCTAssertEqual(review.submittedAt, Date(timeIntervalSince1970: 1_574_012_623.0)) + XCTAssertEqual(review.user.avatarURL, "https://github.com/images/error/octocat_happy.gif") + XCTAssertNil(review.user.blog) + XCTAssertNil(review.user.company) + XCTAssertNil(review.user.email) + XCTAssertEqual(review.user.gravatarID, "") + XCTAssertEqual(review.user.id, 1) + XCTAssertNil(review.user.location) + XCTAssertEqual(review.user.login, "octocat") + XCTAssertNil(review.user.name) + XCTAssertNil(review.user.numberOfPublicGists) + XCTAssertNil(review.user.numberOfPublicRepos) + XCTAssertNil(review.user.numberOfPrivateRepos) + XCTAssertEqual(review.user.type, "User") + case .failure: + XCTFail("should not get an error") + } + } + XCTAssertNotNil(task) + XCTAssertTrue(session.wasCalled) + } + + #if compiler(>=5.5.2) && canImport(_Concurrency) + @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) + func testSubmitReviewAsync() async throws { + let session = OctoKitURLTestSession(expectedURL: "https://api.github.com/repos/octocat/Hello-World/pulls/1/reviews/80/events", expectedHTTPMethod: "POST", jsonFile: "review", statusCode: 200) + let review = try await Octokit(session: session).submitReview(owner: "octocat", + repository: "Hello-World", + pullRequestNumber: 1, + reviewId: 80, + event: .approve) + XCTAssertEqual(review.body, "Here is the body for the review.") + XCTAssertEqual(review.commitID, "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091") + XCTAssertEqual(review.id, 80) + XCTAssertEqual(review.state, .approved) + XCTAssertEqual(review.submittedAt, Date(timeIntervalSince1970: 1_574_012_623.0)) + XCTAssertEqual(review.user.avatarURL, "https://github.com/images/error/octocat_happy.gif") + XCTAssertNil(review.user.blog) + XCTAssertNil(review.user.company) + XCTAssertNil(review.user.email) + XCTAssertEqual(review.user.gravatarID, "") + XCTAssertEqual(review.user.id, 1) + XCTAssertNil(review.user.location) + XCTAssertEqual(review.user.login, "octocat") + XCTAssertNil(review.user.name) + XCTAssertNil(review.user.numberOfPublicGists) + XCTAssertNil(review.user.numberOfPublicRepos) + XCTAssertNil(review.user.numberOfPrivateRepos) + XCTAssertEqual(review.user.type, "User") + XCTAssertTrue(session.wasCalled) + } + #endif } From 3464406d46aa80abc86230dd6660e0bfcc0c00e0 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 05:08:19 +0900 Subject: [PATCH 5/9] replace `load` with `post` --- OctoKit/Review.swift | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 983d4e6..56395db 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -169,7 +169,10 @@ public extension Octokit { body: String? = nil, comments: [Review.Comment] = []) async throws -> Review { let router = ReviewsRouter.postReview(configuration, owner, repository, pullRequestNumber, commitId, event, body, comments) - return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) + // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) + return try await router.post(session, decoder: decoder, expectedResultType: Review.self) } @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) @@ -179,7 +182,10 @@ public extension Octokit { pullRequestNumber: Int, reviewId: Int) async throws -> Review { let router = ReviewsRouter.deletePendingReview(configuration, owner, repository, pullRequestNumber, reviewId) - return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) + // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) + return try await router.post(session, decoder: decoder, expectedResultType: Review.self) } @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) @@ -191,7 +197,10 @@ public extension Octokit { event: Review.Event, body: String? = nil) async throws -> Review { let router = ReviewsRouter.submitReview(configuration, owner, repository, pullRequestNumber, reviewId, event, body) - return try await router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) + // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) + return try await router.post(session, decoder: decoder, expectedResultType: Review.self) } #endif } @@ -288,6 +297,8 @@ enum ReviewsRouter: JSONPostRouter { } } + + var path: String { switch self { case let .listReviews(_, owner, repository, pullRequestNumber): From dc17fda17d26587e11f7ba075086782f66db5e48 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Mon, 3 Jul 2023 11:33:09 +0900 Subject: [PATCH 6/9] run swiftformat --- OctoKit/Review.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 56395db..1fb6e0d 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -150,7 +150,7 @@ public extension Octokit { } } -#if compiler(>=5.5.2) && canImport(_Concurrency) + #if compiler(>=5.5.2) && canImport(_Concurrency) @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) func reviews(owner: String, repository: String, @@ -202,7 +202,7 @@ public extension Octokit { decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) return try await router.post(session, decoder: decoder, expectedResultType: Review.self) } -#endif + #endif } enum ReviewsRouter: JSONPostRouter { @@ -297,8 +297,6 @@ enum ReviewsRouter: JSONPostRouter { } } - - var path: String { switch self { case let .listReviews(_, owner, repository, pullRequestNumber): From 954c50beadfd92e187522ac785fb082e9f41cf9e Mon Sep 17 00:00:00 2001 From: Takuhiro Muta <417.72ki@gmail.com> Date: Tue, 2 Jul 2024 23:00:42 +0900 Subject: [PATCH 7/9] bump RequestKit to 3.3.0 --- Package.resolved | 4 ++-- Package.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Package.resolved b/Package.resolved index 2500a12..95a48fe 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/nerdishbynature/RequestKit.git", "state": { "branch": null, - "revision": "8b0258ea2a4345cbcac90509b764faacea12efb0", - "version": "3.2.1" + "revision": "e4d905fed938807e36d87f28375f88b7c1c26840", + "version": "3.3.0" } }, { diff --git a/Package.swift b/Package.swift index 4e82622..7ff4c2c 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/nerdishbynature/RequestKit.git", from: "3.2.1"), + .package(url: "https://github.com/nerdishbynature/RequestKit.git", from: "3.3.0"), .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.52.8") ], targets: [ From 88f04a580ea38e2f1c05e6bfd59adbd78ffb4d80 Mon Sep 17 00:00:00 2001 From: Takuhiro Muta <417.72ki@gmail.com> Date: Tue, 2 Jul 2024 23:01:56 +0900 Subject: [PATCH 8/9] Resolve `FIXME`s --- OctoKit/Review.swift | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/OctoKit/Review.swift b/OctoKit/Review.swift index 1fb6e0d..aa9a088 100644 --- a/OctoKit/Review.swift +++ b/OctoKit/Review.swift @@ -169,10 +169,7 @@ public extension Octokit { body: String? = nil, comments: [Review.Comment] = []) async throws -> Review { let router = ReviewsRouter.postReview(configuration, owner, repository, pullRequestNumber, commitId, event, body, comments) - // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) - return try await router.post(session, decoder: decoder, expectedResultType: Review.self) + return try await router.post(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) } @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) @@ -182,10 +179,7 @@ public extension Octokit { pullRequestNumber: Int, reviewId: Int) async throws -> Review { let router = ReviewsRouter.deletePendingReview(configuration, owner, repository, pullRequestNumber, reviewId) - // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) - return try await router.post(session, decoder: decoder, expectedResultType: Review.self) + return try await router.post(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) } @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) @@ -197,10 +191,7 @@ public extension Octokit { event: Review.Event, body: String? = nil) async throws -> Review { let router = ReviewsRouter.submitReview(configuration, owner, repository, pullRequestNumber, reviewId, event, body) - // FIXME: Replace when RequestKit updated with implementing `post(_:dateDecodingStrategy:expectedResultType:)` - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter) - return try await router.post(session, decoder: decoder, expectedResultType: Review.self) + return try await router.post(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: Review.self) } #endif } From 19b8acf891b45427141655760087dbcf1930e106 Mon Sep 17 00:00:00 2001 From: Takuhiro Muta <417.72ki@gmail.com> Date: Tue, 2 Jul 2024 23:06:39 +0900 Subject: [PATCH 9/9] fix RequestKit version in xcodeproj --- OctoKit.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/OctoKit.xcodeproj/project.pbxproj b/OctoKit.xcodeproj/project.pbxproj index 120b842..6540ac8 100644 --- a/OctoKit.xcodeproj/project.pbxproj +++ b/OctoKit.xcodeproj/project.pbxproj @@ -1720,7 +1720,7 @@ repositoryURL = "https://github.com/nerdishbynature/RequestKit.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 3.2.1; + minimumVersion = 3.3.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/OctoKit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/OctoKit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 51e06cc..1dfd9f8 100644 --- a/OctoKit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/OctoKit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,16 +1,15 @@ { - "object": { - "pins": [ - { - "package": "RequestKit", - "repositoryURL": "https://github.com/nerdishbynature/RequestKit.git", - "state": { - "branch": null, - "revision": "8b0258ea2a4345cbcac90509b764faacea12efb0", - "version": "3.2.1" - } + "originHash" : "530774d6f20b0f00dacedf9498eab8ef4fc75274d7d10f28ee2fdbb4aab6bbb8", + "pins" : [ + { + "identity" : "requestkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/nerdishbynature/RequestKit.git", + "state" : { + "revision" : "e4d905fed938807e36d87f28375f88b7c1c26840", + "version" : "3.3.0" } - ] - }, - "version": 1 + } + ], + "version" : 3 }