Skip to content

Commit

Permalink
0.44.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Mar 21, 2024
1 parent b96e55e commit 46e68e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Example/Sources/PetStore/PetStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 46e68e5

Please sign in to comment.