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

121 lines
3.4 KiB
Markdown

# ``ASConnectService``
A Swift client library for the App Store Connect API, generated from the official OpenAPI specification.
## Overview
``ASConnectService`` provides a type-safe, Swift-native interface to Apple's App Store Connect API. This package enables developers to programmatically interact with App Store Connect services for managing apps, builds, reviews, sales reports, and more.
The library is automatically generated from the official App Store Connect API OpenAPI specification using Apple's `swift-openapi-generator`, ensuring complete API coverage and type safety.
## Key Features
- **Type-Safe API**: Fully typed requests and responses based on the OpenAPI specification
- **Async/Await Support**: Modern Swift concurrency with `async`/`await`
- **Cross-Platform**: Supports iOS, macOS, tvOS, visionOS, and watchOS
- **Automatic Generation**: Code is generated from the official API specification
- **Comprehensive Coverage**: Access to all App Store Connect API endpoints
## Installation
Add ``ASConnectService`` as a dependency in your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/rock-n-code/asconnect-service.git", from: "1.0.0")
]
```
Then add it to your target dependencies:
```swift
.target(
name: "YourTarget",
dependencies: [
"ASConnectService"
]
)
```
## Basic Usage
```swift
import ASConnectService
import OpenAPIURLSession
// Create a client with your API key
let client = Client(
serverURL: try Servers.server1(),
transport: URLSessionTransport()
)
// Make API calls
let apps = try await client.apps_get()
```
## Authentication
The App Store Connect API requires authentication using API keys. You'll need to:
1. Create an API key in App Store Connect
2. Generate a signed JWT token using your key ID, issuer ID, and private key
3. Pass the token to the built-in ``BearerAuthMiddleware`` when creating the client
```swift
import ASConnectService
import OpenAPIURLSession
let client = Client(
serverURL: try Servers.server1(),
transport: URLSessionTransport(),
middlewares: [BearerAuthMiddleware(token: yourJWTToken)]
)
```
The ``BearerAuthMiddleware`` automatically injects the `Authorization` header with the Bearer token into every outgoing request.
## Supported Platforms
- iOS 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
## Dependencies
- [swift-openapi-generator](https://github.com/apple/swift-openapi-generator)
- [swift-openapi-runtime](https://github.com/apple/swift-openapi-runtime)
- [swift-openapi-urlsession](https://github.com/apple/swift-openapi-urlsession)
- [swift-docc-plugin](https://github.com/swiftlang/swift-docc-plugin)
## Topics
### Getting Started
- ``Client``: The main API client for making requests
### Authentication
- ``BearerAuthMiddleware``: A client middleware that injects a Bearer token into outgoing HTTP requests
### API Endpoints
The package provides access to all App Store Connect API endpoints including:
- Apps and app management
- Builds and beta testing
- App Store reviews and ratings
- Sales and financial reports
- User and role management
- In-app purchases and subscriptions
- And many more...
### Error Handling
All API calls can throw errors that conform to the OpenAPI specification. Handle errors appropriately in your application code.
## License
Licensed under the Apache License, Version 2.0. See LICENSE file for details.