@gpc-cli/api 1.0.28 → 1.0.29
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 +129 -33
- package/dist/index.js +141 -63
- 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: {
|
|
@@ -1637,14 +1665,8 @@ function createApiClient(options) {
|
|
|
1637
1665
|
async revokeSubscriptionV2(packageName, token) {
|
|
1638
1666
|
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:revoke`);
|
|
1639
1667
|
},
|
|
1640
|
-
async refundSubscriptionV2(packageName, token) {
|
|
1641
|
-
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:refund`);
|
|
1642
|
-
},
|
|
1643
1668
|
async cancelSubscriptionV2(packageName, token, body) {
|
|
1644
|
-
await http.post(
|
|
1645
|
-
`/${packageName}/purchases/subscriptionsv2/tokens/${token}:cancel`,
|
|
1646
|
-
body
|
|
1647
|
-
);
|
|
1669
|
+
await http.post(`/${packageName}/purchases/subscriptionsv2/tokens/${token}:cancel`, body);
|
|
1648
1670
|
},
|
|
1649
1671
|
async deferSubscriptionV2(packageName, token, body) {
|
|
1650
1672
|
const { data } = await http.post(
|
|
@@ -1664,7 +1686,8 @@ function createApiClient(options) {
|
|
|
1664
1686
|
if (options2?.startTime) params["startTime"] = options2.startTime;
|
|
1665
1687
|
if (options2?.endTime) params["endTime"] = options2.endTime;
|
|
1666
1688
|
if (options2?.type !== void 0) params["type"] = String(options2.type);
|
|
1667
|
-
if (options2?.includeQuantityBasedPartialRefund)
|
|
1689
|
+
if (options2?.includeQuantityBasedPartialRefund)
|
|
1690
|
+
params["includeQuantityBasedPartialRefund"] = "true";
|
|
1668
1691
|
if (options2?.maxResults) params["maxResults"] = String(options2.maxResults);
|
|
1669
1692
|
if (options2?.token) params["token"] = options2.token;
|
|
1670
1693
|
const hasParams = Object.keys(params).length > 0;
|
|
@@ -1677,9 +1700,7 @@ function createApiClient(options) {
|
|
|
1677
1700
|
},
|
|
1678
1701
|
orders: {
|
|
1679
1702
|
async get(packageName, orderId) {
|
|
1680
|
-
const { data } = await http.get(
|
|
1681
|
-
`/${packageName}/orders/${orderId}`
|
|
1682
|
-
);
|
|
1703
|
+
const { data } = await http.get(`/${packageName}/orders/${orderId}`);
|
|
1683
1704
|
return data;
|
|
1684
1705
|
},
|
|
1685
1706
|
async batchGet(packageName, orderIds) {
|
|
@@ -1724,6 +1745,13 @@ function createApiClient(options) {
|
|
|
1724
1745
|
testersData
|
|
1725
1746
|
);
|
|
1726
1747
|
return data;
|
|
1748
|
+
},
|
|
1749
|
+
async patch(packageName, editId, track, testersData) {
|
|
1750
|
+
const { data } = await http.patch(
|
|
1751
|
+
`/${packageName}/edits/${editId}/testers/${track}`,
|
|
1752
|
+
testersData
|
|
1753
|
+
);
|
|
1754
|
+
return data;
|
|
1727
1755
|
}
|
|
1728
1756
|
},
|
|
1729
1757
|
deobfuscation: {
|
|
@@ -1839,9 +1867,14 @@ function createApiClient(options) {
|
|
|
1839
1867
|
return data;
|
|
1840
1868
|
},
|
|
1841
1869
|
async create(packageName, body, regionsVersion) {
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
|
|
1870
|
+
const productId = body.productId;
|
|
1871
|
+
if (!productId) throw new Error("productId is required to create a one-time product");
|
|
1872
|
+
const params = new URLSearchParams({
|
|
1873
|
+
"regionsVersion.version": regionsVersion || DEFAULT_REGIONS_VERSION,
|
|
1874
|
+
allowMissing: "true"
|
|
1875
|
+
});
|
|
1876
|
+
const { data } = await http.patch(
|
|
1877
|
+
`/${packageName}/oneTimeProducts/${productId}?${params.toString()}`,
|
|
1845
1878
|
body
|
|
1846
1879
|
);
|
|
1847
1880
|
return data;
|
|
@@ -1858,37 +1891,41 @@ function createApiClient(options) {
|
|
|
1858
1891
|
async delete(packageName, productId) {
|
|
1859
1892
|
await http.delete(`/${packageName}/oneTimeProducts/${productId}`);
|
|
1860
1893
|
},
|
|
1861
|
-
async listOffers(packageName, productId) {
|
|
1894
|
+
async listOffers(packageName, productId, purchaseOptionId = "-") {
|
|
1862
1895
|
const { data } = await http.get(
|
|
1863
|
-
`/${packageName}/oneTimeProducts/${productId}/offers`
|
|
1896
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers`
|
|
1864
1897
|
);
|
|
1865
1898
|
return data;
|
|
1866
1899
|
},
|
|
1867
|
-
async getOffer(packageName, productId, offerId) {
|
|
1900
|
+
async getOffer(packageName, productId, purchaseOptionId, offerId) {
|
|
1868
1901
|
const { data } = await http.get(
|
|
1869
|
-
`/${packageName}/oneTimeProducts/${productId}/offers/${offerId}`
|
|
1902
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}`
|
|
1870
1903
|
);
|
|
1871
1904
|
return data;
|
|
1872
1905
|
},
|
|
1873
|
-
async createOffer(packageName, productId, body, regionsVersion) {
|
|
1874
|
-
const params = new URLSearchParams({
|
|
1906
|
+
async createOffer(packageName, productId, purchaseOptionId, body, regionsVersion) {
|
|
1907
|
+
const params = new URLSearchParams({
|
|
1908
|
+
"regionsVersion.version": regionsVersion || DEFAULT_REGIONS_VERSION
|
|
1909
|
+
});
|
|
1875
1910
|
const { data } = await http.post(
|
|
1876
|
-
`/${packageName}/oneTimeProducts/${productId}/offers?${params.toString()}`,
|
|
1911
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers?${params.toString()}`,
|
|
1877
1912
|
body
|
|
1878
1913
|
);
|
|
1879
1914
|
return data;
|
|
1880
1915
|
},
|
|
1881
|
-
async updateOffer(packageName, productId, offerId, body, updateMask, regionsVersion, options2) {
|
|
1916
|
+
async updateOffer(packageName, productId, purchaseOptionId, offerId, body, updateMask, regionsVersion, options2) {
|
|
1882
1917
|
const params = {};
|
|
1883
1918
|
if (updateMask) params["updateMask"] = updateMask;
|
|
1884
1919
|
params["regionsVersion.version"] = regionsVersion || DEFAULT_REGIONS_VERSION;
|
|
1885
1920
|
applyMutationOptions(params, options2);
|
|
1886
|
-
const path = `/${packageName}/oneTimeProducts/${productId}/offers/${offerId}?${new URLSearchParams(params).toString()}`;
|
|
1921
|
+
const path = `/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}?${new URLSearchParams(params).toString()}`;
|
|
1887
1922
|
const { data } = await http.patch(path, body);
|
|
1888
1923
|
return data;
|
|
1889
1924
|
},
|
|
1890
|
-
async deleteOffer(packageName, productId, offerId) {
|
|
1891
|
-
await http.delete(
|
|
1925
|
+
async deleteOffer(packageName, productId, purchaseOptionId, offerId) {
|
|
1926
|
+
await http.delete(
|
|
1927
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}`
|
|
1928
|
+
);
|
|
1892
1929
|
},
|
|
1893
1930
|
async batchGet(packageName, productIds) {
|
|
1894
1931
|
const params = productIds.map((id) => `productIds=${encodeURIComponent(id)}`).join("&");
|
|
@@ -1905,40 +1942,59 @@ function createApiClient(options) {
|
|
|
1905
1942
|
return data;
|
|
1906
1943
|
},
|
|
1907
1944
|
async batchDelete(packageName, productIds) {
|
|
1945
|
+
await http.post(`/${packageName}/oneTimeProducts:batchDelete`, {
|
|
1946
|
+
requests: productIds.map((id) => ({ productId: id }))
|
|
1947
|
+
});
|
|
1948
|
+
},
|
|
1949
|
+
// Purchase option batch operations
|
|
1950
|
+
async batchDeletePurchaseOptions(packageName, productId, requests) {
|
|
1908
1951
|
await http.post(
|
|
1909
|
-
`/${packageName}/oneTimeProducts:batchDelete`,
|
|
1910
|
-
{ requests
|
|
1952
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions:batchDelete`,
|
|
1953
|
+
{ requests }
|
|
1911
1954
|
);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
`/${packageName}/purchaseOptions`
|
|
1955
|
+
},
|
|
1956
|
+
async batchUpdatePurchaseOptionStates(packageName, productId, requests) {
|
|
1957
|
+
const { data } = await http.post(
|
|
1958
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions:batchUpdateStates`,
|
|
1959
|
+
{ requests }
|
|
1918
1960
|
);
|
|
1919
1961
|
return data;
|
|
1920
1962
|
},
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1963
|
+
// Offer batch operations
|
|
1964
|
+
async cancelOffer(packageName, productId, purchaseOptionId, offerId, latencyTolerance) {
|
|
1965
|
+
const body = latencyTolerance ? { latencyTolerance } : {};
|
|
1966
|
+
const { data } = await http.post(
|
|
1967
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers/${offerId}:cancel`,
|
|
1968
|
+
body
|
|
1924
1969
|
);
|
|
1925
1970
|
return data;
|
|
1926
1971
|
},
|
|
1927
|
-
async
|
|
1928
|
-
const { data } = await http.post(
|
|
1972
|
+
async batchGetOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1973
|
+
const { data } = await http.post(
|
|
1974
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchGet`,
|
|
1975
|
+
{ requests }
|
|
1976
|
+
);
|
|
1929
1977
|
return data;
|
|
1930
1978
|
},
|
|
1931
|
-
async
|
|
1979
|
+
async batchUpdateOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1932
1980
|
const { data } = await http.post(
|
|
1933
|
-
`/${packageName}/purchaseOptions/${purchaseOptionId}:
|
|
1981
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchUpdate`,
|
|
1982
|
+
{ requests }
|
|
1934
1983
|
);
|
|
1935
1984
|
return data;
|
|
1936
1985
|
},
|
|
1937
|
-
async
|
|
1986
|
+
async batchUpdateOfferStates(packageName, productId, purchaseOptionId, requests) {
|
|
1938
1987
|
const { data } = await http.post(
|
|
1939
|
-
`/${packageName}/purchaseOptions/${purchaseOptionId}:
|
|
1988
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchUpdateStates`,
|
|
1989
|
+
{ requests }
|
|
1940
1990
|
);
|
|
1941
1991
|
return data;
|
|
1992
|
+
},
|
|
1993
|
+
async batchDeleteOffers(packageName, productId, purchaseOptionId, requests) {
|
|
1994
|
+
await http.post(
|
|
1995
|
+
`/${packageName}/oneTimeProducts/${productId}/purchaseOptions/${purchaseOptionId}/offers:batchDelete`,
|
|
1996
|
+
{ requests }
|
|
1997
|
+
);
|
|
1942
1998
|
}
|
|
1943
1999
|
},
|
|
1944
2000
|
internalAppSharing: {
|
|
@@ -1969,6 +2025,32 @@ function createApiClient(options) {
|
|
|
1969
2025
|
async download(packageName, versionCode, id) {
|
|
1970
2026
|
return http.download(`/${packageName}/generatedApks/${versionCode}/download/${id}`);
|
|
1971
2027
|
}
|
|
2028
|
+
},
|
|
2029
|
+
systemApks: {
|
|
2030
|
+
async create(packageName, versionCode, variant) {
|
|
2031
|
+
const { data } = await http.post(
|
|
2032
|
+
`/${packageName}/systemApks/${versionCode}/variants`,
|
|
2033
|
+
variant
|
|
2034
|
+
);
|
|
2035
|
+
return data;
|
|
2036
|
+
},
|
|
2037
|
+
async list(packageName, versionCode) {
|
|
2038
|
+
const { data } = await http.get(
|
|
2039
|
+
`/${packageName}/systemApks/${versionCode}/variants`
|
|
2040
|
+
);
|
|
2041
|
+
return data;
|
|
2042
|
+
},
|
|
2043
|
+
async get(packageName, versionCode, variantId) {
|
|
2044
|
+
const { data } = await http.get(
|
|
2045
|
+
`/${packageName}/systemApks/${versionCode}/variants/${variantId}`
|
|
2046
|
+
);
|
|
2047
|
+
return data;
|
|
2048
|
+
},
|
|
2049
|
+
async download(packageName, versionCode, variantId) {
|
|
2050
|
+
return http.download(
|
|
2051
|
+
`/${packageName}/systemApks/${versionCode}/variants/${variantId}:download`
|
|
2052
|
+
);
|
|
2053
|
+
}
|
|
1972
2054
|
}
|
|
1973
2055
|
};
|
|
1974
2056
|
}
|
|
@@ -2035,10 +2117,6 @@ function createUsersClient(options) {
|
|
|
2035
2117
|
);
|
|
2036
2118
|
return data;
|
|
2037
2119
|
},
|
|
2038
|
-
async get(developerId, userId) {
|
|
2039
|
-
const { data } = await http.get(`/${developerId}/users/${userId}`);
|
|
2040
|
-
return data;
|
|
2041
|
-
},
|
|
2042
2120
|
async create(developerId, user) {
|
|
2043
2121
|
const { data } = await http.post(`/${developerId}/users`, user);
|
|
2044
2122
|
return data;
|