Added a DocC catalog coverage check.
This commit is contained in:
1 parent
2cfacd0e14
commit
ff00fdd852
9 files changed
+134
-42
No files matched your search
@@ -8,33 +8,31 @@ ASConnectService exposes every endpoint of Apple's App Store Connect API as a Sw
|
||||
|
||||
### Creating a Client
|
||||
|
||||
Create a ``Client`` with a server URL, a transport, and a ``BearerAuthMiddleware`` that authenticates each request with a JSON Web Token (JWT):
|
||||
Create a ``Client`` with a server URL, a transport, and a ``BearerAuthMiddleware``. With an API key from App Store Connect, ``APIKeyTokenProvider`` signs the JSON Web Tokens (JWT) the API requires, and renews them before they expire:
|
||||
|
||||
```swift
|
||||
import ASConnectService
|
||||
import OpenAPIURLSession
|
||||
|
||||
let client = Client(
|
||||
serverURL: try Servers.Server1.url(),
|
||||
transport: URLSessionTransport(),
|
||||
middlewares: [
|
||||
BearerAuthMiddleware(token: yourJWTToken)
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
Tokens expire after 20 minutes at most. For longer-lived clients, use ``APIKeyTokenProvider``, which signs new ones with your API key as needed:
|
||||
|
||||
```swift
|
||||
let tokenProvider = try APIKeyTokenProvider(
|
||||
issuerID: yourIssuerID,
|
||||
keyID: yourKeyID,
|
||||
privateKey: yourP8FileContents
|
||||
)
|
||||
|
||||
BearerAuthMiddleware {
|
||||
try await tokenProvider.token()
|
||||
}
|
||||
let client = Client(
|
||||
serverURL: try Servers.Server1.url(),
|
||||
transport: URLSessionTransport(),
|
||||
middlewares: [
|
||||
BearerAuthMiddleware { try await tokenProvider.token() }
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
To use a token you signed yourself, pass it directly. It expires after 20 minutes at most:
|
||||
|
||||
```swift
|
||||
BearerAuthMiddleware(token: yourJWTToken)
|
||||
```
|
||||
|
||||
### Making API Calls
|
||||
|
||||
Reference in new issue
Block a user