npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@okwenxi/appstoreconnect-api

v0.2.4

Published

An App Store Connect API client for Node.js

Downloads

37

Readme

appstoreconnect

Unofficial REST API client for Apple's App Store Connect API

@latest Build Status install size

Installation

appstoreconnect has been tested to work on Node.js 8.0+. Use with any prior version is unsupported.

npm install appstoreconnect

Usage

// Import the API version from the package, which mirror Apple's API versioning
import { v1 } from 'appstoreconnect'

// Read .p8 private key from disk or from environment, and supply the issuer ID and key identifier as outlined here:
// https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests
const privateKey = '' // replace with the contents of your private key
const issuerId = '' // replace with your issuer ID
const keyId = '' // replace with your key ID

const token = v1.token(privateKey, issuerId, keyId)

// Initialize the service. Passing the token up-front is optional, but should be done before any API calls are made.
const api = v1(token)

// Compare to https://developer.apple.com/documentation/appstoreconnectapi/list_builds
v1
  .testflight
  .listBuilds(api, {})
  .then(builds => console.log(builds))
  .catch(err => console.error(err))

All asynchronous functionality in appstoreconnect is driven using native Promises.

Authentication

The App Store Connect API requires a JSON Web Token (JWT) for all API requests. appstoreconnect presents both synchronous and asynchronous interfaces for processing the token. You should feel free to use the one that fits best into your project. Both interfaces can surface errors, so use a try-catch where appropriate.

const token = v1.token(privateKey, issuerId, keyId)
async function myFunc() {
  try {
    const token = await v1.token(privateKey, issuerId, keyId)
  } catch (error) {
    throw error
  }
}

For more information on how JWT works with the App Store Connect API, check out Apple's authentication guides:

Examples

This is an ongoing work-in-progress so I don't have many examples yet. If you have an idea for an example, please feel free to file an issue or a pull request!

  1. Getting Started

API Reference

A proper API reference for appstoreconnect is coming soon, but in the meantime, much of the documentation is lifted from Apple's reference notes on the App Store Connect API here.

License

This code is licensed under the MIT License.


TODO

  • [ ] Fully stub App Store Connect API
    • [x] Confirm basic functionality
    • [ ] Confirm complex edge cases (complex queries, mutating calls, non-JSON responses, etc.)
    • [ ] Determine work involved in stubbing a v2 API and compatibility between different components
  • [ ] Testing
    • [ ] Write end-to-end tests to confirm interface and design
    • [ ] Write unit tests for individual, internal components
    • [ ] Run tests on CI
  • [ ] Improve documentation
    • [ ] Add more examples
    • [ ] Improve code comments around API surface
    • [ ] Update README
    • [ ] Produce API reference site when new tags are pushed