Skip to content

Commit

Permalink
fix(ios-publish): Update API calls to get applications (#5678)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcassidyav committed Jul 25, 2022
1 parent 1da28bc commit 4abe2c9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
42 changes: 36 additions & 6 deletions lib/services/apple-portal/apple-portal-application-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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(
Expand Down
18 changes: 2 additions & 16 deletions lib/services/apple-portal/definitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 4abe2c9

Please sign in to comment.