diff --git a/README.md b/README.md index 43b131746c..7366bcfe2d 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,13 @@ A Swift client library for the App Store Connect API, generated from the officia ## 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. +`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 +The library is automatically generated from the official App Store Connect API OpenAPI specification using Apple's [swift-openapi-generator](https://github.com/apple/swift-openapi-generator), ensuring complete API coverage and type safety. ## Installation -### Swift Package Manager - -Add ``ASConnectService`` as a dependency in your `Package.swift` file: +Add `ASConnectService` as a dependency in your `Package.swift` file: ```swift dependencies: [ @@ -39,23 +29,11 @@ Then add it to your target dependencies: ) ``` -## Basic Usage +## Usage -```swift -import ASConnectService -import OpenAPIURLSession +### Creating a Client -// 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 +Create a `Client` instance by providing a server URL and transport. Use `BearerAuthMiddleware` to authenticate requests with a JSON Web Token (JWT). The App Store Connect API requires authentication using API keys. You'll need to: @@ -70,11 +48,19 @@ import OpenAPIURLSession let client = Client( serverURL: try Servers.server1(), transport: URLSessionTransport(), - middlewares: [BearerAuthMiddleware(token: yourJWTToken)] + middlewares: [ + BearerAuthMiddleware(token: yourJWTToken) + ] ) ``` -The `BearerAuthMiddleware` automatically injects the `Authorization` header with the Bearer token into every outgoing request. +### Making API Calls + +The `Client` conforms to `APIProtocol`, which defines a method for every endpoint in the App Store Connect API. Each method accepts an `Input` value and returns an `Output` value with the response. + +```swift +let response = try await client.appsGetCollection(.init()) +``` ## Supported Platforms @@ -120,20 +106,8 @@ make doc-preview ## License -Licensed under the Apache License, Version 2.0. See LICENSE file for details. +Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details. ## Contributing -See CONTRIBUTORS file for the list of project authors. - -## API Coverage - -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... +See [CONTRIBUTORS](CONTRIBUTORS) for the list of project authors. diff --git a/Sources/ASConnectService/ASConnectService.swift b/Sources/ASConnectService/ASConnectService.swift deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Sources/ASConnectService/Catalogs/ASConnectService.docc/Library.md b/Sources/ASConnectService/Catalogs/ASConnectService.docc/Library.md index 8763b036bd..98c30375dc 100644 --- a/Sources/ASConnectService/Catalogs/ASConnectService.docc/Library.md +++ b/Sources/ASConnectService/Catalogs/ASConnectService.docc/Library.md @@ -6,60 +6,11 @@ A Swift client library for the App Store Connect API, generated from the officia ``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. +The library is automatically generated from the official App Store Connect API OpenAPI specification using Apple's [swift-openapi-generator](https://github.com/apple/swift-openapi-generator), ensuring complete API coverage and type safety. -## Key Features +### Creating a Client -- **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 +Create a ``Client`` instance by providing a server URL and transport. Use ``BearerAuthMiddleware`` to authenticate requests with a JSON Web Token (JWT). ```swift import ASConnectService @@ -68,53 +19,33 @@ import OpenAPIURLSession let client = Client( serverURL: try Servers.server1(), transport: URLSessionTransport(), - middlewares: [BearerAuthMiddleware(token: yourJWTToken)] + middlewares: [ + BearerAuthMiddleware(token: yourJWTToken) + ] ) ``` -The ``BearerAuthMiddleware`` automatically injects the `Authorization` header with the Bearer token into every outgoing request. +### Making API Calls -## Supported Platforms +The ``Client`` conforms to ``APIProtocol``, which defines a method for every endpoint in the App Store Connect API. Each method accepts an `Input` value and returns an `Output` value with the response. -- 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) +```swift +let response = try await client.appsGetCollection(.init()) +``` ## Topics -### Getting Started +### API Client -- ``Client``: The main API client for making requests +- ``Client`` +- ``APIProtocol`` ### Authentication -- ``BearerAuthMiddleware``: A client middleware that injects a Bearer token into outgoing HTTP requests +- ``BearerAuthMiddleware`` -### API Endpoints +### Generated Types -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. +- ``Components`` +- ``Operations`` +- ``Servers``