@@ -39,20 +39,50 @@ export class ApplePortalApplicationService
39
39
const webSessionCookie = await this . $applePortalSessionService . createWebSession (
40
40
contentProviderId
41
41
) ;
42
+ const summaries : IApplePortalApplicationSummary [ ] = [ ] ;
43
+ await this . getApplicationsByUrl (
44
+ webSessionCookie ,
45
+ "https://appstoreconnect.apple.com/iris/v1/apps?include=appStoreVersions,prices" ,
46
+ summaries
47
+ ) ;
48
+
49
+ return { summaries : summaries } ;
50
+ }
51
+
52
+ private async getApplicationsByUrl (
53
+ webSessionCookie : string ,
54
+ url : string ,
55
+ summaries : IApplePortalApplicationSummary [ ]
56
+ ) : Promise < void > {
42
57
const response = await this . $httpClient . httpRequest ( {
43
- url :
44
- "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/manageyourapps/summary/v2" ,
58
+ url,
45
59
method : "GET" ,
46
- body : {
47
- contentProviderId,
48
- } ,
49
60
headers : {
50
61
"Content-Type" : "application/json" ,
51
62
Cookie : webSessionCookie ,
52
63
} ,
53
64
} ) ;
65
+ const result = JSON . parse ( response . body ) ;
66
+ const data = result . data ;
54
67
55
- return JSON . parse ( response . body ) . data ;
68
+ for ( const app of data ) {
69
+ let summary : IApplePortalApplicationSummary ;
70
+ summary = {
71
+ bundleId : app . attributes . bundleId ,
72
+ adamId : app . id ,
73
+ name : app . attributes . name ,
74
+ versionSets : [ ] ,
75
+ } ;
76
+ summaries . push ( summary ) ;
77
+ }
78
+
79
+ if ( result . links . next ) {
80
+ await this . getApplicationsByUrl (
81
+ webSessionCookie ,
82
+ result . links . next ,
83
+ summaries
84
+ ) ;
85
+ }
56
86
}
57
87
58
88
public async getApplicationByBundleId (
0 commit comments