@ticketlayer/backstage 1.1.0 → 2.0.0
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/dist/client.d.ts +981 -487
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +123 -259
- package/dist/generated/types.d.ts +9318 -7652
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BackstageClient = exports.SDK_CLIENT_HEADER = exports.API_DATED_VERSION = exports.BackstageAPIError = void 0;
|
|
4
4
|
const version_1 = require("./version");
|
|
5
5
|
class BackstageAPIError extends Error {
|
|
6
|
-
constructor(message, code, statusCode) {
|
|
6
|
+
constructor(message, code, statusCode, details = {}) {
|
|
7
7
|
super(message);
|
|
8
8
|
this.name = 'BackstageAPIError';
|
|
9
9
|
this.code = code;
|
|
10
10
|
this.statusCode = statusCode;
|
|
11
|
+
this.moreInfo = details.moreInfo;
|
|
12
|
+
this.requestId = details.requestId;
|
|
11
13
|
}
|
|
12
14
|
isPermissionDenied() {
|
|
13
15
|
return this.code === 'PERMISSION_DENIED';
|
|
@@ -568,7 +570,7 @@ class BackstageClient {
|
|
|
568
570
|
const response = await this.request(requestPath, {
|
|
569
571
|
method: 'GET'
|
|
570
572
|
});
|
|
571
|
-
return response
|
|
573
|
+
return response;
|
|
572
574
|
},
|
|
573
575
|
update: async (id, request) => {
|
|
574
576
|
const response = await this.request(`/events/${id}`, {
|
|
@@ -1181,6 +1183,13 @@ class BackstageClient {
|
|
|
1181
1183
|
});
|
|
1182
1184
|
return response;
|
|
1183
1185
|
},
|
|
1186
|
+
match: async (request) => {
|
|
1187
|
+
const response = await this.request(`/customers/match`, {
|
|
1188
|
+
method: 'POST',
|
|
1189
|
+
body: JSON.stringify(request)
|
|
1190
|
+
});
|
|
1191
|
+
return response.match;
|
|
1192
|
+
},
|
|
1184
1193
|
get: async (customerId) => {
|
|
1185
1194
|
const response = await this.request(`/customers/${customerId}`, {
|
|
1186
1195
|
method: 'GET'
|
|
@@ -1420,7 +1429,7 @@ class BackstageClient {
|
|
|
1420
1429
|
method: 'POST',
|
|
1421
1430
|
body: JSON.stringify(request)
|
|
1422
1431
|
});
|
|
1423
|
-
return response;
|
|
1432
|
+
return response.commandId;
|
|
1424
1433
|
}
|
|
1425
1434
|
};
|
|
1426
1435
|
this.payments = {
|
|
@@ -1507,13 +1516,13 @@ class BackstageClient {
|
|
|
1507
1516
|
const response = await this.request(requestPath, {
|
|
1508
1517
|
method: 'GET'
|
|
1509
1518
|
});
|
|
1510
|
-
return response;
|
|
1519
|
+
return response.status;
|
|
1511
1520
|
},
|
|
1512
1521
|
createTicketlayerPayOnboardingSession: async () => {
|
|
1513
1522
|
const response = await this.request(`/payment-providers/ticketlayer-pay/onboarding-session`, {
|
|
1514
1523
|
method: 'POST'
|
|
1515
1524
|
});
|
|
1516
|
-
return response;
|
|
1525
|
+
return response.session;
|
|
1517
1526
|
},
|
|
1518
1527
|
createTicketlayerPayOnboardingLink: async (request) => {
|
|
1519
1528
|
const response = await this.request(`/payment-providers/ticketlayer-pay/onboarding-link`, {
|
|
@@ -1533,13 +1542,13 @@ class BackstageClient {
|
|
|
1533
1542
|
const response = await this.request(`/payment-providers/stripe-connect`, {
|
|
1534
1543
|
method: 'GET'
|
|
1535
1544
|
});
|
|
1536
|
-
return response;
|
|
1545
|
+
return response.provider;
|
|
1537
1546
|
},
|
|
1538
1547
|
listAccounts: async (providerId) => {
|
|
1539
1548
|
const response = await this.request(`/payment-providers/${providerId}/accounts`, {
|
|
1540
1549
|
method: 'GET'
|
|
1541
1550
|
});
|
|
1542
|
-
return response;
|
|
1551
|
+
return response.accounts;
|
|
1543
1552
|
},
|
|
1544
1553
|
getAccount: async (providerId, accountId, options) => {
|
|
1545
1554
|
const params = new URLSearchParams();
|
|
@@ -1550,20 +1559,20 @@ class BackstageClient {
|
|
|
1550
1559
|
const response = await this.request(requestPath, {
|
|
1551
1560
|
method: 'GET'
|
|
1552
1561
|
});
|
|
1553
|
-
return response;
|
|
1562
|
+
return response.account;
|
|
1554
1563
|
},
|
|
1555
1564
|
setAccountMode: async (providerId, accountId, request) => {
|
|
1556
1565
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}`, {
|
|
1557
1566
|
method: 'PUT',
|
|
1558
1567
|
body: JSON.stringify(request)
|
|
1559
1568
|
});
|
|
1560
|
-
return response;
|
|
1569
|
+
return response.account;
|
|
1561
1570
|
},
|
|
1562
1571
|
createAccountOnboardingSession: async (providerId, accountId) => {
|
|
1563
1572
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}/onboarding-session`, {
|
|
1564
1573
|
method: 'POST'
|
|
1565
1574
|
});
|
|
1566
|
-
return response;
|
|
1575
|
+
return response.session;
|
|
1567
1576
|
},
|
|
1568
1577
|
createAccountOnboardingLink: async (providerId, accountId, request) => {
|
|
1569
1578
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}/onboarding-link`, {
|
|
@@ -1674,6 +1683,13 @@ class BackstageClient {
|
|
|
1674
1683
|
});
|
|
1675
1684
|
return response.listings;
|
|
1676
1685
|
},
|
|
1686
|
+
update: async (listingId, request) => {
|
|
1687
|
+
const response = await this.request(`/sales-channels/${channelId}/listings/${listingId}`, {
|
|
1688
|
+
method: 'PATCH',
|
|
1689
|
+
body: JSON.stringify(request)
|
|
1690
|
+
});
|
|
1691
|
+
return response.listing;
|
|
1692
|
+
},
|
|
1677
1693
|
delete: async (listingId) => {
|
|
1678
1694
|
const response = await this.request(`/sales-channels/${channelId}/listings/${listingId}`, {
|
|
1679
1695
|
method: 'DELETE'
|
|
@@ -1681,39 +1697,25 @@ class BackstageClient {
|
|
|
1681
1697
|
return response.deleted;
|
|
1682
1698
|
}
|
|
1683
1699
|
},
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1687
|
-
method: 'POST',
|
|
1688
|
-
body: JSON.stringify(request)
|
|
1689
|
-
});
|
|
1690
|
-
return response;
|
|
1691
|
-
},
|
|
1692
|
-
get: async (cartId) => {
|
|
1693
|
-
const response = await this.request(`/sales-channels/${channelId}/carts/${cartId}`, {
|
|
1700
|
+
channelaccess: {
|
|
1701
|
+
list: async () => {
|
|
1702
|
+
const response = await this.request(`/sales-channels/${channelId}/access`, {
|
|
1694
1703
|
method: 'GET'
|
|
1695
1704
|
});
|
|
1696
|
-
return response;
|
|
1705
|
+
return response.access;
|
|
1697
1706
|
},
|
|
1698
|
-
|
|
1699
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1707
|
+
grant: async (request) => {
|
|
1708
|
+
const response = await this.request(`/sales-channels/${channelId}/access`, {
|
|
1700
1709
|
method: 'POST',
|
|
1701
1710
|
body: JSON.stringify(request)
|
|
1702
1711
|
});
|
|
1703
|
-
return response;
|
|
1712
|
+
return response.access;
|
|
1704
1713
|
},
|
|
1705
|
-
|
|
1706
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1714
|
+
revoke: async (accessId) => {
|
|
1715
|
+
const response = await this.request(`/sales-channels/${channelId}/access/${accessId}`, {
|
|
1707
1716
|
method: 'DELETE'
|
|
1708
1717
|
});
|
|
1709
|
-
return response;
|
|
1710
|
-
},
|
|
1711
|
-
checkout: async (cartId, request) => {
|
|
1712
|
-
const response = await this.request(`/sales-channels/${channelId}/carts/${cartId}/checkout`, {
|
|
1713
|
-
method: 'POST',
|
|
1714
|
-
body: JSON.stringify(request)
|
|
1715
|
-
});
|
|
1716
|
-
return response;
|
|
1718
|
+
return response.deleted;
|
|
1717
1719
|
}
|
|
1718
1720
|
}
|
|
1719
1721
|
}), {
|
|
@@ -1749,19 +1751,48 @@ class BackstageClient {
|
|
|
1749
1751
|
});
|
|
1750
1752
|
return response.deleted;
|
|
1751
1753
|
},
|
|
1752
|
-
|
|
1753
|
-
const response = await this.request(`/sales-channels
|
|
1754
|
+
mySalesChannels: async () => {
|
|
1755
|
+
const response = await this.request(`/my/sales-channels`, {
|
|
1754
1756
|
method: 'GET'
|
|
1755
1757
|
});
|
|
1756
1758
|
return response;
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
this.carts = {
|
|
1762
|
+
create: async (request) => {
|
|
1763
|
+
const response = await this.request(`/cart`, {
|
|
1764
|
+
method: 'POST',
|
|
1765
|
+
body: JSON.stringify(request)
|
|
1766
|
+
});
|
|
1767
|
+
return response;
|
|
1757
1768
|
},
|
|
1758
|
-
|
|
1759
|
-
const response = await this.request(`/
|
|
1769
|
+
get: async (cartId) => {
|
|
1770
|
+
const response = await this.request(`/cart/${cartId}`, {
|
|
1760
1771
|
method: 'GET'
|
|
1761
1772
|
});
|
|
1762
|
-
return response
|
|
1773
|
+
return response;
|
|
1774
|
+
},
|
|
1775
|
+
addItem: async (cartId, request) => {
|
|
1776
|
+
const response = await this.request(`/cart/${cartId}/items`, {
|
|
1777
|
+
method: 'POST',
|
|
1778
|
+
body: JSON.stringify(request)
|
|
1779
|
+
});
|
|
1780
|
+
return response;
|
|
1781
|
+
},
|
|
1782
|
+
removeItem: async (cartId, itemId) => {
|
|
1783
|
+
const response = await this.request(`/cart/${cartId}/items/${itemId}`, {
|
|
1784
|
+
method: 'DELETE'
|
|
1785
|
+
});
|
|
1786
|
+
return response;
|
|
1787
|
+
},
|
|
1788
|
+
checkout: async (cartId, request) => {
|
|
1789
|
+
const response = await this.request(`/cart/${cartId}/checkout`, {
|
|
1790
|
+
method: 'POST',
|
|
1791
|
+
body: JSON.stringify(request)
|
|
1792
|
+
});
|
|
1793
|
+
return response;
|
|
1763
1794
|
}
|
|
1764
|
-
}
|
|
1795
|
+
};
|
|
1765
1796
|
this.presaleCodes = {
|
|
1766
1797
|
create: async (request) => {
|
|
1767
1798
|
const response = await this.request(`/presale-codes`, {
|
|
@@ -1915,39 +1946,39 @@ class BackstageClient {
|
|
|
1915
1946
|
method: 'POST',
|
|
1916
1947
|
body: JSON.stringify(request)
|
|
1917
1948
|
});
|
|
1918
|
-
return response;
|
|
1949
|
+
return response.scanConfig;
|
|
1919
1950
|
},
|
|
1920
1951
|
list: async () => {
|
|
1921
1952
|
const response = await this.request(`/scan-configs`, {
|
|
1922
1953
|
method: 'GET'
|
|
1923
1954
|
});
|
|
1924
|
-
return response;
|
|
1955
|
+
return response.scanConfigs;
|
|
1925
1956
|
},
|
|
1926
1957
|
get: async (configId) => {
|
|
1927
1958
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1928
1959
|
method: 'GET'
|
|
1929
1960
|
});
|
|
1930
|
-
return response;
|
|
1961
|
+
return response.scanConfig;
|
|
1931
1962
|
},
|
|
1932
1963
|
update: async (configId, request) => {
|
|
1933
1964
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1934
1965
|
method: 'PATCH',
|
|
1935
1966
|
body: JSON.stringify(request)
|
|
1936
1967
|
});
|
|
1937
|
-
return response;
|
|
1968
|
+
return response.scanConfig;
|
|
1938
1969
|
},
|
|
1939
1970
|
delete: async (configId) => {
|
|
1940
1971
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1941
1972
|
method: 'DELETE'
|
|
1942
1973
|
});
|
|
1943
|
-
return response;
|
|
1974
|
+
return response.deleted;
|
|
1944
1975
|
},
|
|
1945
1976
|
setDevices: async (configId, request) => {
|
|
1946
1977
|
const response = await this.request(`/scan-configs/${configId}/devices`, {
|
|
1947
1978
|
method: 'PUT',
|
|
1948
1979
|
body: JSON.stringify(request)
|
|
1949
1980
|
});
|
|
1950
|
-
return response;
|
|
1981
|
+
return response.deviceIds;
|
|
1951
1982
|
}
|
|
1952
1983
|
};
|
|
1953
1984
|
this.scan = {
|
|
@@ -1955,7 +1986,7 @@ class BackstageClient {
|
|
|
1955
1986
|
const response = await this.request(`/scan/config`, {
|
|
1956
1987
|
method: 'GET'
|
|
1957
1988
|
});
|
|
1958
|
-
return response;
|
|
1989
|
+
return response.scanConfig;
|
|
1959
1990
|
},
|
|
1960
1991
|
manifest: async (options) => {
|
|
1961
1992
|
const params = new URLSearchParams();
|
|
@@ -1973,7 +2004,7 @@ class BackstageClient {
|
|
|
1973
2004
|
method: 'POST',
|
|
1974
2005
|
body: JSON.stringify(request)
|
|
1975
2006
|
});
|
|
1976
|
-
return response;
|
|
2007
|
+
return response.results;
|
|
1977
2008
|
}
|
|
1978
2009
|
};
|
|
1979
2010
|
this.scans = {
|
|
@@ -1998,14 +2029,14 @@ class BackstageClient {
|
|
|
1998
2029
|
const response = await this.request(requestPath, {
|
|
1999
2030
|
method: 'GET'
|
|
2000
2031
|
});
|
|
2001
|
-
return response;
|
|
2032
|
+
return response.scans;
|
|
2002
2033
|
},
|
|
2003
2034
|
reverse: async (redemptionId, request) => {
|
|
2004
2035
|
const response = await this.request(`/redemptions/${redemptionId}/reverse`, {
|
|
2005
2036
|
method: 'POST',
|
|
2006
2037
|
body: JSON.stringify(request)
|
|
2007
2038
|
});
|
|
2008
|
-
return response;
|
|
2039
|
+
return response.redemption;
|
|
2009
2040
|
}
|
|
2010
2041
|
};
|
|
2011
2042
|
this.assets = {
|
|
@@ -2081,7 +2112,7 @@ class BackstageClient {
|
|
|
2081
2112
|
method: 'POST',
|
|
2082
2113
|
body: JSON.stringify(request)
|
|
2083
2114
|
});
|
|
2084
|
-
return response;
|
|
2115
|
+
return response.status;
|
|
2085
2116
|
}
|
|
2086
2117
|
};
|
|
2087
2118
|
this.deviceAuth = {
|
|
@@ -2118,7 +2149,7 @@ class BackstageClient {
|
|
|
2118
2149
|
method: 'PUT',
|
|
2119
2150
|
body: JSON.stringify(request)
|
|
2120
2151
|
});
|
|
2121
|
-
return response;
|
|
2152
|
+
return response.peripherals;
|
|
2122
2153
|
},
|
|
2123
2154
|
fetchCommands: async (options) => {
|
|
2124
2155
|
const params = new URLSearchParams();
|
|
@@ -2129,28 +2160,28 @@ class BackstageClient {
|
|
|
2129
2160
|
const response = await this.request(requestPath, {
|
|
2130
2161
|
method: 'GET'
|
|
2131
2162
|
});
|
|
2132
|
-
return response;
|
|
2163
|
+
return response.commands;
|
|
2133
2164
|
},
|
|
2134
2165
|
reportProgress: async (commandId, request) => {
|
|
2135
2166
|
const response = await this.request(`/devices/me/commands/${commandId}/progress`, {
|
|
2136
2167
|
method: 'POST',
|
|
2137
2168
|
body: JSON.stringify(request)
|
|
2138
2169
|
});
|
|
2139
|
-
return response;
|
|
2170
|
+
return response.ok;
|
|
2140
2171
|
},
|
|
2141
2172
|
reportResult: async (commandId, request) => {
|
|
2142
2173
|
const response = await this.request(`/devices/me/commands/${commandId}/result`, {
|
|
2143
2174
|
method: 'POST',
|
|
2144
2175
|
body: JSON.stringify(request)
|
|
2145
2176
|
});
|
|
2146
|
-
return response;
|
|
2177
|
+
return response.status;
|
|
2147
2178
|
},
|
|
2148
2179
|
ingestEvents: async (request) => {
|
|
2149
2180
|
const response = await this.request(`/devices/me/events`, {
|
|
2150
2181
|
method: 'POST',
|
|
2151
2182
|
body: JSON.stringify(request)
|
|
2152
2183
|
});
|
|
2153
|
-
return response;
|
|
2184
|
+
return response.results;
|
|
2154
2185
|
},
|
|
2155
2186
|
getCertificate: async () => {
|
|
2156
2187
|
const response = await this.request(`/devices/me/certificate`, {
|
|
@@ -2164,7 +2195,7 @@ class BackstageClient {
|
|
|
2164
2195
|
const response = await this.request(`/devices/printers`, {
|
|
2165
2196
|
method: 'GET'
|
|
2166
2197
|
});
|
|
2167
|
-
return response;
|
|
2198
|
+
return response.printers;
|
|
2168
2199
|
},
|
|
2169
2200
|
mediaCatalog: async () => {
|
|
2170
2201
|
const response = await this.request(`/devices/media-catalog`, {
|
|
@@ -2176,7 +2207,7 @@ class BackstageClient {
|
|
|
2176
2207
|
const response = await this.request(`/devices/commands/${commandId}`, {
|
|
2177
2208
|
method: 'GET'
|
|
2178
2209
|
});
|
|
2179
|
-
return response;
|
|
2210
|
+
return response.command;
|
|
2180
2211
|
},
|
|
2181
2212
|
list: async (options) => {
|
|
2182
2213
|
const params = new URLSearchParams();
|
|
@@ -2195,39 +2226,39 @@ class BackstageClient {
|
|
|
2195
2226
|
const response = await this.request(requestPath, {
|
|
2196
2227
|
method: 'GET'
|
|
2197
2228
|
});
|
|
2198
|
-
return response;
|
|
2229
|
+
return response.devices;
|
|
2199
2230
|
},
|
|
2200
2231
|
get: async (deviceId) => {
|
|
2201
2232
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2202
2233
|
method: 'GET'
|
|
2203
2234
|
});
|
|
2204
|
-
return response;
|
|
2235
|
+
return response.device;
|
|
2205
2236
|
},
|
|
2206
2237
|
update: async (deviceId, request) => {
|
|
2207
2238
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2208
2239
|
method: 'PATCH',
|
|
2209
2240
|
body: JSON.stringify(request)
|
|
2210
2241
|
});
|
|
2211
|
-
return response;
|
|
2242
|
+
return response.device;
|
|
2212
2243
|
},
|
|
2213
2244
|
delete: async (deviceId) => {
|
|
2214
2245
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2215
2246
|
method: 'DELETE'
|
|
2216
2247
|
});
|
|
2217
|
-
return response;
|
|
2248
|
+
return response.deleted;
|
|
2218
2249
|
},
|
|
2219
2250
|
revoke: async (deviceId) => {
|
|
2220
2251
|
const response = await this.request(`/devices/${deviceId}/revoke`, {
|
|
2221
2252
|
method: 'POST'
|
|
2222
2253
|
});
|
|
2223
|
-
return response;
|
|
2254
|
+
return response.device;
|
|
2224
2255
|
},
|
|
2225
2256
|
assignRoles: async (deviceId, request) => {
|
|
2226
2257
|
const response = await this.request(`/devices/${deviceId}/roles`, {
|
|
2227
2258
|
method: 'PUT',
|
|
2228
2259
|
body: JSON.stringify(request)
|
|
2229
2260
|
});
|
|
2230
|
-
return response;
|
|
2261
|
+
return response.roles;
|
|
2231
2262
|
},
|
|
2232
2263
|
rotateCredential: async (deviceId, request) => {
|
|
2233
2264
|
const response = await this.request(`/devices/${deviceId}/credentials/rotate`, {
|
|
@@ -2241,19 +2272,19 @@ class BackstageClient {
|
|
|
2241
2272
|
method: 'POST',
|
|
2242
2273
|
body: JSON.stringify(request)
|
|
2243
2274
|
});
|
|
2244
|
-
return response;
|
|
2275
|
+
return response.command;
|
|
2245
2276
|
},
|
|
2246
2277
|
listCommands: async (deviceId) => {
|
|
2247
2278
|
const response = await this.request(`/devices/${deviceId}/commands`, {
|
|
2248
2279
|
method: 'GET'
|
|
2249
2280
|
});
|
|
2250
|
-
return response;
|
|
2281
|
+
return response.commands;
|
|
2251
2282
|
},
|
|
2252
2283
|
listEvents: async (deviceId) => {
|
|
2253
2284
|
const response = await this.request(`/devices/${deviceId}/events`, {
|
|
2254
2285
|
method: 'GET'
|
|
2255
2286
|
});
|
|
2256
|
-
return response;
|
|
2287
|
+
return response.events;
|
|
2257
2288
|
},
|
|
2258
2289
|
mintLocalToken: async (deviceId, request) => {
|
|
2259
2290
|
const response = await this.request(`/devices/${deviceId}/local-tokens`, {
|
|
@@ -2269,32 +2300,32 @@ class BackstageClient {
|
|
|
2269
2300
|
method: 'POST',
|
|
2270
2301
|
body: JSON.stringify(request)
|
|
2271
2302
|
});
|
|
2272
|
-
return response;
|
|
2303
|
+
return response.location;
|
|
2273
2304
|
},
|
|
2274
2305
|
list: async () => {
|
|
2275
2306
|
const response = await this.request(`/locations`, {
|
|
2276
2307
|
method: 'GET'
|
|
2277
2308
|
});
|
|
2278
|
-
return response;
|
|
2309
|
+
return response.locations;
|
|
2279
2310
|
},
|
|
2280
2311
|
get: async (locationId) => {
|
|
2281
2312
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2282
2313
|
method: 'GET'
|
|
2283
2314
|
});
|
|
2284
|
-
return response;
|
|
2315
|
+
return response.location;
|
|
2285
2316
|
},
|
|
2286
2317
|
update: async (locationId, request) => {
|
|
2287
2318
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2288
2319
|
method: 'PATCH',
|
|
2289
2320
|
body: JSON.stringify(request)
|
|
2290
2321
|
});
|
|
2291
|
-
return response;
|
|
2322
|
+
return response.location;
|
|
2292
2323
|
},
|
|
2293
2324
|
delete: async (locationId) => {
|
|
2294
2325
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2295
2326
|
method: 'DELETE'
|
|
2296
2327
|
});
|
|
2297
|
-
return response;
|
|
2328
|
+
return response.deleted;
|
|
2298
2329
|
}
|
|
2299
2330
|
};
|
|
2300
2331
|
this.reports = {
|
|
@@ -2465,26 +2496,26 @@ class BackstageClient {
|
|
|
2465
2496
|
const response = await this.request(requestPath, {
|
|
2466
2497
|
method: 'GET'
|
|
2467
2498
|
});
|
|
2468
|
-
return response;
|
|
2499
|
+
return response.endpoints;
|
|
2469
2500
|
},
|
|
2470
2501
|
get: async (endpointId) => {
|
|
2471
2502
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2472
2503
|
method: 'GET'
|
|
2473
2504
|
});
|
|
2474
|
-
return response;
|
|
2505
|
+
return response.endpoint;
|
|
2475
2506
|
},
|
|
2476
2507
|
update: async (endpointId, request) => {
|
|
2477
2508
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2478
2509
|
method: 'PATCH',
|
|
2479
2510
|
body: JSON.stringify(request)
|
|
2480
2511
|
});
|
|
2481
|
-
return response;
|
|
2512
|
+
return response.endpoint;
|
|
2482
2513
|
},
|
|
2483
2514
|
delete: async (endpointId) => {
|
|
2484
2515
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2485
2516
|
method: 'DELETE'
|
|
2486
2517
|
});
|
|
2487
|
-
return response;
|
|
2518
|
+
return response.deleted;
|
|
2488
2519
|
},
|
|
2489
2520
|
test: async (endpointId) => {
|
|
2490
2521
|
const response = await this.request(`/webhook-endpoints/${endpointId}/test`, {
|
|
@@ -2505,19 +2536,19 @@ class BackstageClient {
|
|
|
2505
2536
|
const response = await this.request(requestPath, {
|
|
2506
2537
|
method: 'GET'
|
|
2507
2538
|
});
|
|
2508
|
-
return response;
|
|
2539
|
+
return response.deliveries;
|
|
2509
2540
|
},
|
|
2510
2541
|
get: async (deliveryId) => {
|
|
2511
2542
|
const response = await this.request(`/webhook-deliveries/${deliveryId}`, {
|
|
2512
2543
|
method: 'GET'
|
|
2513
2544
|
});
|
|
2514
|
-
return response;
|
|
2545
|
+
return response.delivery;
|
|
2515
2546
|
},
|
|
2516
2547
|
listInbound: async () => {
|
|
2517
2548
|
const response = await this.request(`/webhook-inbound`, {
|
|
2518
2549
|
method: 'GET'
|
|
2519
2550
|
});
|
|
2520
|
-
return response;
|
|
2551
|
+
return response.events;
|
|
2521
2552
|
}
|
|
2522
2553
|
};
|
|
2523
2554
|
this.webhookEventTypes = {
|
|
@@ -2525,7 +2556,7 @@ class BackstageClient {
|
|
|
2525
2556
|
const response = await this.request(`/webhook-event-types`, {
|
|
2526
2557
|
method: 'GET'
|
|
2527
2558
|
});
|
|
2528
|
-
return response;
|
|
2559
|
+
return response.eventTypes;
|
|
2529
2560
|
}
|
|
2530
2561
|
};
|
|
2531
2562
|
this.integrations = {
|
|
@@ -2539,19 +2570,19 @@ class BackstageClient {
|
|
|
2539
2570
|
const response = await this.request(`/integrations/connected-apps`, {
|
|
2540
2571
|
method: 'GET'
|
|
2541
2572
|
});
|
|
2542
|
-
return response;
|
|
2573
|
+
return response.connectedApps;
|
|
2543
2574
|
},
|
|
2544
2575
|
get: async (id) => {
|
|
2545
2576
|
const response = await this.request(`/integrations/${id}`, {
|
|
2546
2577
|
method: 'GET'
|
|
2547
2578
|
});
|
|
2548
|
-
return response;
|
|
2579
|
+
return response.integration;
|
|
2549
2580
|
},
|
|
2550
2581
|
revokeConnection: async (id) => {
|
|
2551
2582
|
const response = await this.request(`/integrations/${id}/connection`, {
|
|
2552
2583
|
method: 'DELETE'
|
|
2553
2584
|
});
|
|
2554
|
-
return response;
|
|
2585
|
+
return response.revoked;
|
|
2555
2586
|
}
|
|
2556
2587
|
};
|
|
2557
2588
|
this.clientVersions = {
|
|
@@ -2610,178 +2641,6 @@ class BackstageClient {
|
|
|
2610
2641
|
return response;
|
|
2611
2642
|
}
|
|
2612
2643
|
};
|
|
2613
|
-
this.sales = {
|
|
2614
|
-
resolveChannel: async (options) => {
|
|
2615
|
-
const params = new URLSearchParams();
|
|
2616
|
-
if (options?.domain !== undefined)
|
|
2617
|
-
params.append('domain', String(options.domain));
|
|
2618
|
-
if (options?.key !== undefined)
|
|
2619
|
-
params.append('key', String(options.key));
|
|
2620
|
-
const queryString = params.toString();
|
|
2621
|
-
const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;
|
|
2622
|
-
const response = await this.request(requestPath, {
|
|
2623
|
-
method: 'GET'
|
|
2624
|
-
});
|
|
2625
|
-
return response;
|
|
2626
|
-
},
|
|
2627
|
-
get: async (eventId) => {
|
|
2628
|
-
const response = await this.request(`/sales/events/${eventId}`, {
|
|
2629
|
-
method: 'GET'
|
|
2630
|
-
});
|
|
2631
|
-
return response.event;
|
|
2632
|
-
},
|
|
2633
|
-
getTheme: async () => {
|
|
2634
|
-
const response = await this.request(`/sales/theme`, {
|
|
2635
|
-
method: 'GET'
|
|
2636
|
-
});
|
|
2637
|
-
return response.theme;
|
|
2638
|
-
}
|
|
2639
|
-
};
|
|
2640
|
-
this.salesCustomerAuth = {
|
|
2641
|
-
magicLink: async (request) => {
|
|
2642
|
-
const response = await this.request(`/sales/customer-auth/magic-link`, {
|
|
2643
|
-
method: 'POST',
|
|
2644
|
-
body: JSON.stringify(request)
|
|
2645
|
-
});
|
|
2646
|
-
return response.sent;
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
this.salesCustomerTokens = {
|
|
2650
|
-
create: async (request) => {
|
|
2651
|
-
const response = await this.request(`/sales/customer-tokens`, {
|
|
2652
|
-
method: 'POST',
|
|
2653
|
-
body: JSON.stringify(request)
|
|
2654
|
-
});
|
|
2655
|
-
return response;
|
|
2656
|
-
},
|
|
2657
|
-
refresh: async () => {
|
|
2658
|
-
const response = await this.request(`/sales/customer-tokens/refresh`, {
|
|
2659
|
-
method: 'POST'
|
|
2660
|
-
});
|
|
2661
|
-
return response;
|
|
2662
|
-
}
|
|
2663
|
-
};
|
|
2664
|
-
this.salesListings = {
|
|
2665
|
-
list: async () => {
|
|
2666
|
-
const response = await this.request(`/sales/listings`, {
|
|
2667
|
-
method: 'GET'
|
|
2668
|
-
});
|
|
2669
|
-
return response;
|
|
2670
|
-
}
|
|
2671
|
-
};
|
|
2672
|
-
this.salesCarts = {
|
|
2673
|
-
create: async (request) => {
|
|
2674
|
-
const response = await this.request(`/sales/carts`, {
|
|
2675
|
-
method: 'POST',
|
|
2676
|
-
body: JSON.stringify(request)
|
|
2677
|
-
});
|
|
2678
|
-
return response.cart;
|
|
2679
|
-
},
|
|
2680
|
-
get: async (cartId) => {
|
|
2681
|
-
const response = await this.request(`/sales/carts/${cartId}`, {
|
|
2682
|
-
method: 'GET'
|
|
2683
|
-
});
|
|
2684
|
-
return response.cart;
|
|
2685
|
-
},
|
|
2686
|
-
addItem: async (cartId, request) => {
|
|
2687
|
-
const response = await this.request(`/sales/carts/${cartId}/items`, {
|
|
2688
|
-
method: 'POST',
|
|
2689
|
-
body: JSON.stringify(request)
|
|
2690
|
-
});
|
|
2691
|
-
return response.cart;
|
|
2692
|
-
},
|
|
2693
|
-
removeItem: async (cartId, itemId) => {
|
|
2694
|
-
const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
|
|
2695
|
-
method: 'DELETE'
|
|
2696
|
-
});
|
|
2697
|
-
return response.cart;
|
|
2698
|
-
},
|
|
2699
|
-
checkout: async (cartId, request) => {
|
|
2700
|
-
const response = await this.request(`/sales/carts/${cartId}/checkout`, {
|
|
2701
|
-
method: 'POST',
|
|
2702
|
-
body: JSON.stringify(request)
|
|
2703
|
-
});
|
|
2704
|
-
return response;
|
|
2705
|
-
}
|
|
2706
|
-
};
|
|
2707
|
-
this.salesMyOrders = {
|
|
2708
|
-
list: async () => {
|
|
2709
|
-
const response = await this.request(`/sales/my-orders`, {
|
|
2710
|
-
method: 'GET'
|
|
2711
|
-
});
|
|
2712
|
-
return response.orders;
|
|
2713
|
-
}
|
|
2714
|
-
};
|
|
2715
|
-
this.salesOrders = {
|
|
2716
|
-
get: async (orderId) => {
|
|
2717
|
-
const response = await this.request(`/sales/orders/${orderId}`, {
|
|
2718
|
-
method: 'GET'
|
|
2719
|
-
});
|
|
2720
|
-
return response.order;
|
|
2721
|
-
},
|
|
2722
|
-
ticketPdf: async (orderId, passId) => {
|
|
2723
|
-
const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
|
|
2724
|
-
method: 'GET'
|
|
2725
|
-
});
|
|
2726
|
-
return response;
|
|
2727
|
-
}
|
|
2728
|
-
};
|
|
2729
|
-
this.salesOrderPayments = {
|
|
2730
|
-
create: async (orderId, request) => {
|
|
2731
|
-
const response = await this.request(`/sales/orders/${orderId}/payments`, {
|
|
2732
|
-
method: 'POST',
|
|
2733
|
-
body: JSON.stringify(request)
|
|
2734
|
-
});
|
|
2735
|
-
return response.payment;
|
|
2736
|
-
},
|
|
2737
|
-
confirmSandbox: async (orderId, paymentId, request) => {
|
|
2738
|
-
const response = await this.request(`/sales/orders/${orderId}/payments/${paymentId}/sandbox/confirm`, {
|
|
2739
|
-
method: 'POST',
|
|
2740
|
-
body: JSON.stringify(request)
|
|
2741
|
-
});
|
|
2742
|
-
return response.confirmation;
|
|
2743
|
-
}
|
|
2744
|
-
};
|
|
2745
|
-
this.salesRefundRequests = {
|
|
2746
|
-
create: async (orderId, request) => {
|
|
2747
|
-
const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
|
|
2748
|
-
method: 'POST',
|
|
2749
|
-
body: JSON.stringify(request)
|
|
2750
|
-
});
|
|
2751
|
-
return response.request;
|
|
2752
|
-
}
|
|
2753
|
-
};
|
|
2754
|
-
this.salesCustomers = {
|
|
2755
|
-
create: async (request) => {
|
|
2756
|
-
const response = await this.request(`/sales/customers`, {
|
|
2757
|
-
method: 'POST',
|
|
2758
|
-
body: JSON.stringify(request)
|
|
2759
|
-
});
|
|
2760
|
-
return response.customer;
|
|
2761
|
-
},
|
|
2762
|
-
get: async (customerId) => {
|
|
2763
|
-
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
2764
|
-
method: 'GET'
|
|
2765
|
-
});
|
|
2766
|
-
return response.customer;
|
|
2767
|
-
},
|
|
2768
|
-
update: async (customerId, request) => {
|
|
2769
|
-
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
2770
|
-
method: 'PATCH',
|
|
2771
|
-
body: JSON.stringify(request)
|
|
2772
|
-
});
|
|
2773
|
-
return response.customer;
|
|
2774
|
-
}
|
|
2775
|
-
};
|
|
2776
|
-
this.salesPresaleCodes = {
|
|
2777
|
-
redeem: async (request) => {
|
|
2778
|
-
const response = await this.request(`/sales/presale-codes/redeem`, {
|
|
2779
|
-
method: 'POST',
|
|
2780
|
-
body: JSON.stringify(request)
|
|
2781
|
-
});
|
|
2782
|
-
return response;
|
|
2783
|
-
}
|
|
2784
|
-
};
|
|
2785
2644
|
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
2786
2645
|
this.authMode = config.authMode || 'bearer';
|
|
2787
2646
|
this.accessToken = config.accessToken;
|
|
@@ -2990,14 +2849,19 @@ class BackstageClient {
|
|
|
2990
2849
|
error: { message: response.statusText, code: 'HTTP_ERROR' },
|
|
2991
2850
|
}));
|
|
2992
2851
|
const errorInfo = errorBody.error || errorBody;
|
|
2993
|
-
const
|
|
2852
|
+
const isEnvelope = typeof errorInfo === 'object' && errorInfo !== null;
|
|
2853
|
+
const message = isEnvelope
|
|
2994
2854
|
? (errorInfo.message || 'Request failed')
|
|
2995
2855
|
: String(errorInfo || 'Request failed');
|
|
2996
|
-
const code =
|
|
2856
|
+
const code = isEnvelope
|
|
2997
2857
|
? (errorInfo.code || 'UNKNOWN_ERROR')
|
|
2998
2858
|
: 'UNKNOWN_ERROR';
|
|
2999
|
-
const
|
|
3000
|
-
|
|
2859
|
+
const moreInfo = isEnvelope && typeof errorInfo.moreInfo === 'string' ? errorInfo.moreInfo : undefined;
|
|
2860
|
+
const requestId = (typeof errorBody.metadata?.requestId === 'string' ? errorBody.metadata.requestId : undefined) ??
|
|
2861
|
+
response.headers.get('x-request-id') ??
|
|
2862
|
+
undefined;
|
|
2863
|
+
const error = new BackstageAPIError(message, code, response.status, { moreInfo, requestId });
|
|
2864
|
+
this.debugLog('error', options.method || 'GET', versionedPath, { status: response.status, code, message, requestId });
|
|
3001
2865
|
throw error;
|
|
3002
2866
|
}
|
|
3003
2867
|
const json = await response.json();
|