Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}