From 5ceb254f317d0cb186bfc31b89e2d2b28625094c Mon Sep 17 00:00:00 2001 From: Jason Cassidy <47318351+jcassidyav@users.noreply.github.com> Date: Wed, 23 Mar 2022 15:48:57 +0000 Subject: [PATCH] fix(ios-publish): changes in Apple API to set Team (#5653) --- .../apple-portal-application-service.ts | 4 ++-- .../apple-portal-session-service.ts | 18 +++++------------- lib/services/apple-portal/definitions.d.ts | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/services/apple-portal/apple-portal-application-service.ts b/lib/services/apple-portal/apple-portal-application-service.ts index 1893b79e1e..796c63f74b 100644 --- a/lib/services/apple-portal/apple-portal-application-service.ts +++ b/lib/services/apple-portal/apple-portal-application-service.ts @@ -23,7 +23,7 @@ export class ApplePortalApplicationService let result: IApplePortalApplicationSummary[] = []; for (const account of user.associatedAccounts) { - const contentProviderId = account.contentProvider.contentProviderPublicId; + const contentProviderId = account.contentProvider.contentProviderId; const applications = await this.getApplicationsByProvider( contentProviderId ); @@ -34,7 +34,7 @@ export class ApplePortalApplicationService } public async getApplicationsByProvider( - contentProviderId: string + contentProviderId: number ): Promise { const webSessionCookie = await this.$applePortalSessionService.createWebSession( contentProviderId diff --git a/lib/services/apple-portal/apple-portal-session-service.ts b/lib/services/apple-portal/apple-portal-session-service.ts index 7fad35e8ed..b376741049 100644 --- a/lib/services/apple-portal/apple-portal-session-service.ts +++ b/lib/services/apple-portal/apple-portal-session-service.ts @@ -79,22 +79,13 @@ export class ApplePortalSessionService implements IApplePortalSessionService { return result; } - public async createWebSession(contentProviderId: string): Promise { + public async createWebSession(contentProviderId: number): Promise { const webSessionResponse = await this.$httpClient.httpRequest({ - url: - "https://appstoreconnect.apple.com/olympus/v1/providerSwitchRequests", + url: "https://appstoreconnect.apple.com/olympus/v1/session", method: "POST", body: { - data: { - type: "providerSwitchRequests", - relationships: { - provider: { - data: { - type: "providers", - id: contentProviderId, - }, - }, - }, + provider: { + providerId: contentProviderId, }, }, headers: { @@ -102,6 +93,7 @@ export class ApplePortalSessionService implements IApplePortalSessionService { "Accept-Encoding": "gzip, deflate, br", "X-Csrf-Itc": "itc", "Content-Type": "application/json;charset=UTF-8", + "X-Requested-With": "olympus-ui", Cookie: this.$applePortalCookieService.getUserSessionCookie(), }, }); diff --git a/lib/services/apple-portal/definitions.d.ts b/lib/services/apple-portal/definitions.d.ts index f8ee4a5558..110ff59025 100644 --- a/lib/services/apple-portal/definitions.d.ts +++ b/lib/services/apple-portal/definitions.d.ts @@ -1,7 +1,7 @@ import { ICredentials } from "../../common/declarations"; interface IApplePortalSessionService { - createWebSession(contentProviderId: string): Promise; + createWebSession(contentProviderId: number): Promise; createUserSession( credentials: ICredentials, opts?: IAppleCreateUserSessionOptions @@ -19,7 +19,7 @@ interface IApplePortalApplicationService { user: IApplePortalUserDetail ): Promise; getApplicationsByProvider( - contentProviderId: string + contentProviderId: number ): Promise; getApplicationByBundleId( user: IApplePortalUserDetail,