Code Monkey home page Code Monkey logo

appstore-connect-sdk's Introduction

你好,世界 👋

  • 🔭 Fullstack product designer
  • 🌱 Learning more...
  • ⚡️ Create something new...

appstore-connect-sdk's People

Contributors

chessbyte avatar dependabot[bot] avatar isaced avatar jozsefsallai avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

appstore-connect-sdk's Issues

App Analytics

Tried to get App Analytics working, but did not get all the way through with the following:

// Retrieve app analytics data for the TestFlight app
const getAppAnalyticsData = async (api: any) => {
  try {
    // Define the time period for the app analytics data you want to retrieve
    const startTime = Math.floor(Date.now() / 1000) - (24 * 60 * 60);
    const endTime = Math.floor(Date.now() / 1000);

    // Define the query parameters for the App Store Connect API request
    const queryParams: QueryParams = {
      'filter[timeRange][start]': startTime,
      'filter[timeRange][end]': endTime,
      'filter[version]': bundleId,
      'group[granularity]': 'DAY',
      'measure': 'installs,uninstalls'
    };

    const url = `/v1/analytics/applications/${appId}/data`;
    const method = 'GET';
    const data = await api.request(url, method, queryParams)
    return data;
  } catch (error) {
    console.error(error);
  }
};

Others are trying as well

Builds of an App

I found my app with the following code:

  const client = new AppStoreConnectAPI({
      issuerId: issuerId,
      privateKeyId: keyId,
      privateKey: privateKey,
  });

  const apps = await client.call(AppsApi).appsGetCollection();
  const app = apps.data.find((app) => app.id === appId);

How can I get the builds associated with the app or, more generally, how can I follow any of the relationships in the app object?

Added expiration time returns a 401

  const client = new AppStoreConnectAPI({
    issuerId: process.env.SPACESHIP_CONNECT_API_ISSUER_ID,
    privateKeyId: process.env.SPACESHIP_CONNECT_API_KEY_ID,
    privateKey: process.env.SPACESHIP_CONNECT_API_KEY,
    expirationTime: 600
  });

the above returns the following error

response: _Response [Response] {
    [Symbol(realm)]: null,
    [Symbol(state)]: {
      aborted: false,
      rangeRequested: false,
      timingAllowPassed: true,
      requestIncludesCredentials: true,
      type: 'default',
      status: 401,
      timingInfo: [Object],
      cacheState: '',
      statusText: 'Unauthorized',
      headersList: [_HeadersList],
      urlList: [Array],
      body: [Object]
    },
    [Symbol(headers)]: _HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    }

Unable to make requests due to token not being properly injected

I'm just getting started with the SDK and running into an issue getting my first request to succeed.

Here's my code:

export const getReleaseVersions = async (req, res) => {
    const { appStoreConnect } = config;
    const { privateKey, issuerId, keyId } = appStoreConnect;
    const client = new AppStoreConnectAPI({
        issuerId: issuerId,
        privateKeyId: keyId,
        privateKey: privateKey,
    });
    const api = await client.create(AppsApi);
    const result = await api.appsAppStoreVersionsGetToManyRelated({ id: 'xxxxxxxxx', limit: 10});
    const version = result.data[0].attributes.versionString;
    res.send({ version });
};

It fails when trying to make the appsAppStoreVersionsGetToManyRelated and throws an error: error: FetchError: The request failed and the interceptors did not return an alternative response

Digging into the code, it seems that the auth token isn't properly set in the http request headers here. this.configuration does not have an access token property. Instead it looks like this:

this.configuration:  Configuration {
  configuration: {
    headers: {
      Authorization: 'Bearer eyJhbGciOiJFUzI1NiIsImtpZCI6IkhITjkyRDNOTTYiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiI2OWE2ZGU4My1jNGVlLTQ3ZTMtZTA1My01YjhjN2MxMWE0ZDEiLCJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJleHAiOjE3MTQyNDM1NjMuMTZ9.jSmHuFrvBEefMKAcrSCF6xZWL2nvTOjRTgGUEj38EsE-kVfXBpbK0aN0y9-l7y23ifl2I-IsYr-jCnQRPhxpow'
    },
    fetchApi: undefined,
    basePath: undefined
  }
}

Did I do something incorrectly when I configured the API in the code?

Issues with redeclared block-scoped variables

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2023:22 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetCollectionFieldsInAppPurchasesEnum'.

2023 export declare const AppsGetCollectionFieldsInAppPurchasesEnum: {
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2030:13 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetCollectionFieldsInAppPurchasesEnum'.

2030 export type AppsGetCollectionFieldsInAppPurchasesEnum = typeof AppsGetCollectionFieldsInAppPurchasesEnum[keyof typeof AppsGetCollectionFieldsInAppPurchasesEnum];
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2044:22 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetCollectionFieldsInAppPurchasesEnum'.

2044 export declare const AppsGetCollectionFieldsInAppPurchasesEnum: {
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2061:13 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetCollectionFieldsInAppPurchasesEnum'.

2061 export type AppsGetCollectionFieldsInAppPurchasesEnum = typeof AppsGetCollectionFieldsInAppPurchasesEnum[keyof typeof AppsGetCollectionFieldsInAppPurchasesEnum];
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2449:22 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetInstanceFieldsInAppPurchasesEnum'.

2449 export declare const AppsGetInstanceFieldsInAppPurchasesEnum: {
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2456:13 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetInstanceFieldsInAppPurchasesEnum'.

2456 export type AppsGetInstanceFieldsInAppPurchasesEnum = typeof AppsGetInstanceFieldsInAppPurchasesEnum[keyof typeof AppsGetInstanceFieldsInAppPurchasesEnum];
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2470:22 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetInstanceFieldsInAppPurchasesEnum'.

2470 export declare const AppsGetInstanceFieldsInAppPurchasesEnum: {
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2487:13 - error TS2451: Cannot redeclare block-scoped variable 'AppsGetInstanceFieldsInAppPurchasesEnum'.

2487 export type AppsGetInstanceFieldsInAppPurchasesEnum = typeof AppsGetInstanceFieldsInAppPurchasesEnum[keyof typeof AppsGetInstanceFieldsInAppPurchasesEnum];
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/CiProductsApi.d.ts:300:22 - error TS2451: Cannot redeclare block-scoped variable 'CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum'.

300 export declare const CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum: {
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/CiProductsApi.d.ts:307:13 - error TS2451: Cannot redeclare block-scoped variable 'CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum'.

307 export type CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum = typeof CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum[keyof typeof CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum];
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/CiProductsApi.d.ts:326:22 - error TS2451: Cannot redeclare block-scoped variable 'CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum'.

326 export declare const CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum: {
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/appstore-connect-sdk/dist/openapi/apis/CiProductsApi.d.ts:343:13 - error TS2451: Cannot redeclare block-scoped variable 'CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum'.

343 export type CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum = typeof CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum[keyof typeof CiProductsAppGetToOneRelatedFieldsInAppPurchasesEnum];
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 12 errors in 2 files.

Errors  Files
     8  node_modules/appstore-connect-sdk/dist/openapi/apis/AppsApi.d.ts:2023
     4  node_modules/appstore-connect-sdk/dist/openapi/apis/CiProductsApi.d.ts:300

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.