Swiftpack.co - Package - AvdLee/appstoreconnect-swift-sdk

App Store Connect Swift SDK

The Swift SDK to work with the App Store Connect API from Apple.

Bitrise Status Swift Version Dependency frameworks Twitter

Kickstart information on the API

Included in this SDK

  • ☑ Configuration with API Key
  • ☑ APIProvider with endpoints structure
  • ☑ Add models for all endpoints
  • ☑ JWT Logic to sign requests
  • ☑ Get started section in the readme
  • ☑ Support for Mac
  • ☑ TestFlight API implementation
  • ☑ Users and Roles implementation
  • ☑ Sales and Finances implementation
  • ☑ Replace Alamofire dependency with own simple URLSession implementation

Requesting API Access

To request access, go to the new API Keys section in Users and Access in App Store Connect. Please note that you must be the Team Agent (Legal role) of a development team enrolled as an organization. Access for developers enrolled as an individual is coming soon.

How to use the SDK?

Not all endpoints are available yet, we're working hard to implement them all (see Endpoints).

1. Import the framework:

import AppStoreConnect_Swift_SDK

2. Create your API Configuration

Go to https://appstoreconnect.apple.com/access/api and create your own key. This is also the page to find your private key ID and the issuer ID.

After downloading your private key, you can open the .p8 file containing the private key in a text editor which will show like the following content:

-----BEGIN PRIVATE KEY-----
FDFDGgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwQgPaXyFvZfNydDEjxgjUCUxyGjXcQxiulEdGxoVbasV3GgCgYIKomokDj0DAQehRANCAAASffd/DU3TUWAoLmqE6hZL9A7i0DWpXtmIDCDiITRznC6K4/WjdIcuMcixy+m6O0IrffxJOablIX2VM8sHRpoiuy
-----END PRIVATE KEY-----

Copy the contents and remove the whitelines, -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY-----.

Use this private key together with the issuer ID and the private key ID to create your configuration file:

let configuration = APIConfiguration(issuerID: "<YOUR ISSUER ID>", privateKeyID: "<YOUR PRIVATE KEY ID>", privateKey: "<YOUR PRIVATE KEY>")

3. Create an APIProvider and perform a request

After creating an APIProvider instance with your APIConfiguration you can start performing your first request.

let provider: APIProvider = APIProvider(configuration: configuration)

provider.request(.apps()) { (result) in
    switch result {
    case .success(let appsResponse):
        print("Did fetch \(appsResponse.data.count) apps")
    case .failure(let error):
        print("Something went wrong fetching the apps: \(error)")
    }
}

Installation

CocoaPods

AppStoreConnect-Swift-SDK will be available through CocoaPods when it's more complete. To install it now, simply add the following line to your Podfile:

pod 'AppStoreConnect-Swift-SDK', :git => 'https://github.com/AvdLee/appstoreconnect-swift-sdk.git'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but this SDK does support its use on supported platforms.

Once you have your Swift package set up, adding the SDK as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/AvdLee/appstoreconnect-swift-sdk.git", .upToNextMajor(from: "1.0.0"))
]

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

License

App Store Connect Swift SDK is available under the MIT license, and uses source code from open source projects. See the LICENSE file for more info.

Author

This project is originally created by Antoine van der Lee but has a lot of great contributors. We're open for contributions of any kind to make this project even better.

Github

link
Stars: 581

Dependencies

Used By

Total: 0

Releases

1.1.1 - 2020-05-01 07:44:34

1.1.0 - 2020-04-30 16:44:39

1.0.3 - 2020-04-15 12:57:12

  • Profile.Attributes createDate should be createdDate (#90) via @orj
  • APIEndpoint.listBundleIds doesn't have 'include' parameter. (#88) via @orj
  • Naming mismatch for include field in Response (#86) via @DechengMa
  • Merge release 1.0.2 into master (#85) via @SwiftLeeBot

1.0.2 - 2020-04-14 08:53:38

1.0.1 - 2020-03-20 07:13:15

  • Device.attributes.devicesClass is misnamed (#76) via @ruipfcosta
  • Wrong response type for getAllCertificates call (#72) via @ristkof
  • Merge release 1.0.0 into master (#74) via @SwiftLeeBot

1.0.0 - 2020-03-08 12:33:23

  • Trying to build a command line tool (#69) via @AvdLee
  • Make it a requirement to have SwiftLint setup locally (#58) via @AvdLee
  • Implement WeTransfer-iOS-CI (#71) via @AvdLee
  • Sometimes the bundle id has platform = "UNIVERSAL" (#70)
  • Adds response data for requests with a void result type. (#66)
  • Add support for Profiles and Devices endpoints (#65)
  • SPM issues about macOS version (#61)
  • Add support for Bundle IDs and Capabilities endpoints (#57)
  • typo fix for issue 42 (#62)
  • Remove custom Result type (#59)
  • Rename Certificates method name to align with API design (#55)
  • Fix indentation in docs (#56)
  • Fix CI and Danger reports (#54)
  • Add support for Certificates endpoints (#53)
  • Implemented Register a New Bundle ID endpoint (#51)
  • Make error messages more verbose when debugging (#52)
  • Updated Swift Package Manager installation instructions (#50)
  • Swift 5.1 support (#49)
  • Date decoding issue (#43)

Initial release - 2019-05-13 09:15:01

This is the initial release of the SDK, including the following features:

  • [x] Configuration with API Key
  • [x] APIProvider with endpoints structure
  • [x] Add models for all endpoints
  • [x] JWT Logic to sign requests
  • [x] Get started section in the readme
  • [x] Support for Mac
  • [x] TestFlight API implementation
  • [x] Users and Roles implementation
  • [x] Sales and Finances implementation
  • [x] Replace Alamofire dependency with own simple URLSession implementation