@gpc-cli/api 1.0.28 → 1.0.30
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/LICENSE +21 -0
- package/README.md +60 -42
- package/dist/index.d.ts +168 -41
- package/dist/index.js +146 -65
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -91,7 +91,11 @@ async function resumableUpload(uploadUrl, filePath, contentType, ctx, options) {
|
|
|
91
91
|
try {
|
|
92
92
|
const serverOffset = await queryProgress(sessionUri, totalBytes, ctx);
|
|
93
93
|
if (serverOffset >= totalBytes) {
|
|
94
|
-
const completionResult = await fetchCompletionResponse(
|
|
94
|
+
const completionResult = await fetchCompletionResponse(
|
|
95
|
+
sessionUri,
|
|
96
|
+
totalBytes,
|
|
97
|
+
ctx
|
|
98
|
+
);
|
|
95
99
|
if (completionResult) {
|
|
96
100
|
result = completionResult;
|
|
97
101
|
break;
|
|
@@ -411,7 +415,7 @@ function resolveOption(explicit, envName, fallback) {
|
|
|
411
415
|
return explicit ?? envInt2(envName) ?? fallback;
|
|
412
416
|
}
|
|
413
417
|
function enhanceApiError(status, body) {
|
|
414
|
-
let errorMsg
|
|
418
|
+
let errorMsg;
|
|
415
419
|
try {
|
|
416
420
|
const parsed = JSON.parse(body);
|
|
417
421
|
errorMsg = parsed?.error?.message?.toLowerCase() ?? "";
|
|
@@ -974,15 +978,22 @@ var RATE_LIMIT_BUCKETS = {
|
|
|
974
978
|
purchases: { name: "purchases", maxTokens: 3e3, refillRate: 3e3, refillIntervalMs: 6e4 },
|
|
975
979
|
reviews: { name: "reviews", maxTokens: 3e3, refillRate: 3e3, refillIntervalMs: 6e4 },
|
|
976
980
|
reporting: { name: "reporting", maxTokens: 3e3, refillRate: 3e3, refillIntervalMs: 6e4 },
|
|
977
|
-
monetization: {
|
|
981
|
+
monetization: {
|
|
982
|
+
name: "monetization",
|
|
983
|
+
maxTokens: 3e3,
|
|
984
|
+
refillRate: 3e3,
|
|
985
|
+
refillIntervalMs: 6e4
|
|
986
|
+
},
|
|
978
987
|
default: { name: "default", maxTokens: 3e3, refillRate: 3e3, refillIntervalMs: 6e4 }
|
|
979
988
|
};
|
|
980
989
|
function resolveBucket(path) {
|
|
981
990
|
if (path.includes("/edits/") || path.includes("/edits:")) return "edits";
|
|
982
991
|
if (path.includes("/purchases/") || path.includes("/orders")) return "purchases";
|
|
983
992
|
if (path.includes("/reviews")) return "reviews";
|
|
984
|
-
if (path.includes("playdeveloperreporting") || path.includes("MetricSet") || path.includes("anomalies"))
|
|
985
|
-
|
|
993
|
+
if (path.includes("playdeveloperreporting") || path.includes("MetricSet") || path.includes("anomalies"))
|
|
994
|
+
return "reporting";
|
|
995
|
+
if (path.includes("/inappproducts") || path.includes("/oneTimeProducts") || path.includes("/subscriptions") || path.includes("/monetization"))
|
|
996
|
+
return "monetization";
|
|
986
997
|
return "default";
|
|
987
998
|
}
|
|
988
999
|
function createRateLimiter(buckets) {
|
|
@@ -1085,7 +1096,8 @@ function createApiClient(options) {
|
|
|
1085
1096
|
if (options2?.changesNotSentForReview || options2?.changesInReviewBehavior) {
|
|
1086
1097
|
const params = new URLSearchParams();
|
|
1087
1098
|
if (options2.changesNotSentForReview) params.set("changesNotSentForReview", "true");
|
|
1088
|
-
if (options2.changesInReviewBehavior)
|
|
1099
|
+
if (options2.changesInReviewBehavior)
|
|
1100
|
+
params.set("changesInReviewBehavior", options2.changesInReviewBehavior);
|
|
1089
1101
|
path += `?${params.toString()}`;
|
|
1090
1102
|
}
|
|
1091
1103
|
const { data } = await http.post(path);
|
|
@@ -1169,10 +1181,13 @@ function createApiClient(options) {
|
|
|
1169
1181
|
return data;
|
|
1170
1182
|
},
|
|
1171
1183
|
async patch(packageName, editId, track, release) {
|
|
1172
|
-
const { data } = await http.patch(
|
|
1173
|
-
track
|
|
1174
|
-
|
|
1175
|
-
|
|
1184
|
+
const { data } = await http.patch(
|
|
1185
|
+
`/${packageName}/edits/${editId}/tracks/${track}`,
|
|
1186
|
+
{
|
|
1187
|
+
track,
|
|
1188
|
+
releases: [release]
|
|
1189
|
+
}
|
|
1190
|
+
);
|
|
1176
1191
|
return data;
|
|
1177
1192
|
}
|
|
1178
1193
|
},
|
|
@@ -1186,9 +1201,7 @@ function createApiClient(options) {
|
|
|
1186
1201
|
},
|
|
1187
1202
|
apks: {
|
|
1188
1203
|
async list(packageName, editId) {
|
|
1189
|
-
const { data } = await http.get(
|
|
1190
|
-
`/${packageName}/edits/${editId}/apks`
|
|
1191
|
-
);
|
|
1204
|
+
const { data } = await http.get(`/${packageName}/edits/${editId}/apks`);
|
|
1192
1205
|
return data.apks || [];
|
|
1193
1206
|
},
|
|
1194
1207
|
async upload(packageName, editId, filePath, uploadOptions) {
|
|
@@ -1447,6 +1460,13 @@ function createApiClient(options) {
|
|
|
1447
1460
|
);
|
|
1448
1461
|
return data;
|
|
1449
1462
|
},
|
|
1463
|
+
async batchMigratePrices(packageName, productId, body) {
|
|
1464
|
+
const { data } = await http.post(
|
|
1465
|
+
`/${packageName}/subscriptions/${productId}/basePlans:batchMigratePrices`,
|
|
1466
|
+
body
|
|
1467
|
+
);
|
|
1468
|
+
return data;
|
|
1469
|
+
},
|
|
1450
1470
|
async listOffers(packageName, productId, basePlanId) {
|
|
1451
1471
|
const { data } = await http.get(
|
|
1452
1472
|
`/${packageName}/subscriptions/${productId}/basePlans/${basePlanId}/offers`
|
|
@@ -1554,6 +1574,15 @@ function createApiClient(options) {
|
|
|
1554
1574
|
const { data } = await http.put(path, body);
|
|
1555
1575
|
return data;
|
|
1556
1576
|
},
|
|
1577
|
+
async patch(packageName, sku, body, options2) {
|
|
1578
|
+
const params = {};
|
|
1579
|
+
if (options2?.autoConvertMissingPrices) params["autoConvertMissingPrices"] = "true";
|
|
1580
|
+
if (options2?.latencyTolerance) params["latencyTolerance"] = options2.latencyTolerance;
|
|
1581
|
+
const hasParams = Object.keys(params).length > 0;
|
|
1582
|
+
const path = hasParams ? `/${packageName}/inappproducts/${sku}?${new URLSearchParams(params).toString()}` : `/${packageName}/inappproducts/${sku}`;
|
|
1583
|
+
const { data } = await http.patch(path, body);
|
|
1584
|
+
return data;
|
|
1585
|
+
},
|
|
1557
1586
|
async delete(packageName, sku) {
|
|
1558
1587
|
await http.delete(`/${packageName}/inappproducts/${sku}`);
|
|
1559
1588
|
},
|
|
@@ -1576,10 +1605,9 @@ function createApiClient(options) {
|
|
|
1576
1605
|
return data.inappproduct || [];
|
|
1577
1606
|
},
|
|
1578
1607
|
async batchDelete(packageName, skus) {
|
|
1579
|
-
await http.post(
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
);
|
|
1608
|
+
await http.post(`/${packageName}/inappproducts:batchDelete`, {
|
|
1609
|
+
requests: skus.map((sku) => ({ packageName, sku }))
|
|
1610
|
+
});
|
|
1583
1611
|
}
|
|
1584
1612
|
},
|
|
1585
1613
|
purchases: {
|
|
@@ -1634,18 +1662,15 @@ function createApiClient(options) {
|
|
|
1634
1662
|
body ?? {}
|
|
1635
1663
|
);
|
|
1636
1664
|
},
|
|
1637
|
-
async revokeSubscriptionV2(packageName, token) {
|
|
1638
|
-
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:revoke`);
|
|
1639
|
-
},
|
|
1640
|
-
async refundSubscriptionV2(packageName, token) {
|
|
1641
|
-
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:refund`);
|
|
1642
|
-
},
|
|
1643
|
-
async cancelSubscriptionV2(packageName, token, body) {
|
|
1665
|
+
async revokeSubscriptionV2(packageName, token, body) {
|
|
1644
1666
|
await http.post(
|
|
1645
|
-
`/${packageName}/purchases/subscriptionsv2/tokens/${token}:
|
|
1646
|
-
body
|
|
1667
|
+
`/${packageName}/purchases/subscriptionsv2/tokens/${token}:revoke`,
|
|
1668
|
+
body ?? {}
|
|
1647
1669
|
);
|
|
1648
1670
|
},
|
|
1671
|
+
async cancelSubscriptionV2(packageName, token, body) {
|
|
1672
|
+
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:cancel`, body);
|
|
1673
|
+
},
|
|
1649
1674
|
async deferSubscriptionV2(packageName, token, body) {
|
|
1650
1675
|
const { data } = await http.post(
|
|
1651
1676
|
`/${packageName}/purchases/subscriptionsv2/tokens/${token}:defer`,
|
|
@@ -1664,7 +1689,8 @@ function createApiClient(options) {
|
|
|
1664
1689
|
if (options2?.startTime) params["startTime"] = options2.startTime;
|
|
1665
1690
|
if (options2?.endTime) params["endTime"] = options2.endTime;
|
|
1666
1691
|
if (options2?.type !== void 0) params["type"] = String(options2.type);
|
|
1667
|
-
if (options2?.includeQuantityBasedPartialRefund)
|
|
1692
|
+
if (options2?.includeQuantityBasedPartialRefund)
|
|
1693
|
+
params["includeQuantityBasedPartialRefund"] = "true";
|
|
1668
1694
|
if (options2?.maxResults) params["maxResults"] = String(options2.maxResults);
|
|
1669
1695
|
if (options2?.token) params["token"] = options2.token;
|
|
1670
1696
|
const hasParams = Object.keys(params).length > 0;
|
|
@@ -1677,9 +1703,7 @@ function createApiClient(options) {
|
|
|
1677
1703
|
},
|
|
1678
1704
|
orders: {
|
|
1679
1705
|
async get(packageName, orderId) {
|
|
1680
|
-
const { data } = await http.get(
|
|
1681
|
-
`/${packageName}/orders/${orderId}`
|
|
1682
|
-
);
|
|
1706
|
+
const { data } = await http.get(`/${packageName}/orders/${orderId}`);
|
|
1683
1707
|
return data;
|
|
1684
1708
|
},
|
|
1685
1709
|
async batchGet(packageName, orderIds) {
|
|
@@ -1724,6 +1748,13 @@ function createApiClient(options) {
|
|
|
1724
1748
|
testersData
|
|
1725
1749
|
);
|
|
1726
1750
|
return data;
|
|
1751
|
+
},
|
|
1752
|
+
async patch(packageName, editId, track, testersData) {
|
|
1753
|
+
const { data } = await http.patch(
|
|
1754
|
+
`/${packageName}/edits/${editId}/testers/${track}`,
|
|
1755
|
+
testersData
|
|
1756
|
+
);
|
|
1757
|
+
return data;
|
|
1727
1758
|
}
|
|
1728
1759
|
},
|
|
1729
1760
|
deobfuscation: {
|
|
@@ -1839,9 +1870,14 @@ function createApiClient(options) {
|
|
|
1839
1870
|
return data;
|
|
1840
1871
|
},
|
|
1841
1872
|
async create(packageName, body, regionsVersion) {
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
|
|
1873
|
+
const productId = body.productId;
|
|
1874
|
+
if (!productId) throw new Error("productId is required to create a one-time product");
|
|
1875
|
+
const params = new URLSearchParams({
|
|
1876
|
+
"regionsVersion.version": regionsVersion || DEFAULT_REGIONS_VERSION,
|
|
1877
|
+
allowMissing: "true"
|
|
1878
|
+
});
|
|
1879
|
+
const { data } = await http.patch(
|
|
1880
|
+
`/${packageName}/oneTimeProducts/${productId}?${params.toString()}`,
|
|
1845
1881
|
body
|
|
1846
1882
|
);
|
|
1847
1883
|
return data;
|
|
@@ -1858,37 +1894,41 @@ function createApiClient(options) {
|
|
|
1858
1894
|
async delete(packageName, productId) {
|
|
1859
1895
|
await http.delete(`/${packageName}/oneTimeProducts/${productId}`);
|
|
1860
1896
|
},
|
|
1861
|
-
async listOffers(packageName, productId) {
|
|
1897
|
+
async listOffers(packageName, productId, purchaseOptionId = "-") {
|
|
1862
1898
|
const { data } = await http.get(
|
|
1863
|
-
`/${packageName}/oneTimeProducts/${productId}/offers`
|
|
1899
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers`
|
|
1864
1900
|
);
|
|
1865
1901
|
return data;
|
|
1866
1902
|
},
|
|
1867
|
-
async getOffer(packageName, productId, offerId) {
|
|
1903
|
+
async getOffer(packageName, productId, purchaseOptionId, offerId) {
|
|
1868
1904
|
const { data } = await http.get(
|
|
1869
|
-
`/${packageName}/oneTimeProducts/${productId}/offers/${offerId}`
|
|
1905
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}`
|
|
1870
1906
|
);
|
|
1871
1907
|
return data;
|
|
1872
1908
|
},
|
|
1873
|
-
async createOffer(packageName, productId, body, regionsVersion) {
|
|
1874
|
-
const params = new URLSearchParams({
|
|
1909
|
+
async createOffer(packageName, productId, purchaseOptionId, body, regionsVersion) {
|
|
1910
|
+
const params = new URLSearchParams({
|
|
1911
|
+
"regionsVersion.version": regionsVersion || DEFAULT_REGIONS_VERSION
|
|
1912
|
+
});
|
|
1875
1913
|
const { data } = await http.post(
|
|
1876
|
-
`/${packageName}/oneTimeProducts/${productId}/offers?${params.toString()}`,
|
|
1914
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers?${params.toString()}`,
|
|
1877
1915
|
body
|
|
1878
1916
|
);
|
|
1879
1917
|
return data;
|
|
1880
1918
|
},
|
|
1881
|
-
async updateOffer(packageName, productId, offerId, body, updateMask, regionsVersion, options2) {
|
|
1919
|
+
async updateOffer(packageName, productId, purchaseOptionId, offerId, body, updateMask, regionsVersion, options2) {
|
|
1882
1920
|
const params = {};
|
|
1883
1921
|
if (updateMask) params["updateMask"] = updateMask;
|
|
1884
1922
|
params["regionsVersion.version"] = regionsVersion || DEFAULT_REGIONS_VERSION;
|
|
1885
1923
|
applyMutationOptions(params, options2);
|
|
1886
|
-
const path = `/${packageName}/oneTimeProducts/${productId}/offers/${offerId}?${new URLSearchParams(params).toString()}`;
|
|
1924
|
+
const path = `/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}?${new URLSearchParams(params).toString()}`;
|
|
1887
1925
|
const { data } = await http.patch(path, body);
|
|
1888
1926
|
return data;
|
|
1889
1927
|
},
|
|
1890
|
-
async deleteOffer(packageName, productId, offerId) {
|
|
1891
|
-
await http.delete(
|
|
1928
|
+
async deleteOffer(packageName, productId, purchaseOptionId, offerId) {
|
|
1929
|
+
await http.delete(
|
|
1930
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}`
|
|
1931
|
+
);
|
|
1892
1932
|
},
|
|
1893
1933
|
async batchGet(packageName, productIds) {
|
|
1894
1934
|
const params = productIds.map((id) => `productIds=${encodeURIComponent(id)}`).join("&");
|
|
@@ -1905,40 +1945,59 @@ function createApiClient(options) {
|
|
|
1905
1945
|
return data;
|
|
1906
1946
|
},
|
|
1907
1947
|
async batchDelete(packageName, productIds) {
|
|
1948
|
+
await http.post(`/${packageName}/oneTimeProducts:batchDelete`, {
|
|
1949
|
+
requests: productIds.map((id) => ({ productId: id }))
|
|
1950
|
+
});
|
|
1951
|
+
},
|
|
1952
|
+
// Purchase option batch operations
|
|
1953
|
+
async batchDeletePurchaseOptions(packageName, productId, requests) {
|
|
1908
1954
|
await http.post(
|
|
1909
|
-
`/${packageName}/oneTimeProducts:batchDelete`,
|
|
1910
|
-
{ requests
|
|
1955
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions:batchDelete`,
|
|
1956
|
+
{ requests }
|
|
1911
1957
|
);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
`/${packageName}/purchaseOptions`
|
|
1958
|
+
},
|
|
1959
|
+
async batchUpdatePurchaseOptionStates(packageName, productId, requests) {
|
|
1960
|
+
const { data } = await http.post(
|
|
1961
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions:batchUpdateStates`,
|
|
1962
|
+
{ requests }
|
|
1918
1963
|
);
|
|
1919
1964
|
return data;
|
|
1920
1965
|
},
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1966
|
+
// Offer batch operations
|
|
1967
|
+
async cancelOffer(packageName, productId, purchaseOptionId, offerId, latencyTolerance) {
|
|
1968
|
+
const body = latencyTolerance ? { latencyTolerance } : {};
|
|
1969
|
+
const { data } = await http.post(
|
|
1970
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}:cancel`,
|
|
1971
|
+
body
|
|
1924
1972
|
);
|
|
1925
1973
|
return data;
|
|
1926
1974
|
},
|
|
1927
|
-
async
|
|
1928
|
-
const { data } = await http.post(
|
|
1975
|
+
async batchGetOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1976
|
+
const { data } = await http.post(
|
|
1977
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchGet`,
|
|
1978
|
+
{ requests }
|
|
1979
|
+
);
|
|
1929
1980
|
return data;
|
|
1930
1981
|
},
|
|
1931
|
-
async
|
|
1982
|
+
async batchUpdateOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1932
1983
|
const { data } = await http.post(
|
|
1933
|
-
`/${packageName}/purchaseOptions/${purchaseOptionId}:
|
|
1984
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchUpdate`,
|
|
1985
|
+
{ requests }
|
|
1934
1986
|
);
|
|
1935
1987
|
return data;
|
|
1936
1988
|
},
|
|
1937
|
-
async
|
|
1989
|
+
async batchUpdateOfferStates(packageName, productId, purchaseOptionId, requests) {
|
|
1938
1990
|
const { data } = await http.post(
|
|
1939
|
-
`/${packageName}/purchaseOptions/${purchaseOptionId}:
|
|
1991
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchUpdateStates`,
|
|
1992
|
+
{ requests }
|
|
1940
1993
|
);
|
|
1941
1994
|
return data;
|
|
1995
|
+
},
|
|
1996
|
+
async batchDeleteOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1997
|
+
await http.post(
|
|
1998
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchDelete`,
|
|
1999
|
+
{ requests }
|
|
2000
|
+
);
|
|
1942
2001
|
}
|
|
1943
2002
|
},
|
|
1944
2003
|
internalAppSharing: {
|
|
@@ -1969,6 +2028,32 @@ function createApiClient(options) {
|
|
|
1969
2028
|
async download(packageName, versionCode, id) {
|
|
1970
2029
|
return http.download(`/${packageName}/generatedApks/${versionCode}/download/${id}`);
|
|
1971
2030
|
}
|
|
2031
|
+
},
|
|
2032
|
+
systemApks: {
|
|
2033
|
+
async create(packageName, versionCode, variant) {
|
|
2034
|
+
const { data } = await http.post(
|
|
2035
|
+
`/${packageName}/systemApks/${versionCode}/variants`,
|
|
2036
|
+
variant
|
|
2037
|
+
);
|
|
2038
|
+
return data;
|
|
2039
|
+
},
|
|
2040
|
+
async list(packageName, versionCode) {
|
|
2041
|
+
const { data } = await http.get(
|
|
2042
|
+
`/${packageName}/systemApks/${versionCode}/variants`
|
|
2043
|
+
);
|
|
2044
|
+
return data;
|
|
2045
|
+
},
|
|
2046
|
+
async get(packageName, versionCode, variantId) {
|
|
2047
|
+
const { data } = await http.get(
|
|
2048
|
+
`/${packageName}/systemApks/${versionCode}/variants/${variantId}`
|
|
2049
|
+
);
|
|
2050
|
+
return data;
|
|
2051
|
+
},
|
|
2052
|
+
async download(packageName, versionCode, variantId) {
|
|
2053
|
+
return http.download(
|
|
2054
|
+
`/${packageName}/systemApks/${versionCode}/variants/${variantId}:download`
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
1972
2057
|
}
|
|
1973
2058
|
};
|
|
1974
2059
|
}
|
|
@@ -2035,10 +2120,6 @@ function createUsersClient(options) {
|
|
|
2035
2120
|
);
|
|
2036
2121
|
return data;
|
|
2037
2122
|
},
|
|
2038
|
-
async get(developerId, userId) {
|
|
2039
|
-
const { data } = await http.get(`/${developerId}/users/${userId}`);
|
|
2040
|
-
return data;
|
|
2041
|
-
},
|
|
2042
2123
|
async create(developerId, user) {
|
|
2043
2124
|
const { data } = await http.post(`/${developerId}/users`, user);
|
|
2044
2125
|
return data;
|