diff --git a/Example/Sources/PetStore/PetStore.swift b/Example/Sources/PetStore/PetStore.swift index d76d7d9..29a8b21 100644 --- a/Example/Sources/PetStore/PetStore.swift +++ b/Example/Sources/PetStore/PetStore.swift @@ -12,10 +12,20 @@ public struct PetStore { .fileIDLine(fileID: fileID, line: line) .bodyDecoder(PetStoreDecoder()) .tokenRefresher { refreshToken, client, _ in - let tokens: Tokens = try await client.path("token").post() + guard let refreshToken else { + throw Errors.noRefreshToken + } + let tokens: Tokens = try await client("auth", "token") + .body(["refresh_token": refreshToken]) + .post() return (tokens.accessToken, tokens.refreshToken, tokens.expiryDate) } } + + public enum Errors: Error { + + case noRefreshToken + } } // MARK: - "pet" path diff --git a/README.md b/README.md index 1c1f229..55ac1dd 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ import PackageDescription let package = Package( name: "SomeProject", dependencies: [ - .package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "0.44.0") + .package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "0.44.1") ], targets: [ .target(