diff --git a/lib/services/apple-portal/apple-portal-application-service.ts b/lib/services/apple-portal/apple-portal-application-service.ts index 796c63f74b..c84bf7e67e 100644 --- a/lib/services/apple-portal/apple-portal-application-service.ts +++ b/lib/services/apple-portal/apple-portal-application-service.ts @@ -39,20 +39,50 @@ export class ApplePortalApplicationService const webSessionCookie = await this.$applePortalSessionService.createWebSession( contentProviderId ); + const summaries: IApplePortalApplicationSummary[] = []; + await this.getApplicationsByUrl( + webSessionCookie, + "https://appstoreconnect.apple.com/iris/v1/apps?include=appStoreVersions,prices", + summaries + ); + + return { summaries: summaries }; + } + + private async getApplicationsByUrl( + webSessionCookie: string, + url: string, + summaries: IApplePortalApplicationSummary[] + ): Promise { const response = await this.$httpClient.httpRequest({ - url: - "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary/v2", + url, method: "GET", - body: { - contentProviderId, - }, headers: { "Content-Type": "application/json", Cookie: webSessionCookie, }, }); + const result = JSON.parse(response.body); + const data = result.data; - return JSON.parse(response.body).data; + for (const app of data) { + let summary: IApplePortalApplicationSummary; + summary = { + bundleId: app.attributes.bundleId, + adamId: app.id, + name: app.attributes.name, + versionSets: [], + }; + summaries.push(summary); + } + + if (result.links.next) { + await this.getApplicationsByUrl( + webSessionCookie, + result.links.next, + summaries + ); + } } public async getApplicationByBundleId( diff --git a/lib/services/apple-portal/definitions.d.ts b/lib/services/apple-portal/definitions.d.ts index 110ff59025..d86a0e3de2 100644 --- a/lib/services/apple-portal/definitions.d.ts +++ b/lib/services/apple-portal/definitions.d.ts @@ -74,27 +74,13 @@ interface IApplePortalAssociatedAccountData { interface IApplePortalApplication { summaries: IApplePortalApplicationSummary[]; - showSharedSecret: boolean; - macBundlesEnabled: boolean; - canCreateMacApps: boolean; - cloudStorageEnabled: boolean; - sharedSecretLink: string; - gameCenterGroupLink: string; - enabledPlatforms: string[]; - cloudStorageLink: string; - catalogReportsLink: string; - canCreateIOSApps: boolean; } interface IApplePortalApplicationSummary { name: string; adamId: string; - vendorId: string; + bundleId: string; - appType: any; + versionSets: any[]; - lastModifiedDate: number; - iconUrl: string; - issuesCount: number; - priceTier: string; }