Files
asconnect-service/Sources/ASConnectService/Catalogs/ASConnectService.docc/Extensions/Client.md
T

34 lines
818 B
Markdown
Raw Normal View History

2026-03-26 01:07:23 +00:00
# ``Client``
The App Store Connect API client.
2026-03-26 01:07:23 +00:00
## Overview
``Client`` implements every ``APIProtocol`` method by sending the request through its transport, after passing it through its middlewares.
2026-03-26 01:07:23 +00:00
Include ``BearerAuthMiddleware`` in `middlewares` to authenticate requests:
2026-03-26 01:07:23 +00:00
```swift
import ASConnectService
import OpenAPIURLSession
let client = Client(
serverURL: try Servers.Server1.url(),
2026-03-26 01:07:23 +00:00
transport: URLSessionTransport(),
middlewares: [
BearerAuthMiddleware(token: yourJWTToken)
]
)
```
Each method takes either a single `Input` value or its `path`, `query`, `headers`, and `body` as separate arguments:
2026-03-26 01:07:23 +00:00
```swift
let response = try await client.appsGetInstance(path: .init(id: appID))
2026-03-26 01:07:23 +00:00
```
## Topics
### Creating a Client
- ``init(serverURL:configuration:transport:middlewares:)``