@ticketlayer/backstage 1.0.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 +1061 -464
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +173 -237
- package/dist/generated/types.d.ts +8575 -6252
- 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';
|
|
@@ -119,6 +121,15 @@ class BackstageClient {
|
|
|
119
121
|
return response;
|
|
120
122
|
}
|
|
121
123
|
};
|
|
124
|
+
this.signup = {
|
|
125
|
+
signUp: async (request) => {
|
|
126
|
+
const response = await this.request(`/signup`, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
body: JSON.stringify(request)
|
|
129
|
+
});
|
|
130
|
+
return response;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
122
133
|
this.me = {
|
|
123
134
|
current: async () => {
|
|
124
135
|
const response = await this.request(`/me`, {
|
|
@@ -419,6 +430,12 @@ class BackstageClient {
|
|
|
419
430
|
body: JSON.stringify(request)
|
|
420
431
|
});
|
|
421
432
|
return response.organisation;
|
|
433
|
+
},
|
|
434
|
+
graduate: async (id) => {
|
|
435
|
+
const response = await this.request(`/organisations/${id}/graduate`, {
|
|
436
|
+
method: 'POST'
|
|
437
|
+
});
|
|
438
|
+
return response;
|
|
422
439
|
}
|
|
423
440
|
};
|
|
424
441
|
this.plan = {
|
|
@@ -553,7 +570,7 @@ class BackstageClient {
|
|
|
553
570
|
const response = await this.request(requestPath, {
|
|
554
571
|
method: 'GET'
|
|
555
572
|
});
|
|
556
|
-
return response
|
|
573
|
+
return response;
|
|
557
574
|
},
|
|
558
575
|
update: async (id, request) => {
|
|
559
576
|
const response = await this.request(`/events/${id}`, {
|
|
@@ -1166,6 +1183,13 @@ class BackstageClient {
|
|
|
1166
1183
|
});
|
|
1167
1184
|
return response;
|
|
1168
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
|
+
},
|
|
1169
1193
|
get: async (customerId) => {
|
|
1170
1194
|
const response = await this.request(`/customers/${customerId}`, {
|
|
1171
1195
|
method: 'GET'
|
|
@@ -1405,7 +1429,7 @@ class BackstageClient {
|
|
|
1405
1429
|
method: 'POST',
|
|
1406
1430
|
body: JSON.stringify(request)
|
|
1407
1431
|
});
|
|
1408
|
-
return response;
|
|
1432
|
+
return response.commandId;
|
|
1409
1433
|
}
|
|
1410
1434
|
};
|
|
1411
1435
|
this.payments = {
|
|
@@ -1466,6 +1490,13 @@ class BackstageClient {
|
|
|
1466
1490
|
method: 'GET'
|
|
1467
1491
|
});
|
|
1468
1492
|
return response.refunds;
|
|
1493
|
+
},
|
|
1494
|
+
confirmSandbox: async (paymentId, request) => {
|
|
1495
|
+
const response = await this.request(`/payments/${paymentId}/sandbox/confirm`, {
|
|
1496
|
+
method: 'POST',
|
|
1497
|
+
body: JSON.stringify(request)
|
|
1498
|
+
});
|
|
1499
|
+
return response;
|
|
1469
1500
|
}
|
|
1470
1501
|
};
|
|
1471
1502
|
this.paymentProviders = {
|
|
@@ -1485,13 +1516,13 @@ class BackstageClient {
|
|
|
1485
1516
|
const response = await this.request(requestPath, {
|
|
1486
1517
|
method: 'GET'
|
|
1487
1518
|
});
|
|
1488
|
-
return response;
|
|
1519
|
+
return response.status;
|
|
1489
1520
|
},
|
|
1490
1521
|
createTicketlayerPayOnboardingSession: async () => {
|
|
1491
1522
|
const response = await this.request(`/payment-providers/ticketlayer-pay/onboarding-session`, {
|
|
1492
1523
|
method: 'POST'
|
|
1493
1524
|
});
|
|
1494
|
-
return response;
|
|
1525
|
+
return response.session;
|
|
1495
1526
|
},
|
|
1496
1527
|
createTicketlayerPayOnboardingLink: async (request) => {
|
|
1497
1528
|
const response = await this.request(`/payment-providers/ticketlayer-pay/onboarding-link`, {
|
|
@@ -1511,13 +1542,13 @@ class BackstageClient {
|
|
|
1511
1542
|
const response = await this.request(`/payment-providers/stripe-connect`, {
|
|
1512
1543
|
method: 'GET'
|
|
1513
1544
|
});
|
|
1514
|
-
return response;
|
|
1545
|
+
return response.provider;
|
|
1515
1546
|
},
|
|
1516
1547
|
listAccounts: async (providerId) => {
|
|
1517
1548
|
const response = await this.request(`/payment-providers/${providerId}/accounts`, {
|
|
1518
1549
|
method: 'GET'
|
|
1519
1550
|
});
|
|
1520
|
-
return response;
|
|
1551
|
+
return response.accounts;
|
|
1521
1552
|
},
|
|
1522
1553
|
getAccount: async (providerId, accountId, options) => {
|
|
1523
1554
|
const params = new URLSearchParams();
|
|
@@ -1528,20 +1559,20 @@ class BackstageClient {
|
|
|
1528
1559
|
const response = await this.request(requestPath, {
|
|
1529
1560
|
method: 'GET'
|
|
1530
1561
|
});
|
|
1531
|
-
return response;
|
|
1562
|
+
return response.account;
|
|
1532
1563
|
},
|
|
1533
1564
|
setAccountMode: async (providerId, accountId, request) => {
|
|
1534
1565
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}`, {
|
|
1535
1566
|
method: 'PUT',
|
|
1536
1567
|
body: JSON.stringify(request)
|
|
1537
1568
|
});
|
|
1538
|
-
return response;
|
|
1569
|
+
return response.account;
|
|
1539
1570
|
},
|
|
1540
1571
|
createAccountOnboardingSession: async (providerId, accountId) => {
|
|
1541
1572
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}/onboarding-session`, {
|
|
1542
1573
|
method: 'POST'
|
|
1543
1574
|
});
|
|
1544
|
-
return response;
|
|
1575
|
+
return response.session;
|
|
1545
1576
|
},
|
|
1546
1577
|
createAccountOnboardingLink: async (providerId, accountId, request) => {
|
|
1547
1578
|
const response = await this.request(`/payment-providers/${providerId}/accounts/${accountId}/onboarding-link`, {
|
|
@@ -1652,6 +1683,13 @@ class BackstageClient {
|
|
|
1652
1683
|
});
|
|
1653
1684
|
return response.listings;
|
|
1654
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
|
+
},
|
|
1655
1693
|
delete: async (listingId) => {
|
|
1656
1694
|
const response = await this.request(`/sales-channels/${channelId}/listings/${listingId}`, {
|
|
1657
1695
|
method: 'DELETE'
|
|
@@ -1659,39 +1697,25 @@ class BackstageClient {
|
|
|
1659
1697
|
return response.deleted;
|
|
1660
1698
|
}
|
|
1661
1699
|
},
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1665
|
-
method: 'POST',
|
|
1666
|
-
body: JSON.stringify(request)
|
|
1667
|
-
});
|
|
1668
|
-
return response;
|
|
1669
|
-
},
|
|
1670
|
-
get: async (cartId) => {
|
|
1671
|
-
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`, {
|
|
1672
1703
|
method: 'GET'
|
|
1673
1704
|
});
|
|
1674
|
-
return response;
|
|
1705
|
+
return response.access;
|
|
1675
1706
|
},
|
|
1676
|
-
|
|
1677
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1707
|
+
grant: async (request) => {
|
|
1708
|
+
const response = await this.request(`/sales-channels/${channelId}/access`, {
|
|
1678
1709
|
method: 'POST',
|
|
1679
1710
|
body: JSON.stringify(request)
|
|
1680
1711
|
});
|
|
1681
|
-
return response;
|
|
1712
|
+
return response.access;
|
|
1682
1713
|
},
|
|
1683
|
-
|
|
1684
|
-
const response = await this.request(`/sales-channels/${channelId}/
|
|
1714
|
+
revoke: async (accessId) => {
|
|
1715
|
+
const response = await this.request(`/sales-channels/${channelId}/access/${accessId}`, {
|
|
1685
1716
|
method: 'DELETE'
|
|
1686
1717
|
});
|
|
1687
|
-
return response;
|
|
1688
|
-
},
|
|
1689
|
-
checkout: async (cartId, request) => {
|
|
1690
|
-
const response = await this.request(`/sales-channels/${channelId}/carts/${cartId}/checkout`, {
|
|
1691
|
-
method: 'POST',
|
|
1692
|
-
body: JSON.stringify(request)
|
|
1693
|
-
});
|
|
1694
|
-
return response;
|
|
1718
|
+
return response.deleted;
|
|
1695
1719
|
}
|
|
1696
1720
|
}
|
|
1697
1721
|
}), {
|
|
@@ -1727,19 +1751,48 @@ class BackstageClient {
|
|
|
1727
1751
|
});
|
|
1728
1752
|
return response.deleted;
|
|
1729
1753
|
},
|
|
1730
|
-
|
|
1731
|
-
const response = await this.request(`/sales-channels
|
|
1754
|
+
mySalesChannels: async () => {
|
|
1755
|
+
const response = await this.request(`/my/sales-channels`, {
|
|
1732
1756
|
method: 'GET'
|
|
1733
1757
|
});
|
|
1734
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;
|
|
1735
1768
|
},
|
|
1736
|
-
|
|
1737
|
-
const response = await this.request(`/
|
|
1769
|
+
get: async (cartId) => {
|
|
1770
|
+
const response = await this.request(`/cart/${cartId}`, {
|
|
1738
1771
|
method: 'GET'
|
|
1739
1772
|
});
|
|
1740
|
-
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;
|
|
1741
1794
|
}
|
|
1742
|
-
}
|
|
1795
|
+
};
|
|
1743
1796
|
this.presaleCodes = {
|
|
1744
1797
|
create: async (request) => {
|
|
1745
1798
|
const response = await this.request(`/presale-codes`, {
|
|
@@ -1893,39 +1946,39 @@ class BackstageClient {
|
|
|
1893
1946
|
method: 'POST',
|
|
1894
1947
|
body: JSON.stringify(request)
|
|
1895
1948
|
});
|
|
1896
|
-
return response;
|
|
1949
|
+
return response.scanConfig;
|
|
1897
1950
|
},
|
|
1898
1951
|
list: async () => {
|
|
1899
1952
|
const response = await this.request(`/scan-configs`, {
|
|
1900
1953
|
method: 'GET'
|
|
1901
1954
|
});
|
|
1902
|
-
return response;
|
|
1955
|
+
return response.scanConfigs;
|
|
1903
1956
|
},
|
|
1904
1957
|
get: async (configId) => {
|
|
1905
1958
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1906
1959
|
method: 'GET'
|
|
1907
1960
|
});
|
|
1908
|
-
return response;
|
|
1961
|
+
return response.scanConfig;
|
|
1909
1962
|
},
|
|
1910
1963
|
update: async (configId, request) => {
|
|
1911
1964
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1912
1965
|
method: 'PATCH',
|
|
1913
1966
|
body: JSON.stringify(request)
|
|
1914
1967
|
});
|
|
1915
|
-
return response;
|
|
1968
|
+
return response.scanConfig;
|
|
1916
1969
|
},
|
|
1917
1970
|
delete: async (configId) => {
|
|
1918
1971
|
const response = await this.request(`/scan-configs/${configId}`, {
|
|
1919
1972
|
method: 'DELETE'
|
|
1920
1973
|
});
|
|
1921
|
-
return response;
|
|
1974
|
+
return response.deleted;
|
|
1922
1975
|
},
|
|
1923
1976
|
setDevices: async (configId, request) => {
|
|
1924
1977
|
const response = await this.request(`/scan-configs/${configId}/devices`, {
|
|
1925
1978
|
method: 'PUT',
|
|
1926
1979
|
body: JSON.stringify(request)
|
|
1927
1980
|
});
|
|
1928
|
-
return response;
|
|
1981
|
+
return response.deviceIds;
|
|
1929
1982
|
}
|
|
1930
1983
|
};
|
|
1931
1984
|
this.scan = {
|
|
@@ -1933,7 +1986,7 @@ class BackstageClient {
|
|
|
1933
1986
|
const response = await this.request(`/scan/config`, {
|
|
1934
1987
|
method: 'GET'
|
|
1935
1988
|
});
|
|
1936
|
-
return response;
|
|
1989
|
+
return response.scanConfig;
|
|
1937
1990
|
},
|
|
1938
1991
|
manifest: async (options) => {
|
|
1939
1992
|
const params = new URLSearchParams();
|
|
@@ -1951,7 +2004,7 @@ class BackstageClient {
|
|
|
1951
2004
|
method: 'POST',
|
|
1952
2005
|
body: JSON.stringify(request)
|
|
1953
2006
|
});
|
|
1954
|
-
return response;
|
|
2007
|
+
return response.results;
|
|
1955
2008
|
}
|
|
1956
2009
|
};
|
|
1957
2010
|
this.scans = {
|
|
@@ -1976,14 +2029,14 @@ class BackstageClient {
|
|
|
1976
2029
|
const response = await this.request(requestPath, {
|
|
1977
2030
|
method: 'GET'
|
|
1978
2031
|
});
|
|
1979
|
-
return response;
|
|
2032
|
+
return response.scans;
|
|
1980
2033
|
},
|
|
1981
2034
|
reverse: async (redemptionId, request) => {
|
|
1982
2035
|
const response = await this.request(`/redemptions/${redemptionId}/reverse`, {
|
|
1983
2036
|
method: 'POST',
|
|
1984
2037
|
body: JSON.stringify(request)
|
|
1985
2038
|
});
|
|
1986
|
-
return response;
|
|
2039
|
+
return response.redemption;
|
|
1987
2040
|
}
|
|
1988
2041
|
};
|
|
1989
2042
|
this.assets = {
|
|
@@ -2059,7 +2112,7 @@ class BackstageClient {
|
|
|
2059
2112
|
method: 'POST',
|
|
2060
2113
|
body: JSON.stringify(request)
|
|
2061
2114
|
});
|
|
2062
|
-
return response;
|
|
2115
|
+
return response.status;
|
|
2063
2116
|
}
|
|
2064
2117
|
};
|
|
2065
2118
|
this.deviceAuth = {
|
|
@@ -2096,7 +2149,7 @@ class BackstageClient {
|
|
|
2096
2149
|
method: 'PUT',
|
|
2097
2150
|
body: JSON.stringify(request)
|
|
2098
2151
|
});
|
|
2099
|
-
return response;
|
|
2152
|
+
return response.peripherals;
|
|
2100
2153
|
},
|
|
2101
2154
|
fetchCommands: async (options) => {
|
|
2102
2155
|
const params = new URLSearchParams();
|
|
@@ -2107,28 +2160,28 @@ class BackstageClient {
|
|
|
2107
2160
|
const response = await this.request(requestPath, {
|
|
2108
2161
|
method: 'GET'
|
|
2109
2162
|
});
|
|
2110
|
-
return response;
|
|
2163
|
+
return response.commands;
|
|
2111
2164
|
},
|
|
2112
2165
|
reportProgress: async (commandId, request) => {
|
|
2113
2166
|
const response = await this.request(`/devices/me/commands/${commandId}/progress`, {
|
|
2114
2167
|
method: 'POST',
|
|
2115
2168
|
body: JSON.stringify(request)
|
|
2116
2169
|
});
|
|
2117
|
-
return response;
|
|
2170
|
+
return response.ok;
|
|
2118
2171
|
},
|
|
2119
2172
|
reportResult: async (commandId, request) => {
|
|
2120
2173
|
const response = await this.request(`/devices/me/commands/${commandId}/result`, {
|
|
2121
2174
|
method: 'POST',
|
|
2122
2175
|
body: JSON.stringify(request)
|
|
2123
2176
|
});
|
|
2124
|
-
return response;
|
|
2177
|
+
return response.status;
|
|
2125
2178
|
},
|
|
2126
2179
|
ingestEvents: async (request) => {
|
|
2127
2180
|
const response = await this.request(`/devices/me/events`, {
|
|
2128
2181
|
method: 'POST',
|
|
2129
2182
|
body: JSON.stringify(request)
|
|
2130
2183
|
});
|
|
2131
|
-
return response;
|
|
2184
|
+
return response.results;
|
|
2132
2185
|
},
|
|
2133
2186
|
getCertificate: async () => {
|
|
2134
2187
|
const response = await this.request(`/devices/me/certificate`, {
|
|
@@ -2142,7 +2195,7 @@ class BackstageClient {
|
|
|
2142
2195
|
const response = await this.request(`/devices/printers`, {
|
|
2143
2196
|
method: 'GET'
|
|
2144
2197
|
});
|
|
2145
|
-
return response;
|
|
2198
|
+
return response.printers;
|
|
2146
2199
|
},
|
|
2147
2200
|
mediaCatalog: async () => {
|
|
2148
2201
|
const response = await this.request(`/devices/media-catalog`, {
|
|
@@ -2154,7 +2207,7 @@ class BackstageClient {
|
|
|
2154
2207
|
const response = await this.request(`/devices/commands/${commandId}`, {
|
|
2155
2208
|
method: 'GET'
|
|
2156
2209
|
});
|
|
2157
|
-
return response;
|
|
2210
|
+
return response.command;
|
|
2158
2211
|
},
|
|
2159
2212
|
list: async (options) => {
|
|
2160
2213
|
const params = new URLSearchParams();
|
|
@@ -2173,39 +2226,39 @@ class BackstageClient {
|
|
|
2173
2226
|
const response = await this.request(requestPath, {
|
|
2174
2227
|
method: 'GET'
|
|
2175
2228
|
});
|
|
2176
|
-
return response;
|
|
2229
|
+
return response.devices;
|
|
2177
2230
|
},
|
|
2178
2231
|
get: async (deviceId) => {
|
|
2179
2232
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2180
2233
|
method: 'GET'
|
|
2181
2234
|
});
|
|
2182
|
-
return response;
|
|
2235
|
+
return response.device;
|
|
2183
2236
|
},
|
|
2184
2237
|
update: async (deviceId, request) => {
|
|
2185
2238
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2186
2239
|
method: 'PATCH',
|
|
2187
2240
|
body: JSON.stringify(request)
|
|
2188
2241
|
});
|
|
2189
|
-
return response;
|
|
2242
|
+
return response.device;
|
|
2190
2243
|
},
|
|
2191
2244
|
delete: async (deviceId) => {
|
|
2192
2245
|
const response = await this.request(`/devices/${deviceId}`, {
|
|
2193
2246
|
method: 'DELETE'
|
|
2194
2247
|
});
|
|
2195
|
-
return response;
|
|
2248
|
+
return response.deleted;
|
|
2196
2249
|
},
|
|
2197
2250
|
revoke: async (deviceId) => {
|
|
2198
2251
|
const response = await this.request(`/devices/${deviceId}/revoke`, {
|
|
2199
2252
|
method: 'POST'
|
|
2200
2253
|
});
|
|
2201
|
-
return response;
|
|
2254
|
+
return response.device;
|
|
2202
2255
|
},
|
|
2203
2256
|
assignRoles: async (deviceId, request) => {
|
|
2204
2257
|
const response = await this.request(`/devices/${deviceId}/roles`, {
|
|
2205
2258
|
method: 'PUT',
|
|
2206
2259
|
body: JSON.stringify(request)
|
|
2207
2260
|
});
|
|
2208
|
-
return response;
|
|
2261
|
+
return response.roles;
|
|
2209
2262
|
},
|
|
2210
2263
|
rotateCredential: async (deviceId, request) => {
|
|
2211
2264
|
const response = await this.request(`/devices/${deviceId}/credentials/rotate`, {
|
|
@@ -2219,19 +2272,19 @@ class BackstageClient {
|
|
|
2219
2272
|
method: 'POST',
|
|
2220
2273
|
body: JSON.stringify(request)
|
|
2221
2274
|
});
|
|
2222
|
-
return response;
|
|
2275
|
+
return response.command;
|
|
2223
2276
|
},
|
|
2224
2277
|
listCommands: async (deviceId) => {
|
|
2225
2278
|
const response = await this.request(`/devices/${deviceId}/commands`, {
|
|
2226
2279
|
method: 'GET'
|
|
2227
2280
|
});
|
|
2228
|
-
return response;
|
|
2281
|
+
return response.commands;
|
|
2229
2282
|
},
|
|
2230
2283
|
listEvents: async (deviceId) => {
|
|
2231
2284
|
const response = await this.request(`/devices/${deviceId}/events`, {
|
|
2232
2285
|
method: 'GET'
|
|
2233
2286
|
});
|
|
2234
|
-
return response;
|
|
2287
|
+
return response.events;
|
|
2235
2288
|
},
|
|
2236
2289
|
mintLocalToken: async (deviceId, request) => {
|
|
2237
2290
|
const response = await this.request(`/devices/${deviceId}/local-tokens`, {
|
|
@@ -2247,32 +2300,32 @@ class BackstageClient {
|
|
|
2247
2300
|
method: 'POST',
|
|
2248
2301
|
body: JSON.stringify(request)
|
|
2249
2302
|
});
|
|
2250
|
-
return response;
|
|
2303
|
+
return response.location;
|
|
2251
2304
|
},
|
|
2252
2305
|
list: async () => {
|
|
2253
2306
|
const response = await this.request(`/locations`, {
|
|
2254
2307
|
method: 'GET'
|
|
2255
2308
|
});
|
|
2256
|
-
return response;
|
|
2309
|
+
return response.locations;
|
|
2257
2310
|
},
|
|
2258
2311
|
get: async (locationId) => {
|
|
2259
2312
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2260
2313
|
method: 'GET'
|
|
2261
2314
|
});
|
|
2262
|
-
return response;
|
|
2315
|
+
return response.location;
|
|
2263
2316
|
},
|
|
2264
2317
|
update: async (locationId, request) => {
|
|
2265
2318
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2266
2319
|
method: 'PATCH',
|
|
2267
2320
|
body: JSON.stringify(request)
|
|
2268
2321
|
});
|
|
2269
|
-
return response;
|
|
2322
|
+
return response.location;
|
|
2270
2323
|
},
|
|
2271
2324
|
delete: async (locationId) => {
|
|
2272
2325
|
const response = await this.request(`/locations/${locationId}`, {
|
|
2273
2326
|
method: 'DELETE'
|
|
2274
2327
|
});
|
|
2275
|
-
return response;
|
|
2328
|
+
return response.deleted;
|
|
2276
2329
|
}
|
|
2277
2330
|
};
|
|
2278
2331
|
this.reports = {
|
|
@@ -2443,26 +2496,26 @@ class BackstageClient {
|
|
|
2443
2496
|
const response = await this.request(requestPath, {
|
|
2444
2497
|
method: 'GET'
|
|
2445
2498
|
});
|
|
2446
|
-
return response;
|
|
2499
|
+
return response.endpoints;
|
|
2447
2500
|
},
|
|
2448
2501
|
get: async (endpointId) => {
|
|
2449
2502
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2450
2503
|
method: 'GET'
|
|
2451
2504
|
});
|
|
2452
|
-
return response;
|
|
2505
|
+
return response.endpoint;
|
|
2453
2506
|
},
|
|
2454
2507
|
update: async (endpointId, request) => {
|
|
2455
2508
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2456
2509
|
method: 'PATCH',
|
|
2457
2510
|
body: JSON.stringify(request)
|
|
2458
2511
|
});
|
|
2459
|
-
return response;
|
|
2512
|
+
return response.endpoint;
|
|
2460
2513
|
},
|
|
2461
2514
|
delete: async (endpointId) => {
|
|
2462
2515
|
const response = await this.request(`/webhook-endpoints/${endpointId}`, {
|
|
2463
2516
|
method: 'DELETE'
|
|
2464
2517
|
});
|
|
2465
|
-
return response;
|
|
2518
|
+
return response.deleted;
|
|
2466
2519
|
},
|
|
2467
2520
|
test: async (endpointId) => {
|
|
2468
2521
|
const response = await this.request(`/webhook-endpoints/${endpointId}/test`, {
|
|
@@ -2483,19 +2536,19 @@ class BackstageClient {
|
|
|
2483
2536
|
const response = await this.request(requestPath, {
|
|
2484
2537
|
method: 'GET'
|
|
2485
2538
|
});
|
|
2486
|
-
return response;
|
|
2539
|
+
return response.deliveries;
|
|
2487
2540
|
},
|
|
2488
2541
|
get: async (deliveryId) => {
|
|
2489
2542
|
const response = await this.request(`/webhook-deliveries/${deliveryId}`, {
|
|
2490
2543
|
method: 'GET'
|
|
2491
2544
|
});
|
|
2492
|
-
return response;
|
|
2545
|
+
return response.delivery;
|
|
2493
2546
|
},
|
|
2494
2547
|
listInbound: async () => {
|
|
2495
2548
|
const response = await this.request(`/webhook-inbound`, {
|
|
2496
2549
|
method: 'GET'
|
|
2497
2550
|
});
|
|
2498
|
-
return response;
|
|
2551
|
+
return response.events;
|
|
2499
2552
|
}
|
|
2500
2553
|
};
|
|
2501
2554
|
this.webhookEventTypes = {
|
|
@@ -2503,7 +2556,7 @@ class BackstageClient {
|
|
|
2503
2556
|
const response = await this.request(`/webhook-event-types`, {
|
|
2504
2557
|
method: 'GET'
|
|
2505
2558
|
});
|
|
2506
|
-
return response;
|
|
2559
|
+
return response.eventTypes;
|
|
2507
2560
|
}
|
|
2508
2561
|
};
|
|
2509
2562
|
this.integrations = {
|
|
@@ -2517,19 +2570,19 @@ class BackstageClient {
|
|
|
2517
2570
|
const response = await this.request(`/integrations/connected-apps`, {
|
|
2518
2571
|
method: 'GET'
|
|
2519
2572
|
});
|
|
2520
|
-
return response;
|
|
2573
|
+
return response.connectedApps;
|
|
2521
2574
|
},
|
|
2522
2575
|
get: async (id) => {
|
|
2523
2576
|
const response = await this.request(`/integrations/${id}`, {
|
|
2524
2577
|
method: 'GET'
|
|
2525
2578
|
});
|
|
2526
|
-
return response;
|
|
2579
|
+
return response.integration;
|
|
2527
2580
|
},
|
|
2528
2581
|
revokeConnection: async (id) => {
|
|
2529
2582
|
const response = await this.request(`/integrations/${id}/connection`, {
|
|
2530
2583
|
method: 'DELETE'
|
|
2531
2584
|
});
|
|
2532
|
-
return response;
|
|
2585
|
+
return response.revoked;
|
|
2533
2586
|
}
|
|
2534
2587
|
};
|
|
2535
2588
|
this.clientVersions = {
|
|
@@ -2545,165 +2598,43 @@ class BackstageClient {
|
|
|
2545
2598
|
return response.clientVersions;
|
|
2546
2599
|
}
|
|
2547
2600
|
};
|
|
2548
|
-
this.
|
|
2549
|
-
|
|
2601
|
+
this.ledger = {
|
|
2602
|
+
balances: async (options) => {
|
|
2550
2603
|
const params = new URLSearchParams();
|
|
2551
|
-
if (options?.
|
|
2552
|
-
params.append('
|
|
2553
|
-
if (options?.
|
|
2554
|
-
params.append('
|
|
2604
|
+
if (options?.accountId !== undefined)
|
|
2605
|
+
params.append('accountId', String(options.accountId));
|
|
2606
|
+
if (options?.currency !== undefined)
|
|
2607
|
+
params.append('currency', String(options.currency));
|
|
2608
|
+
if (options?.asOf !== undefined)
|
|
2609
|
+
params.append('asOf', String(options.asOf));
|
|
2555
2610
|
const queryString = params.toString();
|
|
2556
|
-
const requestPath = queryString ? `/
|
|
2611
|
+
const requestPath = queryString ? `/ledger/balances?${queryString}` : `/ledger/balances`;
|
|
2557
2612
|
const response = await this.request(requestPath, {
|
|
2558
2613
|
method: 'GET'
|
|
2559
2614
|
});
|
|
2560
|
-
return response;
|
|
2615
|
+
return response.balances;
|
|
2561
2616
|
},
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
const response = await this.request(`/sales/customer-auth/magic-link`, {
|
|
2578
|
-
method: 'POST',
|
|
2579
|
-
body: JSON.stringify(request)
|
|
2580
|
-
});
|
|
2581
|
-
return response.sent;
|
|
2582
|
-
}
|
|
2583
|
-
};
|
|
2584
|
-
this.salesCustomerTokens = {
|
|
2585
|
-
create: async (request) => {
|
|
2586
|
-
const response = await this.request(`/sales/customer-tokens`, {
|
|
2587
|
-
method: 'POST',
|
|
2588
|
-
body: JSON.stringify(request)
|
|
2589
|
-
});
|
|
2590
|
-
return response;
|
|
2591
|
-
},
|
|
2592
|
-
refresh: async () => {
|
|
2593
|
-
const response = await this.request(`/sales/customer-tokens/refresh`, {
|
|
2594
|
-
method: 'POST'
|
|
2595
|
-
});
|
|
2596
|
-
return response;
|
|
2597
|
-
}
|
|
2598
|
-
};
|
|
2599
|
-
this.salesListings = {
|
|
2600
|
-
list: async () => {
|
|
2601
|
-
const response = await this.request(`/sales/listings`, {
|
|
2602
|
-
method: 'GET'
|
|
2603
|
-
});
|
|
2604
|
-
return response;
|
|
2605
|
-
}
|
|
2606
|
-
};
|
|
2607
|
-
this.salesCarts = {
|
|
2608
|
-
create: async (request) => {
|
|
2609
|
-
const response = await this.request(`/sales/carts`, {
|
|
2610
|
-
method: 'POST',
|
|
2611
|
-
body: JSON.stringify(request)
|
|
2612
|
-
});
|
|
2613
|
-
return response.cart;
|
|
2614
|
-
},
|
|
2615
|
-
get: async (cartId) => {
|
|
2616
|
-
const response = await this.request(`/sales/carts/${cartId}`, {
|
|
2617
|
-
method: 'GET'
|
|
2618
|
-
});
|
|
2619
|
-
return response.cart;
|
|
2620
|
-
},
|
|
2621
|
-
addItem: async (cartId, request) => {
|
|
2622
|
-
const response = await this.request(`/sales/carts/${cartId}/items`, {
|
|
2623
|
-
method: 'POST',
|
|
2624
|
-
body: JSON.stringify(request)
|
|
2625
|
-
});
|
|
2626
|
-
return response.cart;
|
|
2627
|
-
},
|
|
2628
|
-
removeItem: async (cartId, itemId) => {
|
|
2629
|
-
const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
|
|
2630
|
-
method: 'DELETE'
|
|
2631
|
-
});
|
|
2632
|
-
return response.cart;
|
|
2633
|
-
},
|
|
2634
|
-
checkout: async (cartId, request) => {
|
|
2635
|
-
const response = await this.request(`/sales/carts/${cartId}/checkout`, {
|
|
2636
|
-
method: 'POST',
|
|
2637
|
-
body: JSON.stringify(request)
|
|
2638
|
-
});
|
|
2639
|
-
return response;
|
|
2640
|
-
}
|
|
2641
|
-
};
|
|
2642
|
-
this.salesMyOrders = {
|
|
2643
|
-
list: async () => {
|
|
2644
|
-
const response = await this.request(`/sales/my-orders`, {
|
|
2645
|
-
method: 'GET'
|
|
2646
|
-
});
|
|
2647
|
-
return response.orders;
|
|
2648
|
-
}
|
|
2649
|
-
};
|
|
2650
|
-
this.salesOrders = {
|
|
2651
|
-
get: async (orderId) => {
|
|
2652
|
-
const response = await this.request(`/sales/orders/${orderId}`, {
|
|
2653
|
-
method: 'GET'
|
|
2654
|
-
});
|
|
2655
|
-
return response.order;
|
|
2656
|
-
},
|
|
2657
|
-
ticketPdf: async (orderId, passId) => {
|
|
2658
|
-
const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
|
|
2659
|
-
method: 'GET'
|
|
2660
|
-
});
|
|
2661
|
-
return response;
|
|
2662
|
-
}
|
|
2663
|
-
};
|
|
2664
|
-
this.salesOrderPayments = {
|
|
2665
|
-
create: async (orderId, request) => {
|
|
2666
|
-
const response = await this.request(`/sales/orders/${orderId}/payments`, {
|
|
2667
|
-
method: 'POST',
|
|
2668
|
-
body: JSON.stringify(request)
|
|
2669
|
-
});
|
|
2670
|
-
return response.payment;
|
|
2671
|
-
}
|
|
2672
|
-
};
|
|
2673
|
-
this.salesRefundRequests = {
|
|
2674
|
-
create: async (orderId, request) => {
|
|
2675
|
-
const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
|
|
2676
|
-
method: 'POST',
|
|
2677
|
-
body: JSON.stringify(request)
|
|
2678
|
-
});
|
|
2679
|
-
return response.request;
|
|
2680
|
-
}
|
|
2681
|
-
};
|
|
2682
|
-
this.salesCustomers = {
|
|
2683
|
-
create: async (request) => {
|
|
2684
|
-
const response = await this.request(`/sales/customers`, {
|
|
2685
|
-
method: 'POST',
|
|
2686
|
-
body: JSON.stringify(request)
|
|
2687
|
-
});
|
|
2688
|
-
return response.customer;
|
|
2689
|
-
},
|
|
2690
|
-
get: async (customerId) => {
|
|
2691
|
-
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
2617
|
+
statement: async (options) => {
|
|
2618
|
+
const params = new URLSearchParams();
|
|
2619
|
+
if (options?.accountId !== undefined)
|
|
2620
|
+
params.append('accountId', String(options.accountId));
|
|
2621
|
+
if (options?.counterpartyAccountId !== undefined)
|
|
2622
|
+
params.append('counterpartyAccountId', String(options.counterpartyAccountId));
|
|
2623
|
+
if (options?.currency !== undefined)
|
|
2624
|
+
params.append('currency', String(options.currency));
|
|
2625
|
+
if (options?.from !== undefined)
|
|
2626
|
+
params.append('from', String(options.from));
|
|
2627
|
+
if (options?.to !== undefined)
|
|
2628
|
+
params.append('to', String(options.to));
|
|
2629
|
+
const queryString = params.toString();
|
|
2630
|
+
const requestPath = queryString ? `/ledger/statement?${queryString}` : `/ledger/statement`;
|
|
2631
|
+
const response = await this.request(requestPath, {
|
|
2692
2632
|
method: 'GET'
|
|
2693
2633
|
});
|
|
2694
|
-
return response.
|
|
2634
|
+
return response.statement;
|
|
2695
2635
|
},
|
|
2696
|
-
|
|
2697
|
-
const response = await this.request(`/
|
|
2698
|
-
method: 'PATCH',
|
|
2699
|
-
body: JSON.stringify(request)
|
|
2700
|
-
});
|
|
2701
|
-
return response.customer;
|
|
2702
|
-
}
|
|
2703
|
-
};
|
|
2704
|
-
this.salesPresaleCodes = {
|
|
2705
|
-
redeem: async (request) => {
|
|
2706
|
-
const response = await this.request(`/sales/presale-codes/redeem`, {
|
|
2636
|
+
createSettlement: async (request) => {
|
|
2637
|
+
const response = await this.request(`/ledger/settlements`, {
|
|
2707
2638
|
method: 'POST',
|
|
2708
2639
|
body: JSON.stringify(request)
|
|
2709
2640
|
});
|
|
@@ -2918,14 +2849,19 @@ class BackstageClient {
|
|
|
2918
2849
|
error: { message: response.statusText, code: 'HTTP_ERROR' },
|
|
2919
2850
|
}));
|
|
2920
2851
|
const errorInfo = errorBody.error || errorBody;
|
|
2921
|
-
const
|
|
2852
|
+
const isEnvelope = typeof errorInfo === 'object' && errorInfo !== null;
|
|
2853
|
+
const message = isEnvelope
|
|
2922
2854
|
? (errorInfo.message || 'Request failed')
|
|
2923
2855
|
: String(errorInfo || 'Request failed');
|
|
2924
|
-
const code =
|
|
2856
|
+
const code = isEnvelope
|
|
2925
2857
|
? (errorInfo.code || 'UNKNOWN_ERROR')
|
|
2926
2858
|
: 'UNKNOWN_ERROR';
|
|
2927
|
-
const
|
|
2928
|
-
|
|
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 });
|
|
2929
2865
|
throw error;
|
|
2930
2866
|
}
|
|
2931
2867
|
const json = await response.json();
|