@gpc-cli/api 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,12 +32,12 @@ await client.edits.delete("com.example.app", edit.id);
32
32
 
33
33
  ## Client Factories
34
34
 
35
- | Factory | Purpose |
36
- | --- | --- |
37
- | `createApiClient(options)` | Core Play API -- apps, releases, listings, monetization, purchases |
38
- | `createReportingClient(options)` | Vitals, crash rates, ANR, error reporting |
39
- | `createUsersClient(options)` | Developer account users and permission grants |
40
- | `createHttpClient(options)` | Low-level HTTP with auth, retry, and rate limiting |
35
+ | Factory | Purpose |
36
+ | -------------------------------- | ------------------------------------------------------------------ |
37
+ | `createApiClient(options)` | Core Play API -- apps, releases, listings, monetization, purchases |
38
+ | `createReportingClient(options)` | Vitals, crash rates, ANR, error reporting |
39
+ | `createUsersClient(options)` | Developer account users and permission grants |
40
+ | `createHttpClient(options)` | Low-level HTTP with auth, retry, and rate limiting |
41
41
 
42
42
  All factories accept `ApiClientOptions`:
43
43
 
@@ -45,10 +45,10 @@ All factories accept `ApiClientOptions`:
45
45
  import type { ApiClientOptions } from "@gpc-cli/api";
46
46
 
47
47
  const options: ApiClientOptions = {
48
- auth, // Required: { getAccessToken(): Promise<string> }
49
- maxRetries: 3, // Default retry count
50
- timeout: 30_000, // Request timeout in ms
51
- rateLimiter: undefined, // Optional custom rate limiter
48
+ auth, // Required: { getAccessToken(): Promise<string> }
49
+ maxRetries: 3, // Default retry count
50
+ timeout: 30_000, // Request timeout in ms
51
+ rateLimiter: undefined, // Optional custom rate limiter
52
52
  onRetry: (entry) => console.warn(`Retry #${entry.attempt}: ${entry.error}`),
53
53
  };
54
54
  ```
@@ -118,12 +118,13 @@ await client.edits.commit("com.example.app", edit.id);
118
118
  const edit = await client.edits.insert("com.example.app");
119
119
 
120
120
  const screenshots = await client.images.list(
121
- "com.example.app", edit.id, "en-US", "phoneScreenshots",
121
+ "com.example.app",
122
+ edit.id,
123
+ "en-US",
124
+ "phoneScreenshots",
122
125
  );
123
126
 
124
- await client.images.upload(
125
- "com.example.app", edit.id, "en-US", "featureGraphic", "./feature.png",
126
- );
127
+ await client.images.upload("com.example.app", edit.id, "en-US", "featureGraphic", "./feature.png");
127
128
 
128
129
  await client.images.deleteAll("com.example.app", edit.id, "en-US", "phoneScreenshots");
129
130
  await client.edits.commit("com.example.app", edit.id);
@@ -145,15 +146,23 @@ await client.subscriptions.deactivateBasePlan("com.example.app", "premium_monthl
145
146
 
146
147
  ```typescript
147
148
  const { subscriptionOffers } = await client.subscriptions.listOffers(
148
- "com.example.app", "premium_monthly", "p1m",
149
+ "com.example.app",
150
+ "premium_monthly",
151
+ "p1m",
149
152
  );
150
153
 
151
154
  const offer = await client.subscriptions.getOffer(
152
- "com.example.app", "premium_monthly", "p1m", "intro_offer",
155
+ "com.example.app",
156
+ "premium_monthly",
157
+ "p1m",
158
+ "intro_offer",
153
159
  );
154
160
 
155
161
  await client.subscriptions.activateOffer(
156
- "com.example.app", "premium_monthly", "p1m", "intro_offer",
162
+ "com.example.app",
163
+ "premium_monthly",
164
+ "p1m",
165
+ "intro_offer",
157
166
  );
158
167
  ```
159
168
 
@@ -175,9 +184,7 @@ await client.inappproducts.create("com.example.app", {
175
184
 
176
185
  ```typescript
177
186
  // Verify a product purchase
178
- const purchase = await client.purchases.getProduct(
179
- "com.example.app", "coins_100", purchaseToken,
180
- );
187
+ const purchase = await client.purchases.getProduct("com.example.app", "coins_100", purchaseToken);
181
188
 
182
189
  // Acknowledge it
183
190
  await client.purchases.acknowledgeProduct("com.example.app", "coins_100", purchaseToken);
@@ -270,10 +277,9 @@ await client.edits.commit("com.example.app", edit.id);
270
277
  ### Monetization
271
278
 
272
279
  ```typescript
273
- const { convertedRegionPrices } = await client.monetization.convertRegionPrices(
274
- "com.example.app",
275
- { price: { currencyCode: "USD", units: "9", nanos: 990_000_000 } },
276
- );
280
+ const { convertedRegionPrices } = await client.monetization.convertRegionPrices("com.example.app", {
281
+ price: { currencyCode: "USD", units: "9", nanos: 990_000_000 },
282
+ });
277
283
  ```
278
284
 
279
285
  ### Deobfuscation
@@ -347,10 +353,10 @@ try {
347
353
  await client.tracks.get("com.example.app", editId, "production");
348
354
  } catch (error) {
349
355
  if (error instanceof ApiError) {
350
- console.error(error.code); // e.g. "API_NOT_FOUND"
351
- console.error(error.statusCode); // e.g. 404
352
- console.error(error.suggestion); // actionable fix
353
- console.error(error.toJSON()); // structured error object
356
+ console.error(error.code); // e.g. "API_NOT_FOUND"
357
+ console.error(error.statusCode); // e.g. 404
358
+ console.error(error.suggestion); // actionable fix
359
+ console.error(error.toJSON()); // structured error object
354
360
  }
355
361
  }
356
362
  ```
package/dist/index.d.ts CHANGED
@@ -183,7 +183,7 @@ interface ReviewsListOptions {
183
183
  translationLanguage?: string;
184
184
  }
185
185
  type VitalsMetricSet = "crashRateMetricSet" | "anrRateMetricSet" | "excessiveWakeupRateMetricSet" | "stuckBackgroundWakelockRateMetricSet" | "slowStartRateMetricSet" | "slowRenderingRateMetricSet" | "errorCountMetricSet";
186
- type ReportingDimension = "apiLevel" | "versionCode" | "deviceModel" | "deviceType" | "countryCode" | "deviceRamBucket" | "deviceSocName" | "deviceCpuMakeModel" | "deviceGlEsVersion" | "deviceVulkanVersion" | "deviceOpenGlVersion" | "deviceBrand";
186
+ type ReportingDimension = "apiLevel" | "versionCode" | "deviceModel" | "deviceType" | "countryCode" | "deviceRamBucket" | "deviceSocName" | "deviceCpuMakeModel" | "deviceGlEsVersion" | "deviceVulkanVersion" | "deviceOpenGlVersion" | "deviceBrand" | "startType";
187
187
  type ReportingAggregation = "DAILY" | "HOURLY";
188
188
  interface MetricSetQuery {
189
189
  metrics: string[];
@@ -752,6 +752,28 @@ interface InAppProductsBatchGetRequest {
752
752
  packageName: string;
753
753
  sku: string[];
754
754
  }
755
+ interface UploadProgressEvent {
756
+ /** Bytes uploaded so far */
757
+ bytesUploaded: number;
758
+ /** Total file size in bytes */
759
+ totalBytes: number;
760
+ /** Percentage 0-100 */
761
+ percent: number;
762
+ /** Bytes per second throughput */
763
+ bytesPerSecond: number;
764
+ /** Estimated seconds remaining */
765
+ etaSeconds: number;
766
+ }
767
+ interface ResumableUploadOptions {
768
+ /** Chunk size in bytes. Must be a multiple of 256 KB. Default: 8 MB */
769
+ chunkSize?: number;
770
+ /** Progress callback fired after each chunk */
771
+ onProgress?: (event: UploadProgressEvent) => void;
772
+ /** Existing session URI to resume a previous upload */
773
+ resumeSessionUri?: string;
774
+ /** Maximum resume attempts per chunk before giving up. Default: 5 */
775
+ maxResumeAttempts?: number;
776
+ }
755
777
 
756
778
  interface PlayApiClient {
757
779
  edits: {
@@ -768,7 +790,7 @@ interface PlayApiClient {
768
790
  };
769
791
  bundles: {
770
792
  list(packageName: string, editId: string): Promise<Bundle[]>;
771
- upload(packageName: string, editId: string, filePath: string): Promise<Bundle>;
793
+ upload(packageName: string, editId: string, filePath: string, uploadOptions?: ResumableUploadOptions): Promise<Bundle>;
772
794
  };
773
795
  tracks: {
774
796
  list(packageName: string, editId: string): Promise<Track[]>;
@@ -1044,6 +1066,7 @@ interface HttpClient {
1044
1066
  patch<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
1045
1067
  delete<T>(path: string): Promise<ApiResponse<T>>;
1046
1068
  upload<T>(path: string, filePath: string, contentType: string): Promise<ApiResponse<T>>;
1069
+ uploadResumable<T>(path: string, filePath: string, contentType: string, options?: ResumableUploadOptions): Promise<ApiResponse<T>>;
1047
1070
  uploadInternal<T>(path: string, filePath: string, contentType: string): Promise<ApiResponse<T>>;
1048
1071
  download(path: string): Promise<ArrayBuffer>;
1049
1072
  }
@@ -1081,7 +1104,7 @@ declare function paginateParallel<TItem>(fetchPage: (pageToken?: string) => Prom
1081
1104
  nextPageToken?: string;
1082
1105
  }>;
1083
1106
 
1084
- declare class ApiError extends Error {
1107
+ declare class PlayApiError extends Error {
1085
1108
  readonly code: string;
1086
1109
  readonly statusCode?: number | undefined;
1087
1110
  readonly suggestion?: string | undefined;
@@ -1097,4 +1120,7 @@ declare class ApiError extends Error {
1097
1120
  };
1098
1121
  }
1099
1122
 
1100
- export { type Achievement, type Anomaly, type AnomalyDetectionResponse, type ApiClientOptions, ApiError, type ApiResponse, type ApkInfo, type AppDetails, type AppEdit, type AppRecoveriesListResponse, type AppRecoveryAction, type AppRecoveryTargeting, type BasePlan, type BasePlanMigratePricesRequest, type Bundle, type BundleListResponse, type ConvertRegionPricesRequest, type ConvertRegionPricesResponse, type ConvertedRegionPrice, type CountryAvailability, type CreateAppRecoveryActionRequest, type CustomApp, type CustomAppsListResponse, type DataSafety, type DataSafetyDataType, type DataSafetyPurpose, type DeobfuscationFile, type DeobfuscationUploadResponse, type DeveloperComment, type DeveloperPermission, type DeviceGroup, type DeviceSelector, type DeviceTier, type DeviceTierConfig, type DeviceTierConfigsListResponse, type EnterpriseApiClient, type ErrorIssue, type ErrorIssuesResponse, type ErrorReport, type ErrorReportsResponse, type ExternalTransaction, type ExternalTransactionAmount, type ExternalTransactionRefund, type ExternallyHostedApk, type ExternallyHostedApkResponse, type GameEvent, type GamesApiClient, type GeneratedApk, type GeneratedApksPerVersion, type Grant, type GrantsListResponse, type HttpClient, type Image, type ImageType, type ImageUploadResponse, type ImagesDeleteAllResponse, type ImagesListResponse, type InAppProduct, type InAppProductListing, type InAppProductsBatchGetRequest, type InAppProductsBatchUpdateRequest, type InAppProductsBatchUpdateResponse, type InAppProductsListResponse, type InternalAppSharingArtifact, type Leaderboard, type LeaderboardScore, type Listing, type ListingsListResponse, type MetricRow, type MetricSetQuery, type MetricSetResponse, type Money, type OffersListResponse, type OneTimeOffer, type OneTimeOfferRegionalConfig, type OneTimeOffersListResponse, type OneTimeProduct, type OneTimeProductListing, type OneTimeProductsListResponse, type PagedResponse, type PaginateOptions, type PlayApiClient, type ProductPurchase, type PurchaseOption, type PurchaseOptionsListResponse, RATE_LIMIT_BUCKETS, type RateLimitBucket, type RateLimiter, type RegionalBasePlanConfig, type Release, type ReleaseNote, type ReleaseStatus, type ReportBucket, type ReportType, type ReportingAggregation, type ReportingApiClient, type ReportingDimension, type ReportsListResponse, type RetryLogEntry, type Review, type ReviewComment, type ReviewReplyRequest, type ReviewReplyResponse, type ReviewsListOptions, type ReviewsListResponse, type StatsDimension, type Subscription, type SubscriptionDeferRequest, type SubscriptionDeferResponse, type SubscriptionListing, type SubscriptionOffer, type SubscriptionOfferPhase, type SubscriptionPurchase, type SubscriptionPurchaseLineItem, type SubscriptionPurchaseV2, type SubscriptionsListResponse, type TaxAndComplianceSettings, type Testers, type TokenPagination, type Track, type TrackListResponse, type UploadResponse, type User, type UserComment, type UsersApiClient, type UsersListResponse, type VitalsMetricSet, type VoidedPurchase, type VoidedPurchasesListResponse, createApiClient, createEnterpriseClient, createGamesClient, createHttpClient, createRateLimiter, createReportingClient, createUsersClient, paginate, paginateAll, paginateParallel };
1123
+ /** Files below this threshold use simple upload instead. */
1124
+ declare const RESUMABLE_THRESHOLD: number;
1125
+
1126
+ export { type Achievement, type Anomaly, type AnomalyDetectionResponse, type ApiClientOptions, type ApiResponse, type ApkInfo, type AppDetails, type AppEdit, type AppRecoveriesListResponse, type AppRecoveryAction, type AppRecoveryTargeting, type BasePlan, type BasePlanMigratePricesRequest, type Bundle, type BundleListResponse, type ConvertRegionPricesRequest, type ConvertRegionPricesResponse, type ConvertedRegionPrice, type CountryAvailability, type CreateAppRecoveryActionRequest, type CustomApp, type CustomAppsListResponse, type DataSafety, type DataSafetyDataType, type DataSafetyPurpose, type DeobfuscationFile, type DeobfuscationUploadResponse, type DeveloperComment, type DeveloperPermission, type DeviceGroup, type DeviceSelector, type DeviceTier, type DeviceTierConfig, type DeviceTierConfigsListResponse, type EnterpriseApiClient, type ErrorIssue, type ErrorIssuesResponse, type ErrorReport, type ErrorReportsResponse, type ExternalTransaction, type ExternalTransactionAmount, type ExternalTransactionRefund, type ExternallyHostedApk, type ExternallyHostedApkResponse, type GameEvent, type GamesApiClient, type GeneratedApk, type GeneratedApksPerVersion, type Grant, type GrantsListResponse, type HttpClient, type Image, type ImageType, type ImageUploadResponse, type ImagesDeleteAllResponse, type ImagesListResponse, type InAppProduct, type InAppProductListing, type InAppProductsBatchGetRequest, type InAppProductsBatchUpdateRequest, type InAppProductsBatchUpdateResponse, type InAppProductsListResponse, type InternalAppSharingArtifact, type Leaderboard, type LeaderboardScore, type Listing, type ListingsListResponse, type MetricRow, type MetricSetQuery, type MetricSetResponse, type Money, type OffersListResponse, type OneTimeOffer, type OneTimeOfferRegionalConfig, type OneTimeOffersListResponse, type OneTimeProduct, type OneTimeProductListing, type OneTimeProductsListResponse, type PagedResponse, type PaginateOptions, type PlayApiClient, PlayApiError, type ProductPurchase, type PurchaseOption, type PurchaseOptionsListResponse, RATE_LIMIT_BUCKETS, RESUMABLE_THRESHOLD, type RateLimitBucket, type RateLimiter, type RegionalBasePlanConfig, type Release, type ReleaseNote, type ReleaseStatus, type ReportBucket, type ReportType, type ReportingAggregation, type ReportingApiClient, type ReportingDimension, type ReportsListResponse, type ResumableUploadOptions, type RetryLogEntry, type Review, type ReviewComment, type ReviewReplyRequest, type ReviewReplyResponse, type ReviewsListOptions, type ReviewsListResponse, type StatsDimension, type Subscription, type SubscriptionDeferRequest, type SubscriptionDeferResponse, type SubscriptionListing, type SubscriptionOffer, type SubscriptionOfferPhase, type SubscriptionPurchase, type SubscriptionPurchaseLineItem, type SubscriptionPurchaseV2, type SubscriptionsListResponse, type TaxAndComplianceSettings, type Testers, type TokenPagination, type Track, type TrackListResponse, type UploadProgressEvent, type UploadResponse, type User, type UserComment, type UsersApiClient, type UsersListResponse, type VitalsMetricSet, type VoidedPurchase, type VoidedPurchasesListResponse, createApiClient, createEnterpriseClient, createGamesClient, createHttpClient, createRateLimiter, createReportingClient, createUsersClient, paginate, paginateAll, paginateParallel };