@7nohe/app-store-connect-api-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@7nohe/app-store-connect-api-client

App Store Connect API client for Node.js

Install

$ npm install -D @7nohe/app-store-connect-api-client

Usage

import { createClient, SalesReportFrequency } from '@7nohe/app-store-connect-api-client'
import path from 'path';

const privateKeyPath = path.resolve(__dirname, '/path/to/your/p8/file');

const client = createClient({
  apiKey: '<YOUR-API-KEY>',
  issuerId: '<YOUR-ISSUER-ID>',
  privateKey: {
    path: privateKeyPath
  }
})

const run = async () => {
  const result = await client.getSalesReports({
    vendorNumber: process.env.VENDOR_ID!,
    date: '2022-08-07',
    frequency: SalesReportFrequency.Weekly
  })
  console.log(result);
}

run();

For CI, a base64-encoded private key file can be set as an environment variable and passed as an option.

import { createClient } from '@7nohe/app-store-connect-api-client'
import * as dotenv from 'dotenv';
dotenv.config();

const client = createClient({
  apiKey: process.env.API_KEY!,
  issuerId: process.env.ISSUER_ID!,
  privateKey: Buffer.from(process.env.PRIVATE_KEY!, 'base64'),
})

Package Sidebar

Install

npm i @7nohe/app-store-connect-api-client

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

12 kB

Total Files

6

Last publish

Collaborators

  • 7nohe