snaptrade-typescript-sdk 13.1.14 → 13.2.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/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import globalAxios from "axios";
1
+ import axios from "axios";
2
2
  //#region base.ts
3
3
  const BASE_PATH = "https://api.snaptrade.com".replace(/\/+$/, "");
4
4
  /**
@@ -7,9 +7,9 @@ const BASE_PATH = "https://api.snaptrade.com".replace(/\/+$/, "");
7
7
  * @class BaseAPI
8
8
  */
9
9
  var BaseAPI = class {
10
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
10
+ constructor(configuration, basePath = BASE_PATH, axios$1 = axios) {
11
11
  this.basePath = basePath;
12
- this.axios = axios;
12
+ this.axios = axios$1;
13
13
  if (configuration) {
14
14
  this.configuration = configuration;
15
15
  this.basePath = configuration.basePath || this.basePath;
@@ -199,6 +199,13 @@ const setApiKeyToObject = async function({ object, key, type, keyParamName, conf
199
199
  object[key] = prefix !== void 0 ? `${prefix}${apiKey}` : apiKey;
200
200
  if (type === "Cookie") object[key] = `${keyParamName}=${object[key]}`;
201
201
  };
202
+ /**
203
+ *
204
+ * @export
205
+ */
206
+ const setBearerAuthToObject = async function(object, configuration) {
207
+ if (configuration && configuration.accessToken) object["Authorization"] = "Bearer " + (typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken);
208
+ };
202
209
  function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
203
210
  if (typeof parameter === "object") if (Array.isArray(parameter)) parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
204
211
  else Object.keys(parameter).forEach((currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`));
@@ -245,7 +252,7 @@ async function wrapAxiosRequest(makeRequest) {
245
252
  while (attempt < maxAttempts) try {
246
253
  return await makeRequest();
247
254
  } catch (e) {
248
- if (globalAxios.isAxiosError(e)) {
255
+ if (axios.isAxiosError(e)) {
249
256
  if (e.response?.status == 429) {
250
257
  attempt++;
251
258
  console.log(`429 error encountered, retrying in ${delay / 1e3} seconds...`);
@@ -353,13 +360,18 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
353
360
  keyParamName: "clientId",
354
361
  configuration
355
362
  });
363
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
356
364
  if (startDate !== void 0) localVarQueryParameter["startDate"] = startDate instanceof Date ? startDate.toISOString().substr(0, 10) : startDate;
357
365
  if (endDate !== void 0) localVarQueryParameter["endDate"] = endDate instanceof Date ? endDate.toISOString().substr(0, 10) : endDate;
358
366
  if (offset !== void 0) localVarQueryParameter["offset"] = offset;
359
367
  if (limit !== void 0) localVarQueryParameter["limit"] = limit;
360
368
  if (type !== void 0) localVarQueryParameter["type"] = type;
361
369
  const localVarOperationAuth = {
362
- authModes: ["commercialApiKey", "personalApiKey"],
370
+ authModes: [
371
+ "commercialApiKey",
372
+ "personalApiKey",
373
+ "oauth"
374
+ ],
363
375
  requestSigningByAuthMode: {
364
376
  "commercialApiKey": {
365
377
  secretParameter: "consumerKey",
@@ -431,8 +443,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
431
443
  keyParamName: "clientId",
432
444
  configuration
433
445
  });
446
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
434
447
  const localVarOperationAuth = {
435
- authModes: ["commercialApiKey", "personalApiKey"],
448
+ authModes: [
449
+ "commercialApiKey",
450
+ "personalApiKey",
451
+ "oauth"
452
+ ],
436
453
  requestSigningByAuthMode: {
437
454
  "commercialApiKey": {
438
455
  secretParameter: "consumerKey",
@@ -577,8 +594,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
577
594
  keyParamName: "clientId",
578
595
  configuration
579
596
  });
597
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
580
598
  const localVarOperationAuth = {
581
- authModes: ["commercialApiKey", "personalApiKey"],
599
+ authModes: [
600
+ "commercialApiKey",
601
+ "personalApiKey",
602
+ "oauth"
603
+ ],
582
604
  requestSigningByAuthMode: {
583
605
  "commercialApiKey": {
584
606
  secretParameter: "consumerKey",
@@ -613,7 +635,7 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
613
635
  };
614
636
  },
615
637
  /**
616
- * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
638
+ * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
617
639
  * @summary List all account positions
618
640
  * @param {string} accountId
619
641
  * @param {string} [userId]
@@ -650,8 +672,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
650
672
  keyParamName: "clientId",
651
673
  configuration
652
674
  });
675
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
653
676
  const localVarOperationAuth = {
654
- authModes: ["commercialApiKey", "personalApiKey"],
677
+ authModes: [
678
+ "commercialApiKey",
679
+ "personalApiKey",
680
+ "oauth"
681
+ ],
655
682
  requestSigningByAuthMode: {
656
683
  "commercialApiKey": {
657
684
  secretParameter: "consumerKey",
@@ -723,8 +750,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
723
750
  keyParamName: "clientId",
724
751
  configuration
725
752
  });
753
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
726
754
  const localVarOperationAuth = {
727
- authModes: ["commercialApiKey", "personalApiKey"],
755
+ authModes: [
756
+ "commercialApiKey",
757
+ "personalApiKey",
758
+ "oauth"
759
+ ],
728
760
  requestSigningByAuthMode: {
729
761
  "commercialApiKey": {
730
762
  secretParameter: "consumerKey",
@@ -797,8 +829,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
797
829
  keyParamName: "clientId",
798
830
  configuration
799
831
  });
832
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
800
833
  const localVarOperationAuth = {
801
- authModes: ["commercialApiKey", "personalApiKey"],
834
+ authModes: [
835
+ "commercialApiKey",
836
+ "personalApiKey",
837
+ "oauth"
838
+ ],
802
839
  requestSigningByAuthMode: {
803
840
  "commercialApiKey": {
804
841
  secretParameter: "consumerKey",
@@ -872,8 +909,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
872
909
  keyParamName: "clientId",
873
910
  configuration
874
911
  });
912
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
875
913
  const localVarOperationAuth = {
876
- authModes: ["commercialApiKey", "personalApiKey"],
914
+ authModes: [
915
+ "commercialApiKey",
916
+ "personalApiKey",
917
+ "oauth"
918
+ ],
877
919
  requestSigningByAuthMode: {
878
920
  "commercialApiKey": {
879
921
  secretParameter: "consumerKey",
@@ -950,10 +992,15 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
950
992
  keyParamName: "clientId",
951
993
  configuration
952
994
  });
995
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
953
996
  if (state !== void 0) localVarQueryParameter["state"] = state;
954
997
  if (days !== void 0) localVarQueryParameter["days"] = days;
955
998
  const localVarOperationAuth = {
956
- authModes: ["commercialApiKey", "personalApiKey"],
999
+ authModes: [
1000
+ "commercialApiKey",
1001
+ "personalApiKey",
1002
+ "oauth"
1003
+ ],
957
1004
  requestSigningByAuthMode: {
958
1005
  "commercialApiKey": {
959
1006
  secretParameter: "consumerKey",
@@ -1026,9 +1073,14 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
1026
1073
  keyParamName: "clientId",
1027
1074
  configuration
1028
1075
  });
1076
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
1029
1077
  if (onlyExecuted !== void 0) localVarQueryParameter["only_executed"] = onlyExecuted;
1030
1078
  const localVarOperationAuth = {
1031
- authModes: ["commercialApiKey", "personalApiKey"],
1079
+ authModes: [
1080
+ "commercialApiKey",
1081
+ "personalApiKey",
1082
+ "oauth"
1083
+ ],
1032
1084
  requestSigningByAuthMode: {
1033
1085
  "commercialApiKey": {
1034
1086
  secretParameter: "consumerKey",
@@ -1176,8 +1228,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
1176
1228
  keyParamName: "clientId",
1177
1229
  configuration
1178
1230
  });
1231
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
1179
1232
  const localVarOperationAuth = {
1180
- authModes: ["commercialApiKey", "personalApiKey"],
1233
+ authModes: [
1234
+ "commercialApiKey",
1235
+ "personalApiKey",
1236
+ "oauth"
1237
+ ],
1181
1238
  requestSigningByAuthMode: {
1182
1239
  "commercialApiKey": {
1183
1240
  secretParameter: "consumerKey",
@@ -1247,8 +1304,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
1247
1304
  keyParamName: "clientId",
1248
1305
  configuration
1249
1306
  });
1307
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
1250
1308
  const localVarOperationAuth = {
1251
- authModes: ["commercialApiKey", "personalApiKey"],
1309
+ authModes: [
1310
+ "commercialApiKey",
1311
+ "personalApiKey",
1312
+ "oauth"
1313
+ ],
1252
1314
  requestSigningByAuthMode: {
1253
1315
  "commercialApiKey": {
1254
1316
  secretParameter: "consumerKey",
@@ -1319,8 +1381,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
1319
1381
  keyParamName: "clientId",
1320
1382
  configuration
1321
1383
  });
1384
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
1322
1385
  const localVarOperationAuth = {
1323
- authModes: ["commercialApiKey", "personalApiKey"],
1386
+ authModes: [
1387
+ "commercialApiKey",
1388
+ "personalApiKey",
1389
+ "oauth"
1390
+ ],
1324
1391
  requestSigningByAuthMode: {
1325
1392
  "commercialApiKey": {
1326
1393
  secretParameter: "consumerKey",
@@ -1392,8 +1459,13 @@ const AccountInformationApiAxiosParamCreator = function(configuration) {
1392
1459
  keyParamName: "clientId",
1393
1460
  configuration
1394
1461
  });
1462
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
1395
1463
  const localVarOperationAuth = {
1396
- authModes: ["commercialApiKey", "personalApiKey"],
1464
+ authModes: [
1465
+ "commercialApiKey",
1466
+ "personalApiKey",
1467
+ "oauth"
1468
+ ],
1397
1469
  requestSigningByAuthMode: {
1398
1470
  "commercialApiKey": {
1399
1471
  secretParameter: "consumerKey",
@@ -1445,8 +1517,12 @@ const AccountInformationApiFp = function(configuration) {
1445
1517
  */
1446
1518
  async getAccountActivities(...args) {
1447
1519
  const [requestParameters = {}, options] = args;
1448
- return createRequestFunction(await localVarAxiosParamCreator.getAccountActivities(requestParameters.accountId, requestParameters.startDate, requestParameters.endDate, requestParameters.offset, requestParameters.limit, requestParameters.type, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1449
- authModes: ["commercialApiKey", "personalApiKey"],
1520
+ return createRequestFunction(await localVarAxiosParamCreator.getAccountActivities(requestParameters.accountId, requestParameters.startDate, requestParameters.endDate, requestParameters.offset, requestParameters.limit, requestParameters.type, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1521
+ authModes: [
1522
+ "commercialApiKey",
1523
+ "personalApiKey",
1524
+ "oauth"
1525
+ ],
1450
1526
  requestSigningByAuthMode: {
1451
1527
  "commercialApiKey": {
1452
1528
  secretParameter: "consumerKey",
@@ -1468,8 +1544,12 @@ const AccountInformationApiFp = function(configuration) {
1468
1544
  */
1469
1545
  async getAccountBalanceHistory(...args) {
1470
1546
  const [requestParameters = {}, options] = args;
1471
- return createRequestFunction(await localVarAxiosParamCreator.getAccountBalanceHistory(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1472
- authModes: ["commercialApiKey", "personalApiKey"],
1547
+ return createRequestFunction(await localVarAxiosParamCreator.getAccountBalanceHistory(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1548
+ authModes: [
1549
+ "commercialApiKey",
1550
+ "personalApiKey",
1551
+ "oauth"
1552
+ ],
1473
1553
  requestSigningByAuthMode: {
1474
1554
  "commercialApiKey": {
1475
1555
  secretParameter: "consumerKey",
@@ -1491,7 +1571,7 @@ const AccountInformationApiFp = function(configuration) {
1491
1571
  */
1492
1572
  async getAccountBalancesV2(...args) {
1493
1573
  const [requestParameters = {}, options] = args;
1494
- return createRequestFunction(await localVarAxiosParamCreator.getAccountBalancesV2(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1574
+ return createRequestFunction(await localVarAxiosParamCreator.getAccountBalancesV2(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1495
1575
  authModes: ["commercialApiKey", "personalApiKey"],
1496
1576
  requestSigningByAuthMode: {
1497
1577
  "commercialApiKey": {
@@ -1514,8 +1594,12 @@ const AccountInformationApiFp = function(configuration) {
1514
1594
  */
1515
1595
  async getAccountDetails(...args) {
1516
1596
  const [requestParameters = {}, options] = args;
1517
- return createRequestFunction(await localVarAxiosParamCreator.getAccountDetails(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1518
- authModes: ["commercialApiKey", "personalApiKey"],
1597
+ return createRequestFunction(await localVarAxiosParamCreator.getAccountDetails(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1598
+ authModes: [
1599
+ "commercialApiKey",
1600
+ "personalApiKey",
1601
+ "oauth"
1602
+ ],
1519
1603
  requestSigningByAuthMode: {
1520
1604
  "commercialApiKey": {
1521
1605
  secretParameter: "consumerKey",
@@ -1529,7 +1613,7 @@ const AccountInformationApiFp = function(configuration) {
1529
1613
  });
1530
1614
  },
1531
1615
  /**
1532
- * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1616
+ * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1533
1617
  * @summary List all account positions
1534
1618
  * @param {AccountInformationApiGetAllAccountPositionsRequest<TAuth>} requestParameters Request parameters.
1535
1619
  * @param {*} [options] Override http request option.
@@ -1537,8 +1621,12 @@ const AccountInformationApiFp = function(configuration) {
1537
1621
  */
1538
1622
  async getAllAccountPositions(...args) {
1539
1623
  const [requestParameters = {}, options] = args;
1540
- return createRequestFunction(await localVarAxiosParamCreator.getAllAccountPositions(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1541
- authModes: ["commercialApiKey", "personalApiKey"],
1624
+ return createRequestFunction(await localVarAxiosParamCreator.getAllAccountPositions(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1625
+ authModes: [
1626
+ "commercialApiKey",
1627
+ "personalApiKey",
1628
+ "oauth"
1629
+ ],
1542
1630
  requestSigningByAuthMode: {
1543
1631
  "commercialApiKey": {
1544
1632
  secretParameter: "consumerKey",
@@ -1560,8 +1648,12 @@ const AccountInformationApiFp = function(configuration) {
1560
1648
  */
1561
1649
  async getUserAccountBalance(...args) {
1562
1650
  const [requestParameters = {}, options] = args;
1563
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountBalance(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1564
- authModes: ["commercialApiKey", "personalApiKey"],
1651
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountBalance(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1652
+ authModes: [
1653
+ "commercialApiKey",
1654
+ "personalApiKey",
1655
+ "oauth"
1656
+ ],
1565
1657
  requestSigningByAuthMode: {
1566
1658
  "commercialApiKey": {
1567
1659
  secretParameter: "consumerKey",
@@ -1584,8 +1676,12 @@ const AccountInformationApiFp = function(configuration) {
1584
1676
  */
1585
1677
  async getUserAccountDetails(...args) {
1586
1678
  const [requestParameters = {}, options] = args;
1587
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountDetails(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1588
- authModes: ["commercialApiKey", "personalApiKey"],
1679
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountDetails(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1680
+ authModes: [
1681
+ "commercialApiKey",
1682
+ "personalApiKey",
1683
+ "oauth"
1684
+ ],
1589
1685
  requestSigningByAuthMode: {
1590
1686
  "commercialApiKey": {
1591
1687
  secretParameter: "consumerKey",
@@ -1608,8 +1704,12 @@ const AccountInformationApiFp = function(configuration) {
1608
1704
  async getUserAccountOrderDetail(...args) {
1609
1705
  const [requestParameters = {}, options] = args;
1610
1706
  const accountInformationGetUserAccountOrderDetailRequest = { brokerage_order_id: requestParameters.brokerage_order_id };
1611
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrderDetail(requestParameters.accountId, accountInformationGetUserAccountOrderDetailRequest, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1612
- authModes: ["commercialApiKey", "personalApiKey"],
1707
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrderDetail(requestParameters.accountId, accountInformationGetUserAccountOrderDetailRequest, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1708
+ authModes: [
1709
+ "commercialApiKey",
1710
+ "personalApiKey",
1711
+ "oauth"
1712
+ ],
1613
1713
  requestSigningByAuthMode: {
1614
1714
  "commercialApiKey": {
1615
1715
  secretParameter: "consumerKey",
@@ -1631,8 +1731,12 @@ const AccountInformationApiFp = function(configuration) {
1631
1731
  */
1632
1732
  async getUserAccountOrders(...args) {
1633
1733
  const [requestParameters = {}, options] = args;
1634
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrders(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1635
- authModes: ["commercialApiKey", "personalApiKey"],
1734
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrders(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1735
+ authModes: [
1736
+ "commercialApiKey",
1737
+ "personalApiKey",
1738
+ "oauth"
1739
+ ],
1636
1740
  requestSigningByAuthMode: {
1637
1741
  "commercialApiKey": {
1638
1742
  secretParameter: "consumerKey",
@@ -1654,8 +1758,12 @@ const AccountInformationApiFp = function(configuration) {
1654
1758
  */
1655
1759
  async getUserAccountRecentOrders(...args) {
1656
1760
  const [requestParameters = {}, options] = args;
1657
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountRecentOrders(requestParameters.accountId, requestParameters.onlyExecuted, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1658
- authModes: ["commercialApiKey", "personalApiKey"],
1761
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountRecentOrders(requestParameters.accountId, requestParameters.onlyExecuted, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1762
+ authModes: [
1763
+ "commercialApiKey",
1764
+ "personalApiKey",
1765
+ "oauth"
1766
+ ],
1659
1767
  requestSigningByAuthMode: {
1660
1768
  "commercialApiKey": {
1661
1769
  secretParameter: "consumerKey",
@@ -1677,7 +1785,7 @@ const AccountInformationApiFp = function(configuration) {
1677
1785
  */
1678
1786
  async getUserAccountReturnRates(...args) {
1679
1787
  const [requestParameters = {}, options] = args;
1680
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountReturnRates(requestParameters.accountId, requestParameters.timeframes, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1788
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountReturnRates(requestParameters.accountId, requestParameters.timeframes, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1681
1789
  authModes: ["commercialApiKey", "personalApiKey"],
1682
1790
  requestSigningByAuthMode: {
1683
1791
  "commercialApiKey": {
@@ -1701,8 +1809,12 @@ const AccountInformationApiFp = function(configuration) {
1701
1809
  */
1702
1810
  async getUserHoldings(...args) {
1703
1811
  const [requestParameters = {}, options] = args;
1704
- return createRequestFunction(await localVarAxiosParamCreator.getUserHoldings(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1705
- authModes: ["commercialApiKey", "personalApiKey"],
1812
+ return createRequestFunction(await localVarAxiosParamCreator.getUserHoldings(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1813
+ authModes: [
1814
+ "commercialApiKey",
1815
+ "personalApiKey",
1816
+ "oauth"
1817
+ ],
1706
1818
  requestSigningByAuthMode: {
1707
1819
  "commercialApiKey": {
1708
1820
  secretParameter: "consumerKey",
@@ -1724,8 +1836,12 @@ const AccountInformationApiFp = function(configuration) {
1724
1836
  */
1725
1837
  async listAllUserAccounts(...args) {
1726
1838
  const [requestParameters = {}, options] = args;
1727
- return createRequestFunction(await localVarAxiosParamCreator.listAllUserAccounts(requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1728
- authModes: ["commercialApiKey", "personalApiKey"],
1839
+ return createRequestFunction(await localVarAxiosParamCreator.listAllUserAccounts(requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1840
+ authModes: [
1841
+ "commercialApiKey",
1842
+ "personalApiKey",
1843
+ "oauth"
1844
+ ],
1729
1845
  requestSigningByAuthMode: {
1730
1846
  "commercialApiKey": {
1731
1847
  secretParameter: "consumerKey",
@@ -1748,8 +1864,12 @@ const AccountInformationApiFp = function(configuration) {
1748
1864
  */
1749
1865
  async listUserAccounts(...args) {
1750
1866
  const [requestParameters = {}, options] = args;
1751
- return createRequestFunction(await localVarAxiosParamCreator.listUserAccounts(requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1752
- authModes: ["commercialApiKey", "personalApiKey"],
1867
+ return createRequestFunction(await localVarAxiosParamCreator.listUserAccounts(requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1868
+ authModes: [
1869
+ "commercialApiKey",
1870
+ "personalApiKey",
1871
+ "oauth"
1872
+ ],
1753
1873
  requestSigningByAuthMode: {
1754
1874
  "commercialApiKey": {
1755
1875
  secretParameter: "consumerKey",
@@ -1771,8 +1891,12 @@ const AccountInformationApiFp = function(configuration) {
1771
1891
  */
1772
1892
  async updateUserAccount(...args) {
1773
1893
  const [requestParameters = {}, options] = args;
1774
- return createRequestFunction(await localVarAxiosParamCreator.updateUserAccount(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
1775
- authModes: ["commercialApiKey", "personalApiKey"],
1894
+ return createRequestFunction(await localVarAxiosParamCreator.updateUserAccount(requestParameters.accountId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
1895
+ authModes: [
1896
+ "commercialApiKey",
1897
+ "personalApiKey",
1898
+ "oauth"
1899
+ ],
1776
1900
  requestSigningByAuthMode: {
1777
1901
  "commercialApiKey": {
1778
1902
  secretParameter: "consumerKey",
@@ -1835,7 +1959,7 @@ const AccountInformationApiFactory = function(configuration, basePath, axios) {
1835
1959
  return localVarFp.getAccountDetails(...args).then((request) => request(axios, basePath));
1836
1960
  },
1837
1961
  /**
1838
- * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1962
+ * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1839
1963
  * @summary List all account positions
1840
1964
  * @param {AccountInformationApiGetAllAccountPositionsRequest<TAuth>} requestParameters Request parameters.
1841
1965
  * @param {*} [options] Override http request option.
@@ -2001,7 +2125,7 @@ var AccountInformationApiGenerated = class extends BaseAPI {
2001
2125
  return AccountInformationApiFp(this.configuration).getAccountDetails(...args).then((request) => request(this.axios, this.basePath));
2002
2126
  }
2003
2127
  /**
2004
- * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
2128
+ * Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position\'s `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
2005
2129
  * @summary List all account positions
2006
2130
  * @param {AccountInformationApiGetAllAccountPositionsRequest<TAuth>} requestParameters Request parameters.
2007
2131
  * @param {*} [options] Override http request option.
@@ -2194,7 +2318,7 @@ const ApiStatusApiFp = function(configuration) {
2194
2318
  * @throws {RequiredError}
2195
2319
  */
2196
2320
  async check(options) {
2197
- return createRequestFunction(await localVarAxiosParamCreator.check(options), globalAxios, BASE_PATH, configuration, { authModes: ["public"] });
2321
+ return createRequestFunction(await localVarAxiosParamCreator.check(options), axios, BASE_PATH, configuration, { authModes: ["public"] });
2198
2322
  } };
2199
2323
  };
2200
2324
  /**
@@ -2390,8 +2514,13 @@ const AuthenticationApiAxiosParamCreator = function(configuration) {
2390
2514
  keyParamName: "clientId",
2391
2515
  configuration
2392
2516
  });
2517
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
2393
2518
  const localVarOperationAuth = {
2394
- authModes: ["commercialApiKey", "personalApiKey"],
2519
+ authModes: [
2520
+ "commercialApiKey",
2521
+ "personalApiKey",
2522
+ "oauth"
2523
+ ],
2395
2524
  requestSigningByAuthMode: {
2396
2525
  "commercialApiKey": {
2397
2526
  secretParameter: "consumerKey",
@@ -2562,7 +2691,7 @@ const AuthenticationApiFp = function(configuration) {
2562
2691
  */
2563
2692
  async deleteSnapTradeUser(...args) {
2564
2693
  const [requestParameters = {}, options] = args;
2565
- return createRequestFunction(await localVarAxiosParamCreator.deleteSnapTradeUser(requestParameters.userId, options), globalAxios, BASE_PATH, configuration, {
2694
+ return createRequestFunction(await localVarAxiosParamCreator.deleteSnapTradeUser(requestParameters.userId, options), axios, BASE_PATH, configuration, {
2566
2695
  authModes: ["commercialApiKey"],
2567
2696
  requestSigningByAuthMode: { "commercialApiKey": {
2568
2697
  secretParameter: "consumerKey",
@@ -2578,7 +2707,7 @@ const AuthenticationApiFp = function(configuration) {
2578
2707
  */
2579
2708
  async listSnapTradeUsers(...args) {
2580
2709
  const [options] = args;
2581
- return createRequestFunction(await localVarAxiosParamCreator.listSnapTradeUsers(options), globalAxios, BASE_PATH, configuration, {
2710
+ return createRequestFunction(await localVarAxiosParamCreator.listSnapTradeUsers(options), axios, BASE_PATH, configuration, {
2582
2711
  authModes: ["commercialApiKey"],
2583
2712
  requestSigningByAuthMode: { "commercialApiKey": {
2584
2713
  secretParameter: "consumerKey",
@@ -2606,8 +2735,12 @@ const AuthenticationApiFp = function(configuration) {
2606
2735
  locale: requestParameters.locale,
2607
2736
  connectionPortalVersion: requestParameters.connectionPortalVersion
2608
2737
  };
2609
- return createRequestFunction(await localVarAxiosParamCreator.loginSnapTradeUser(snapTradeLoginUserRequestBody, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
2610
- authModes: ["commercialApiKey", "personalApiKey"],
2738
+ return createRequestFunction(await localVarAxiosParamCreator.loginSnapTradeUser(snapTradeLoginUserRequestBody, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
2739
+ authModes: [
2740
+ "commercialApiKey",
2741
+ "personalApiKey",
2742
+ "oauth"
2743
+ ],
2611
2744
  requestSigningByAuthMode: {
2612
2745
  "commercialApiKey": {
2613
2746
  secretParameter: "consumerKey",
@@ -2630,7 +2763,7 @@ const AuthenticationApiFp = function(configuration) {
2630
2763
  async registerSnapTradeUser(...args) {
2631
2764
  const [requestParameters = {}, options] = args;
2632
2765
  const snapTradeRegisterUserRequestBody = { userId: requestParameters.userId };
2633
- return createRequestFunction(await localVarAxiosParamCreator.registerSnapTradeUser(snapTradeRegisterUserRequestBody, options), globalAxios, BASE_PATH, configuration, {
2766
+ return createRequestFunction(await localVarAxiosParamCreator.registerSnapTradeUser(snapTradeRegisterUserRequestBody, options), axios, BASE_PATH, configuration, {
2634
2767
  authModes: ["commercialApiKey"],
2635
2768
  requestSigningByAuthMode: { "commercialApiKey": {
2636
2769
  secretParameter: "consumerKey",
@@ -2651,7 +2784,7 @@ const AuthenticationApiFp = function(configuration) {
2651
2784
  userId: requestParameters.userId,
2652
2785
  userSecret: requestParameters.userSecret
2653
2786
  };
2654
- return createRequestFunction(await localVarAxiosParamCreator.resetSnapTradeUserSecret(userIDandSecret, options), globalAxios, BASE_PATH, configuration, {
2787
+ return createRequestFunction(await localVarAxiosParamCreator.resetSnapTradeUserSecret(userIDandSecret, options), axios, BASE_PATH, configuration, {
2655
2788
  authModes: ["commercialApiKey"],
2656
2789
  requestSigningByAuthMode: { "commercialApiKey": {
2657
2790
  secretParameter: "consumerKey",
@@ -2903,8 +3036,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
2903
3036
  keyParamName: "clientId",
2904
3037
  configuration
2905
3038
  });
3039
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
2906
3040
  const localVarOperationAuth = {
2907
- authModes: ["commercialApiKey", "personalApiKey"],
3041
+ authModes: [
3042
+ "commercialApiKey",
3043
+ "personalApiKey",
3044
+ "oauth"
3045
+ ],
2908
3046
  requestSigningByAuthMode: {
2909
3047
  "commercialApiKey": {
2910
3048
  secretParameter: "consumerKey",
@@ -2976,8 +3114,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
2976
3114
  keyParamName: "clientId",
2977
3115
  configuration
2978
3116
  });
3117
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
2979
3118
  const localVarOperationAuth = {
2980
- authModes: ["commercialApiKey", "personalApiKey"],
3119
+ authModes: [
3120
+ "commercialApiKey",
3121
+ "personalApiKey",
3122
+ "oauth"
3123
+ ],
2981
3124
  requestSigningByAuthMode: {
2982
3125
  "commercialApiKey": {
2983
3126
  secretParameter: "consumerKey",
@@ -3049,8 +3192,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
3049
3192
  keyParamName: "clientId",
3050
3193
  configuration
3051
3194
  });
3195
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
3052
3196
  const localVarOperationAuth = {
3053
- authModes: ["commercialApiKey", "personalApiKey"],
3197
+ authModes: [
3198
+ "commercialApiKey",
3199
+ "personalApiKey",
3200
+ "oauth"
3201
+ ],
3054
3202
  requestSigningByAuthMode: {
3055
3203
  "commercialApiKey": {
3056
3204
  secretParameter: "consumerKey",
@@ -3120,8 +3268,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
3120
3268
  keyParamName: "clientId",
3121
3269
  configuration
3122
3270
  });
3271
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
3123
3272
  const localVarOperationAuth = {
3124
- authModes: ["commercialApiKey", "personalApiKey"],
3273
+ authModes: [
3274
+ "commercialApiKey",
3275
+ "personalApiKey",
3276
+ "oauth"
3277
+ ],
3125
3278
  requestSigningByAuthMode: {
3126
3279
  "commercialApiKey": {
3127
3280
  secretParameter: "consumerKey",
@@ -3193,8 +3346,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
3193
3346
  keyParamName: "clientId",
3194
3347
  configuration
3195
3348
  });
3349
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
3196
3350
  const localVarOperationAuth = {
3197
- authModes: ["commercialApiKey", "personalApiKey"],
3351
+ authModes: [
3352
+ "commercialApiKey",
3353
+ "personalApiKey",
3354
+ "oauth"
3355
+ ],
3198
3356
  requestSigningByAuthMode: {
3199
3357
  "commercialApiKey": {
3200
3358
  secretParameter: "consumerKey",
@@ -3266,8 +3424,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
3266
3424
  keyParamName: "clientId",
3267
3425
  configuration
3268
3426
  });
3427
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
3269
3428
  const localVarOperationAuth = {
3270
- authModes: ["commercialApiKey", "personalApiKey"],
3429
+ authModes: [
3430
+ "commercialApiKey",
3431
+ "personalApiKey",
3432
+ "oauth"
3433
+ ],
3271
3434
  requestSigningByAuthMode: {
3272
3435
  "commercialApiKey": {
3273
3436
  secretParameter: "consumerKey",
@@ -3414,8 +3577,13 @@ const ConnectionsApiAxiosParamCreator = function(configuration) {
3414
3577
  keyParamName: "clientId",
3415
3578
  configuration
3416
3579
  });
3580
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
3417
3581
  const localVarOperationAuth = {
3418
- authModes: ["commercialApiKey", "personalApiKey"],
3582
+ authModes: [
3583
+ "commercialApiKey",
3584
+ "personalApiKey",
3585
+ "oauth"
3586
+ ],
3419
3587
  requestSigningByAuthMode: {
3420
3588
  "commercialApiKey": {
3421
3589
  secretParameter: "consumerKey",
@@ -3467,7 +3635,7 @@ const ConnectionsApiFp = function(configuration) {
3467
3635
  */
3468
3636
  async deleteConnection(...args) {
3469
3637
  const [requestParameters = {}, options] = args;
3470
- return createRequestFunction(await localVarAxiosParamCreator.deleteConnection(requestParameters.connectionId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3638
+ return createRequestFunction(await localVarAxiosParamCreator.deleteConnection(requestParameters.connectionId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3471
3639
  authModes: ["commercialApiKey", "personalApiKey"],
3472
3640
  requestSigningByAuthMode: {
3473
3641
  "commercialApiKey": {
@@ -3490,8 +3658,12 @@ const ConnectionsApiFp = function(configuration) {
3490
3658
  */
3491
3659
  async detailBrokerageAuthorization(...args) {
3492
3660
  const [requestParameters = {}, options] = args;
3493
- return createRequestFunction(await localVarAxiosParamCreator.detailBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3494
- authModes: ["commercialApiKey", "personalApiKey"],
3661
+ return createRequestFunction(await localVarAxiosParamCreator.detailBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3662
+ authModes: [
3663
+ "commercialApiKey",
3664
+ "personalApiKey",
3665
+ "oauth"
3666
+ ],
3495
3667
  requestSigningByAuthMode: {
3496
3668
  "commercialApiKey": {
3497
3669
  secretParameter: "consumerKey",
@@ -3513,8 +3685,12 @@ const ConnectionsApiFp = function(configuration) {
3513
3685
  */
3514
3686
  async disableBrokerageAuthorization(...args) {
3515
3687
  const [requestParameters = {}, options] = args;
3516
- return createRequestFunction(await localVarAxiosParamCreator.disableBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3517
- authModes: ["commercialApiKey", "personalApiKey"],
3688
+ return createRequestFunction(await localVarAxiosParamCreator.disableBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3689
+ authModes: [
3690
+ "commercialApiKey",
3691
+ "personalApiKey",
3692
+ "oauth"
3693
+ ],
3518
3694
  requestSigningByAuthMode: {
3519
3695
  "commercialApiKey": {
3520
3696
  secretParameter: "consumerKey",
@@ -3536,8 +3712,12 @@ const ConnectionsApiFp = function(configuration) {
3536
3712
  */
3537
3713
  async listBrokerageAuthorizationAccounts(...args) {
3538
3714
  const [requestParameters = {}, options] = args;
3539
- return createRequestFunction(await localVarAxiosParamCreator.listBrokerageAuthorizationAccounts(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3540
- authModes: ["commercialApiKey", "personalApiKey"],
3715
+ return createRequestFunction(await localVarAxiosParamCreator.listBrokerageAuthorizationAccounts(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3716
+ authModes: [
3717
+ "commercialApiKey",
3718
+ "personalApiKey",
3719
+ "oauth"
3720
+ ],
3541
3721
  requestSigningByAuthMode: {
3542
3722
  "commercialApiKey": {
3543
3723
  secretParameter: "consumerKey",
@@ -3559,8 +3739,12 @@ const ConnectionsApiFp = function(configuration) {
3559
3739
  */
3560
3740
  async listBrokerageAuthorizations(...args) {
3561
3741
  const [requestParameters = {}, options] = args;
3562
- return createRequestFunction(await localVarAxiosParamCreator.listBrokerageAuthorizations(requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3563
- authModes: ["commercialApiKey", "personalApiKey"],
3742
+ return createRequestFunction(await localVarAxiosParamCreator.listBrokerageAuthorizations(requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3743
+ authModes: [
3744
+ "commercialApiKey",
3745
+ "personalApiKey",
3746
+ "oauth"
3747
+ ],
3564
3748
  requestSigningByAuthMode: {
3565
3749
  "commercialApiKey": {
3566
3750
  secretParameter: "consumerKey",
@@ -3582,8 +3766,12 @@ const ConnectionsApiFp = function(configuration) {
3582
3766
  */
3583
3767
  async listConnectionAccounts(...args) {
3584
3768
  const [requestParameters = {}, options] = args;
3585
- return createRequestFunction(await localVarAxiosParamCreator.listConnectionAccounts(requestParameters.connectionId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3586
- authModes: ["commercialApiKey", "personalApiKey"],
3769
+ return createRequestFunction(await localVarAxiosParamCreator.listConnectionAccounts(requestParameters.connectionId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3770
+ authModes: [
3771
+ "commercialApiKey",
3772
+ "personalApiKey",
3773
+ "oauth"
3774
+ ],
3587
3775
  requestSigningByAuthMode: {
3588
3776
  "commercialApiKey": {
3589
3777
  secretParameter: "consumerKey",
@@ -3605,8 +3793,12 @@ const ConnectionsApiFp = function(configuration) {
3605
3793
  */
3606
3794
  async refreshBrokerageAuthorization(...args) {
3607
3795
  const [requestParameters = {}, options] = args;
3608
- return createRequestFunction(await localVarAxiosParamCreator.refreshBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3609
- authModes: ["commercialApiKey", "personalApiKey"],
3796
+ return createRequestFunction(await localVarAxiosParamCreator.refreshBrokerageAuthorization(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3797
+ authModes: [
3798
+ "commercialApiKey",
3799
+ "personalApiKey",
3800
+ "oauth"
3801
+ ],
3610
3802
  requestSigningByAuthMode: {
3611
3803
  "commercialApiKey": {
3612
3804
  secretParameter: "consumerKey",
@@ -3628,7 +3820,7 @@ const ConnectionsApiFp = function(configuration) {
3628
3820
  */
3629
3821
  async returnRates(...args) {
3630
3822
  const [requestParameters = {}, options] = args;
3631
- return createRequestFunction(await localVarAxiosParamCreator.returnRates(requestParameters.authorizationId, requestParameters.timeframes, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3823
+ return createRequestFunction(await localVarAxiosParamCreator.returnRates(requestParameters.authorizationId, requestParameters.timeframes, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3632
3824
  authModes: ["commercialApiKey", "personalApiKey"],
3633
3825
  requestSigningByAuthMode: {
3634
3826
  "commercialApiKey": {
@@ -3651,8 +3843,12 @@ const ConnectionsApiFp = function(configuration) {
3651
3843
  */
3652
3844
  async syncBrokerageAuthorizationTransactions(...args) {
3653
3845
  const [requestParameters = {}, options] = args;
3654
- return createRequestFunction(await localVarAxiosParamCreator.syncBrokerageAuthorizationTransactions(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
3655
- authModes: ["commercialApiKey", "personalApiKey"],
3846
+ return createRequestFunction(await localVarAxiosParamCreator.syncBrokerageAuthorizationTransactions(requestParameters.authorizationId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
3847
+ authModes: [
3848
+ "commercialApiKey",
3849
+ "personalApiKey",
3850
+ "oauth"
3851
+ ],
3656
3852
  requestSigningByAuthMode: {
3657
3853
  "commercialApiKey": {
3658
3854
  secretParameter: "consumerKey",
@@ -4147,8 +4343,13 @@ const ExperimentalEndpointsApiAxiosParamCreator = function(configuration) {
4147
4343
  keyParamName: "clientId",
4148
4344
  configuration
4149
4345
  });
4346
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
4150
4347
  const localVarOperationAuth = {
4151
- authModes: ["commercialApiKey", "personalApiKey"],
4348
+ authModes: [
4349
+ "commercialApiKey",
4350
+ "personalApiKey",
4351
+ "oauth"
4352
+ ],
4152
4353
  requestSigningByAuthMode: {
4153
4354
  "commercialApiKey": {
4154
4355
  secretParameter: "consumerKey",
@@ -4222,10 +4423,15 @@ const ExperimentalEndpointsApiAxiosParamCreator = function(configuration) {
4222
4423
  keyParamName: "clientId",
4223
4424
  configuration
4224
4425
  });
4426
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
4225
4427
  if (state !== void 0) localVarQueryParameter["state"] = state;
4226
4428
  if (days !== void 0) localVarQueryParameter["days"] = days;
4227
4429
  const localVarOperationAuth = {
4228
- authModes: ["commercialApiKey", "personalApiKey"],
4430
+ authModes: [
4431
+ "commercialApiKey",
4432
+ "personalApiKey",
4433
+ "oauth"
4434
+ ],
4229
4435
  requestSigningByAuthMode: {
4230
4436
  "commercialApiKey": {
4231
4437
  secretParameter: "consumerKey",
@@ -4298,9 +4504,14 @@ const ExperimentalEndpointsApiAxiosParamCreator = function(configuration) {
4298
4504
  keyParamName: "clientId",
4299
4505
  configuration
4300
4506
  });
4507
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
4301
4508
  if (onlyExecuted !== void 0) localVarQueryParameter["only_executed"] = onlyExecuted;
4302
4509
  const localVarOperationAuth = {
4303
- authModes: ["commercialApiKey", "personalApiKey"],
4510
+ authModes: [
4511
+ "commercialApiKey",
4512
+ "personalApiKey",
4513
+ "oauth"
4514
+ ],
4304
4515
  requestSigningByAuthMode: {
4305
4516
  "commercialApiKey": {
4306
4517
  secretParameter: "consumerKey",
@@ -4400,7 +4611,7 @@ const ExperimentalEndpointsApiAxiosParamCreator = function(configuration) {
4400
4611
  };
4401
4612
  },
4402
4613
  /**
4403
- * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4614
+ * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade\'s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4404
4615
  * @summary Place a simple order (beta)
4405
4616
  * @param {string} accountId The ID of the account to execute the trade on.
4406
4617
  * @param {SimpleTradeForm} simpleTradeForm
@@ -4439,8 +4650,13 @@ const ExperimentalEndpointsApiAxiosParamCreator = function(configuration) {
4439
4650
  keyParamName: "clientId",
4440
4651
  configuration
4441
4652
  });
4653
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
4442
4654
  const localVarOperationAuth = {
4443
- authModes: ["commercialApiKey", "personalApiKey"],
4655
+ authModes: [
4656
+ "commercialApiKey",
4657
+ "personalApiKey",
4658
+ "oauth"
4659
+ ],
4444
4660
  requestSigningByAuthMode: {
4445
4661
  "commercialApiKey": {
4446
4662
  secretParameter: "consumerKey",
@@ -4499,7 +4715,7 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4499
4715
  account_id: requestParameters.account_id,
4500
4716
  check_interval_seconds: requestParameters.check_interval_seconds
4501
4717
  };
4502
- return createRequestFunction(await localVarAxiosParamCreator.addSubscription(tradeDetectionAddSubscriptionRequest, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4718
+ return createRequestFunction(await localVarAxiosParamCreator.addSubscription(tradeDetectionAddSubscriptionRequest, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4503
4719
  authModes: ["commercialApiKey", "personalApiKey"],
4504
4720
  requestSigningByAuthMode: {
4505
4721
  "commercialApiKey": {
@@ -4523,7 +4739,7 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4523
4739
  async cancelSubscription(...args) {
4524
4740
  const [requestParameters = {}, options] = args;
4525
4741
  const tradeDetectionCancelSubscriptionRequest = { account_id: requestParameters.account_id };
4526
- return createRequestFunction(await localVarAxiosParamCreator.cancelSubscription(tradeDetectionCancelSubscriptionRequest, options), globalAxios, BASE_PATH, configuration, {
4742
+ return createRequestFunction(await localVarAxiosParamCreator.cancelSubscription(tradeDetectionCancelSubscriptionRequest, options), axios, BASE_PATH, configuration, {
4527
4743
  authModes: ["commercialApiKey", "personalApiKey"],
4528
4744
  requestSigningByAuthMode: {
4529
4745
  "commercialApiKey": {
@@ -4546,7 +4762,7 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4546
4762
  */
4547
4763
  async getAllAccountOrders(...args) {
4548
4764
  const [requestParameters = {}, options] = args;
4549
- return createRequestFunction(await localVarAxiosParamCreator.getAllAccountOrders(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4765
+ return createRequestFunction(await localVarAxiosParamCreator.getAllAccountOrders(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4550
4766
  authModes: ["commercialApiKey", "personalApiKey"],
4551
4767
  requestSigningByAuthMode: {
4552
4768
  "commercialApiKey": {
@@ -4569,8 +4785,12 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4569
4785
  */
4570
4786
  async getUserAccountOrderDetailV2(...args) {
4571
4787
  const [requestParameters = {}, options] = args;
4572
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrderDetailV2(requestParameters.accountId, requestParameters.brokerageOrderId, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4573
- authModes: ["commercialApiKey", "personalApiKey"],
4788
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrderDetailV2(requestParameters.accountId, requestParameters.brokerageOrderId, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4789
+ authModes: [
4790
+ "commercialApiKey",
4791
+ "personalApiKey",
4792
+ "oauth"
4793
+ ],
4574
4794
  requestSigningByAuthMode: {
4575
4795
  "commercialApiKey": {
4576
4796
  secretParameter: "consumerKey",
@@ -4592,8 +4812,12 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4592
4812
  */
4593
4813
  async getUserAccountOrdersV2(...args) {
4594
4814
  const [requestParameters = {}, options] = args;
4595
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrdersV2(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4596
- authModes: ["commercialApiKey", "personalApiKey"],
4815
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOrdersV2(requestParameters.accountId, requestParameters.state, requestParameters.days, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4816
+ authModes: [
4817
+ "commercialApiKey",
4818
+ "personalApiKey",
4819
+ "oauth"
4820
+ ],
4597
4821
  requestSigningByAuthMode: {
4598
4822
  "commercialApiKey": {
4599
4823
  secretParameter: "consumerKey",
@@ -4615,8 +4839,12 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4615
4839
  */
4616
4840
  async getUserAccountRecentOrdersV2(...args) {
4617
4841
  const [requestParameters = {}, options] = args;
4618
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountRecentOrdersV2(requestParameters.accountId, requestParameters.onlyExecuted, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4619
- authModes: ["commercialApiKey", "personalApiKey"],
4842
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountRecentOrdersV2(requestParameters.accountId, requestParameters.onlyExecuted, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4843
+ authModes: [
4844
+ "commercialApiKey",
4845
+ "personalApiKey",
4846
+ "oauth"
4847
+ ],
4620
4848
  requestSigningByAuthMode: {
4621
4849
  "commercialApiKey": {
4622
4850
  secretParameter: "consumerKey",
@@ -4637,7 +4865,7 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4637
4865
  */
4638
4866
  async listSubscriptions(...args) {
4639
4867
  const [options] = args;
4640
- return createRequestFunction(await localVarAxiosParamCreator.listSubscriptions(options), globalAxios, BASE_PATH, configuration, {
4868
+ return createRequestFunction(await localVarAxiosParamCreator.listSubscriptions(options), axios, BASE_PATH, configuration, {
4641
4869
  authModes: ["commercialApiKey", "personalApiKey"],
4642
4870
  requestSigningByAuthMode: {
4643
4871
  "commercialApiKey": {
@@ -4652,7 +4880,7 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4652
4880
  });
4653
4881
  },
4654
4882
  /**
4655
- * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4883
+ * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade\'s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4656
4884
  * @summary Place a simple order (beta)
4657
4885
  * @param {ExperimentalEndpointsApiPlaceSimpleOrderRequest<TAuth>} requestParameters Request parameters.
4658
4886
  * @param {*} [options] Override http request option.
@@ -4672,8 +4900,12 @@ const ExperimentalEndpointsApiFp = function(configuration) {
4672
4900
  notional_value: requestParameters.notional_value,
4673
4901
  trading_session: requestParameters.trading_session
4674
4902
  };
4675
- return createRequestFunction(await localVarAxiosParamCreator.placeSimpleOrder(requestParameters.accountId, simpleTradeForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
4676
- authModes: ["commercialApiKey", "personalApiKey"],
4903
+ return createRequestFunction(await localVarAxiosParamCreator.placeSimpleOrder(requestParameters.accountId, simpleTradeForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
4904
+ authModes: [
4905
+ "commercialApiKey",
4906
+ "personalApiKey",
4907
+ "oauth"
4908
+ ],
4677
4909
  requestSigningByAuthMode: {
4678
4910
  "commercialApiKey": {
4679
4911
  secretParameter: "consumerKey",
@@ -4765,7 +4997,7 @@ const ExperimentalEndpointsApiFactory = function(configuration, basePath, axios)
4765
4997
  return localVarFp.listSubscriptions(...args).then((request) => request(axios, basePath));
4766
4998
  },
4767
4999
  /**
4768
- * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
5000
+ * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade\'s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4769
5001
  * @summary Place a simple order (beta)
4770
5002
  * @param {ExperimentalEndpointsApiPlaceSimpleOrderRequest<TAuth>} requestParameters Request parameters.
4771
5003
  * @param {*} [options] Override http request option.
@@ -4860,7 +5092,7 @@ var ExperimentalEndpointsApiGenerated = class extends BaseAPI {
4860
5092
  return ExperimentalEndpointsApiFp(this.configuration).listSubscriptions(...args).then((request) => request(this.axios, this.basePath));
4861
5093
  }
4862
5094
  /**
4863
- * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
5095
+ * **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade\'s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
4864
5096
  * @summary Place a simple order (beta)
4865
5097
  * @param {ExperimentalEndpointsApiPlaceSimpleOrderRequest<TAuth>} requestParameters Request parameters.
4866
5098
  * @param {*} [options] Override http request option.
@@ -5035,7 +5267,7 @@ const ManagementApiFp = function(configuration) {
5035
5267
  */
5036
5268
  async getStats(...args) {
5037
5269
  const [requestParameters = {}, options] = args;
5038
- return createRequestFunction(await localVarAxiosParamCreator.getStats(requestParameters.currency, options), globalAxios, BASE_PATH, configuration, {
5270
+ return createRequestFunction(await localVarAxiosParamCreator.getStats(requestParameters.currency, options), axios, BASE_PATH, configuration, {
5039
5271
  authModes: ["commercialApiKey", "personalApiKey"],
5040
5272
  requestSigningByAuthMode: {
5041
5273
  "commercialApiKey": {
@@ -5059,7 +5291,7 @@ const ManagementApiFp = function(configuration) {
5059
5291
  */
5060
5292
  async getStatsLegacy(...args) {
5061
5293
  const [requestParameters = {}, options] = args;
5062
- return createRequestFunction(await localVarAxiosParamCreator.getStatsLegacy(requestParameters.currency, options), globalAxios, BASE_PATH, configuration, {
5294
+ return createRequestFunction(await localVarAxiosParamCreator.getStatsLegacy(requestParameters.currency, options), axios, BASE_PATH, configuration, {
5063
5295
  authModes: ["commercialApiKey", "personalApiKey"],
5064
5296
  requestSigningByAuthMode: {
5065
5297
  "commercialApiKey": {
@@ -5177,8 +5409,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5177
5409
  keyParamName: "clientId",
5178
5410
  configuration
5179
5411
  });
5412
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5180
5413
  const localVarOperationAuth = {
5181
- authModes: ["commercialApiKey", "personalApiKey"],
5414
+ authModes: [
5415
+ "commercialApiKey",
5416
+ "personalApiKey",
5417
+ "oauth"
5418
+ ],
5182
5419
  requestSigningByAuthMode: {
5183
5420
  "commercialApiKey": {
5184
5421
  secretParameter: "consumerKey",
@@ -5242,8 +5479,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5242
5479
  keyParamName: "clientId",
5243
5480
  configuration
5244
5481
  });
5482
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5245
5483
  const localVarOperationAuth = {
5246
- authModes: ["commercialApiKey", "personalApiKey"],
5484
+ authModes: [
5485
+ "commercialApiKey",
5486
+ "personalApiKey",
5487
+ "oauth"
5488
+ ],
5247
5489
  requestSigningByAuthMode: {
5248
5490
  "commercialApiKey": {
5249
5491
  secretParameter: "consumerKey",
@@ -5308,8 +5550,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5308
5550
  keyParamName: "clientId",
5309
5551
  configuration
5310
5552
  });
5553
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5311
5554
  const localVarOperationAuth = {
5312
- authModes: ["commercialApiKey", "personalApiKey"],
5555
+ authModes: [
5556
+ "commercialApiKey",
5557
+ "personalApiKey",
5558
+ "oauth"
5559
+ ],
5313
5560
  requestSigningByAuthMode: {
5314
5561
  "commercialApiKey": {
5315
5562
  secretParameter: "consumerKey",
@@ -5378,8 +5625,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5378
5625
  keyParamName: "clientId",
5379
5626
  configuration
5380
5627
  });
5628
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5381
5629
  const localVarOperationAuth = {
5382
- authModes: ["commercialApiKey", "personalApiKey"],
5630
+ authModes: [
5631
+ "commercialApiKey",
5632
+ "personalApiKey",
5633
+ "oauth"
5634
+ ],
5383
5635
  requestSigningByAuthMode: {
5384
5636
  "commercialApiKey": {
5385
5637
  secretParameter: "consumerKey",
@@ -5512,8 +5764,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5512
5764
  keyParamName: "clientId",
5513
5765
  configuration
5514
5766
  });
5767
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5515
5768
  const localVarOperationAuth = {
5516
- authModes: ["commercialApiKey", "personalApiKey"],
5769
+ authModes: [
5770
+ "commercialApiKey",
5771
+ "personalApiKey",
5772
+ "oauth"
5773
+ ],
5517
5774
  requestSigningByAuthMode: {
5518
5775
  "commercialApiKey": {
5519
5776
  secretParameter: "consumerKey",
@@ -5577,8 +5834,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5577
5834
  keyParamName: "clientId",
5578
5835
  configuration
5579
5836
  });
5837
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5580
5838
  const localVarOperationAuth = {
5581
- authModes: ["commercialApiKey", "personalApiKey"],
5839
+ authModes: [
5840
+ "commercialApiKey",
5841
+ "personalApiKey",
5842
+ "oauth"
5843
+ ],
5582
5844
  requestSigningByAuthMode: {
5583
5845
  "commercialApiKey": {
5584
5846
  secretParameter: "consumerKey",
@@ -5694,8 +5956,13 @@ const ReferenceDataApiAxiosParamCreator = function(configuration) {
5694
5956
  keyParamName: "clientId",
5695
5957
  configuration
5696
5958
  });
5959
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
5697
5960
  const localVarOperationAuth = {
5698
- authModes: ["commercialApiKey", "personalApiKey"],
5961
+ authModes: [
5962
+ "commercialApiKey",
5963
+ "personalApiKey",
5964
+ "oauth"
5965
+ ],
5699
5966
  requestSigningByAuthMode: {
5700
5967
  "commercialApiKey": {
5701
5968
  secretParameter: "consumerKey",
@@ -5749,8 +6016,12 @@ const ReferenceDataApiFp = function(configuration) {
5749
6016
  */
5750
6017
  async getPartnerInfo(...args) {
5751
6018
  const [options] = args;
5752
- return createRequestFunction(await localVarAxiosParamCreator.getPartnerInfo(options), globalAxios, BASE_PATH, configuration, {
5753
- authModes: ["commercialApiKey", "personalApiKey"],
6019
+ return createRequestFunction(await localVarAxiosParamCreator.getPartnerInfo(options), axios, BASE_PATH, configuration, {
6020
+ authModes: [
6021
+ "commercialApiKey",
6022
+ "personalApiKey",
6023
+ "oauth"
6024
+ ],
5754
6025
  requestSigningByAuthMode: {
5755
6026
  "commercialApiKey": {
5756
6027
  secretParameter: "consumerKey",
@@ -5771,8 +6042,12 @@ const ReferenceDataApiFp = function(configuration) {
5771
6042
  */
5772
6043
  async getStockExchanges(...args) {
5773
6044
  const [options] = args;
5774
- return createRequestFunction(await localVarAxiosParamCreator.getStockExchanges(options), globalAxios, BASE_PATH, configuration, {
5775
- authModes: ["commercialApiKey", "personalApiKey"],
6045
+ return createRequestFunction(await localVarAxiosParamCreator.getStockExchanges(options), axios, BASE_PATH, configuration, {
6046
+ authModes: [
6047
+ "commercialApiKey",
6048
+ "personalApiKey",
6049
+ "oauth"
6050
+ ],
5776
6051
  requestSigningByAuthMode: {
5777
6052
  "commercialApiKey": {
5778
6053
  secretParameter: "consumerKey",
@@ -5795,8 +6070,12 @@ const ReferenceDataApiFp = function(configuration) {
5795
6070
  async getSymbols(...args) {
5796
6071
  const [requestParameters = {}, options] = args;
5797
6072
  const symbolQuery = { substring: requestParameters.substring };
5798
- return createRequestFunction(await localVarAxiosParamCreator.getSymbols(symbolQuery, options), globalAxios, BASE_PATH, configuration, {
5799
- authModes: ["commercialApiKey", "personalApiKey"],
6073
+ return createRequestFunction(await localVarAxiosParamCreator.getSymbols(symbolQuery, options), axios, BASE_PATH, configuration, {
6074
+ authModes: [
6075
+ "commercialApiKey",
6076
+ "personalApiKey",
6077
+ "oauth"
6078
+ ],
5800
6079
  requestSigningByAuthMode: {
5801
6080
  "commercialApiKey": {
5802
6081
  secretParameter: "consumerKey",
@@ -5818,8 +6097,12 @@ const ReferenceDataApiFp = function(configuration) {
5818
6097
  */
5819
6098
  async getSymbolsByTicker(...args) {
5820
6099
  const [requestParameters = {}, options] = args;
5821
- return createRequestFunction(await localVarAxiosParamCreator.getSymbolsByTicker(requestParameters.query, options), globalAxios, BASE_PATH, configuration, {
5822
- authModes: ["commercialApiKey", "personalApiKey"],
6100
+ return createRequestFunction(await localVarAxiosParamCreator.getSymbolsByTicker(requestParameters.query, options), axios, BASE_PATH, configuration, {
6101
+ authModes: [
6102
+ "commercialApiKey",
6103
+ "personalApiKey",
6104
+ "oauth"
6105
+ ],
5823
6106
  requestSigningByAuthMode: {
5824
6107
  "commercialApiKey": {
5825
6108
  secretParameter: "consumerKey",
@@ -5841,7 +6124,7 @@ const ReferenceDataApiFp = function(configuration) {
5841
6124
  */
5842
6125
  async listAllBrokerageAuthorizationType(...args) {
5843
6126
  const [requestParameters = {}, options] = args;
5844
- return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerageAuthorizationType(requestParameters.brokerage, options), globalAxios, BASE_PATH, configuration, {
6127
+ return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerageAuthorizationType(requestParameters.brokerage, options), axios, BASE_PATH, configuration, {
5845
6128
  authModes: ["commercialApiKey", "personalApiKey"],
5846
6129
  requestSigningByAuthMode: {
5847
6130
  "commercialApiKey": {
@@ -5864,8 +6147,12 @@ const ReferenceDataApiFp = function(configuration) {
5864
6147
  */
5865
6148
  async listAllBrokerageInstruments(...args) {
5866
6149
  const [requestParameters = {}, options] = args;
5867
- return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerageInstruments(requestParameters.slug, options), globalAxios, BASE_PATH, configuration, {
5868
- authModes: ["commercialApiKey", "personalApiKey"],
6150
+ return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerageInstruments(requestParameters.slug, options), axios, BASE_PATH, configuration, {
6151
+ authModes: [
6152
+ "commercialApiKey",
6153
+ "personalApiKey",
6154
+ "oauth"
6155
+ ],
5869
6156
  requestSigningByAuthMode: {
5870
6157
  "commercialApiKey": {
5871
6158
  secretParameter: "consumerKey",
@@ -5886,8 +6173,12 @@ const ReferenceDataApiFp = function(configuration) {
5886
6173
  */
5887
6174
  async listAllBrokerages(...args) {
5888
6175
  const [options] = args;
5889
- return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerages(options), globalAxios, BASE_PATH, configuration, {
5890
- authModes: ["commercialApiKey", "personalApiKey"],
6176
+ return createRequestFunction(await localVarAxiosParamCreator.listAllBrokerages(options), axios, BASE_PATH, configuration, {
6177
+ authModes: [
6178
+ "commercialApiKey",
6179
+ "personalApiKey",
6180
+ "oauth"
6181
+ ],
5891
6182
  requestSigningByAuthMode: {
5892
6183
  "commercialApiKey": {
5893
6184
  secretParameter: "consumerKey",
@@ -5907,7 +6198,7 @@ const ReferenceDataApiFp = function(configuration) {
5907
6198
  * @throws {RequiredError}
5908
6199
  */
5909
6200
  async listInstitutions(options) {
5910
- return createRequestFunction(await localVarAxiosParamCreator.listInstitutions(options), globalAxios, BASE_PATH, configuration, { authModes: ["public"] });
6201
+ return createRequestFunction(await localVarAxiosParamCreator.listInstitutions(options), axios, BASE_PATH, configuration, { authModes: ["public"] });
5911
6202
  },
5912
6203
  /**
5913
6204
  * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
@@ -5919,8 +6210,12 @@ const ReferenceDataApiFp = function(configuration) {
5919
6210
  async symbolSearchUserAccount(...args) {
5920
6211
  const [requestParameters = {}, options] = args;
5921
6212
  const symbolQuery = { substring: requestParameters.substring };
5922
- return createRequestFunction(await localVarAxiosParamCreator.symbolSearchUserAccount(requestParameters.accountId, symbolQuery, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
5923
- authModes: ["commercialApiKey", "personalApiKey"],
6213
+ return createRequestFunction(await localVarAxiosParamCreator.symbolSearchUserAccount(requestParameters.accountId, symbolQuery, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
6214
+ authModes: [
6215
+ "commercialApiKey",
6216
+ "personalApiKey",
6217
+ "oauth"
6218
+ ],
5924
6219
  requestSigningByAuthMode: {
5925
6220
  "commercialApiKey": {
5926
6221
  secretParameter: "consumerKey",
@@ -6184,8 +6479,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6184
6479
  keyParamName: "clientId",
6185
6480
  configuration
6186
6481
  });
6482
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6187
6483
  const localVarOperationAuth = {
6188
- authModes: ["commercialApiKey", "personalApiKey"],
6484
+ authModes: [
6485
+ "commercialApiKey",
6486
+ "personalApiKey",
6487
+ "oauth"
6488
+ ],
6189
6489
  requestSigningByAuthMode: {
6190
6490
  "commercialApiKey": {
6191
6491
  secretParameter: "consumerKey",
@@ -6262,8 +6562,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6262
6562
  keyParamName: "clientId",
6263
6563
  configuration
6264
6564
  });
6565
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6265
6566
  const localVarOperationAuth = {
6266
- authModes: ["commercialApiKey", "personalApiKey"],
6567
+ authModes: [
6568
+ "commercialApiKey",
6569
+ "personalApiKey",
6570
+ "oauth"
6571
+ ],
6267
6572
  requestSigningByAuthMode: {
6268
6573
  "commercialApiKey": {
6269
6574
  secretParameter: "consumerKey",
@@ -6337,8 +6642,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6337
6642
  keyParamName: "clientId",
6338
6643
  configuration
6339
6644
  });
6645
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6340
6646
  const localVarOperationAuth = {
6341
- authModes: ["commercialApiKey", "personalApiKey"],
6647
+ authModes: [
6648
+ "commercialApiKey",
6649
+ "personalApiKey",
6650
+ "oauth"
6651
+ ],
6342
6652
  requestSigningByAuthMode: {
6343
6653
  "commercialApiKey": {
6344
6654
  secretParameter: "consumerKey",
@@ -6413,8 +6723,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6413
6723
  keyParamName: "clientId",
6414
6724
  configuration
6415
6725
  });
6726
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6416
6727
  const localVarOperationAuth = {
6417
- authModes: ["commercialApiKey", "personalApiKey"],
6728
+ authModes: [
6729
+ "commercialApiKey",
6730
+ "personalApiKey",
6731
+ "oauth"
6732
+ ],
6418
6733
  requestSigningByAuthMode: {
6419
6734
  "commercialApiKey": {
6420
6735
  secretParameter: "consumerKey",
@@ -6569,10 +6884,15 @@ const TradingApiAxiosParamCreator = function(configuration) {
6569
6884
  keyParamName: "clientId",
6570
6885
  configuration
6571
6886
  });
6887
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6572
6888
  if (symbols !== void 0) localVarQueryParameter["symbols"] = symbols;
6573
6889
  if (useTicker !== void 0) localVarQueryParameter["use_ticker"] = useTicker;
6574
6890
  const localVarOperationAuth = {
6575
- authModes: ["commercialApiKey", "personalApiKey"],
6891
+ authModes: [
6892
+ "commercialApiKey",
6893
+ "personalApiKey",
6894
+ "oauth"
6895
+ ],
6576
6896
  requestSigningByAuthMode: {
6577
6897
  "commercialApiKey": {
6578
6898
  secretParameter: "consumerKey",
@@ -6646,8 +6966,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6646
6966
  keyParamName: "clientId",
6647
6967
  configuration
6648
6968
  });
6969
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6649
6970
  const localVarOperationAuth = {
6650
- authModes: ["commercialApiKey", "personalApiKey"],
6971
+ authModes: [
6972
+ "commercialApiKey",
6973
+ "personalApiKey",
6974
+ "oauth"
6975
+ ],
6651
6976
  requestSigningByAuthMode: {
6652
6977
  "commercialApiKey": {
6653
6978
  secretParameter: "consumerKey",
@@ -6724,8 +7049,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6724
7049
  keyParamName: "clientId",
6725
7050
  configuration
6726
7051
  });
7052
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6727
7053
  const localVarOperationAuth = {
6728
- authModes: ["commercialApiKey", "personalApiKey"],
7054
+ authModes: [
7055
+ "commercialApiKey",
7056
+ "personalApiKey",
7057
+ "oauth"
7058
+ ],
6729
7059
  requestSigningByAuthMode: {
6730
7060
  "commercialApiKey": {
6731
7061
  secretParameter: "consumerKey",
@@ -6800,8 +7130,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6800
7130
  keyParamName: "clientId",
6801
7131
  configuration
6802
7132
  });
7133
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6803
7134
  const localVarOperationAuth = {
6804
- authModes: ["commercialApiKey", "personalApiKey"],
7135
+ authModes: [
7136
+ "commercialApiKey",
7137
+ "personalApiKey",
7138
+ "oauth"
7139
+ ],
6805
7140
  requestSigningByAuthMode: {
6806
7141
  "commercialApiKey": {
6807
7142
  secretParameter: "consumerKey",
@@ -6878,8 +7213,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6878
7213
  keyParamName: "clientId",
6879
7214
  configuration
6880
7215
  });
7216
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6881
7217
  const localVarOperationAuth = {
6882
- authModes: ["commercialApiKey", "personalApiKey"],
7218
+ authModes: [
7219
+ "commercialApiKey",
7220
+ "personalApiKey",
7221
+ "oauth"
7222
+ ],
6883
7223
  requestSigningByAuthMode: {
6884
7224
  "commercialApiKey": {
6885
7225
  secretParameter: "consumerKey",
@@ -6955,8 +7295,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
6955
7295
  keyParamName: "clientId",
6956
7296
  configuration
6957
7297
  });
7298
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
6958
7299
  const localVarOperationAuth = {
6959
- authModes: ["commercialApiKey", "personalApiKey"],
7300
+ authModes: [
7301
+ "commercialApiKey",
7302
+ "personalApiKey",
7303
+ "oauth"
7304
+ ],
6960
7305
  requestSigningByAuthMode: {
6961
7306
  "commercialApiKey": {
6962
7307
  secretParameter: "consumerKey",
@@ -7033,8 +7378,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
7033
7378
  keyParamName: "clientId",
7034
7379
  configuration
7035
7380
  });
7381
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
7036
7382
  const localVarOperationAuth = {
7037
- authModes: ["commercialApiKey", "personalApiKey"],
7383
+ authModes: [
7384
+ "commercialApiKey",
7385
+ "personalApiKey",
7386
+ "oauth"
7387
+ ],
7038
7388
  requestSigningByAuthMode: {
7039
7389
  "commercialApiKey": {
7040
7390
  secretParameter: "consumerKey",
@@ -7111,8 +7461,13 @@ const TradingApiAxiosParamCreator = function(configuration) {
7111
7461
  keyParamName: "clientId",
7112
7462
  configuration
7113
7463
  });
7464
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
7114
7465
  const localVarOperationAuth = {
7115
- authModes: ["commercialApiKey", "personalApiKey"],
7466
+ authModes: [
7467
+ "commercialApiKey",
7468
+ "personalApiKey",
7469
+ "oauth"
7470
+ ],
7116
7471
  requestSigningByAuthMode: {
7117
7472
  "commercialApiKey": {
7118
7473
  secretParameter: "consumerKey",
@@ -7189,10 +7544,15 @@ const TradingApiAxiosParamCreator = function(configuration) {
7189
7544
  keyParamName: "clientId",
7190
7545
  configuration
7191
7546
  });
7547
+ if (configuration?.authMode === "oauth") await setBearerAuthToObject(localVarHeaderParameter, configuration);
7192
7548
  if (base !== void 0) localVarQueryParameter["base"] = base;
7193
7549
  if (quote !== void 0) localVarQueryParameter["quote"] = quote;
7194
7550
  const localVarOperationAuth = {
7195
- authModes: ["commercialApiKey", "personalApiKey"],
7551
+ authModes: [
7552
+ "commercialApiKey",
7553
+ "personalApiKey",
7554
+ "oauth"
7555
+ ],
7196
7556
  requestSigningByAuthMode: {
7197
7557
  "commercialApiKey": {
7198
7558
  secretParameter: "consumerKey",
@@ -7245,8 +7605,12 @@ const TradingApiFp = function(configuration) {
7245
7605
  async cancelOrder(...args) {
7246
7606
  const [requestParameters = {}, options] = args;
7247
7607
  const accountInformationGetUserAccountOrderDetailRequest = { brokerage_order_id: requestParameters.brokerage_order_id };
7248
- return createRequestFunction(await localVarAxiosParamCreator.cancelOrder(requestParameters.accountId, accountInformationGetUserAccountOrderDetailRequest, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7249
- authModes: ["commercialApiKey", "personalApiKey"],
7608
+ return createRequestFunction(await localVarAxiosParamCreator.cancelOrder(requestParameters.accountId, accountInformationGetUserAccountOrderDetailRequest, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7609
+ authModes: [
7610
+ "commercialApiKey",
7611
+ "personalApiKey",
7612
+ "oauth"
7613
+ ],
7250
7614
  requestSigningByAuthMode: {
7251
7615
  "commercialApiKey": {
7252
7616
  secretParameter: "consumerKey",
@@ -7268,8 +7632,12 @@ const TradingApiFp = function(configuration) {
7268
7632
  */
7269
7633
  async getCryptocurrencyPairQuote(...args) {
7270
7634
  const [requestParameters = {}, options] = args;
7271
- return createRequestFunction(await localVarAxiosParamCreator.getCryptocurrencyPairQuote(requestParameters.accountId, requestParameters.instrumentSymbol, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7272
- authModes: ["commercialApiKey", "personalApiKey"],
7635
+ return createRequestFunction(await localVarAxiosParamCreator.getCryptocurrencyPairQuote(requestParameters.accountId, requestParameters.instrumentSymbol, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7636
+ authModes: [
7637
+ "commercialApiKey",
7638
+ "personalApiKey",
7639
+ "oauth"
7640
+ ],
7273
7641
  requestSigningByAuthMode: {
7274
7642
  "commercialApiKey": {
7275
7643
  secretParameter: "consumerKey",
@@ -7299,8 +7667,12 @@ const TradingApiFp = function(configuration) {
7299
7667
  price_effect: requestParameters.price_effect,
7300
7668
  legs: requestParameters.legs
7301
7669
  };
7302
- return createRequestFunction(await localVarAxiosParamCreator.getOptionImpact(requestParameters.accountId, mlegTradeForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7303
- authModes: ["commercialApiKey", "personalApiKey"],
7670
+ return createRequestFunction(await localVarAxiosParamCreator.getOptionImpact(requestParameters.accountId, mlegTradeForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7671
+ authModes: [
7672
+ "commercialApiKey",
7673
+ "personalApiKey",
7674
+ "oauth"
7675
+ ],
7304
7676
  requestSigningByAuthMode: {
7305
7677
  "commercialApiKey": {
7306
7678
  secretParameter: "consumerKey",
@@ -7333,8 +7705,12 @@ const TradingApiFp = function(configuration) {
7333
7705
  units: requestParameters.units,
7334
7706
  notional_value: requestParameters.notional_value
7335
7707
  };
7336
- return createRequestFunction(await localVarAxiosParamCreator.getOrderImpact(manualTradeForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7337
- authModes: ["commercialApiKey", "personalApiKey"],
7708
+ return createRequestFunction(await localVarAxiosParamCreator.getOrderImpact(manualTradeForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7709
+ authModes: [
7710
+ "commercialApiKey",
7711
+ "personalApiKey",
7712
+ "oauth"
7713
+ ],
7338
7714
  requestSigningByAuthMode: {
7339
7715
  "commercialApiKey": {
7340
7716
  secretParameter: "consumerKey",
@@ -7357,7 +7733,7 @@ const TradingApiFp = function(configuration) {
7357
7733
  */
7358
7734
  async getUserAccountOptionQuotes(...args) {
7359
7735
  const [requestParameters = {}, options] = args;
7360
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOptionQuotes(requestParameters.accountId, requestParameters.symbol, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7736
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountOptionQuotes(requestParameters.accountId, requestParameters.symbol, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7361
7737
  authModes: ["commercialApiKey", "personalApiKey"],
7362
7738
  requestSigningByAuthMode: {
7363
7739
  "commercialApiKey": {
@@ -7380,8 +7756,12 @@ const TradingApiFp = function(configuration) {
7380
7756
  */
7381
7757
  async getUserAccountQuotes(...args) {
7382
7758
  const [requestParameters = {}, options] = args;
7383
- return createRequestFunction(await localVarAxiosParamCreator.getUserAccountQuotes(requestParameters.symbols, requestParameters.accountId, requestParameters.useTicker, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7384
- authModes: ["commercialApiKey", "personalApiKey"],
7759
+ return createRequestFunction(await localVarAxiosParamCreator.getUserAccountQuotes(requestParameters.symbols, requestParameters.accountId, requestParameters.useTicker, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7760
+ authModes: [
7761
+ "commercialApiKey",
7762
+ "personalApiKey",
7763
+ "oauth"
7764
+ ],
7385
7765
  requestSigningByAuthMode: {
7386
7766
  "commercialApiKey": {
7387
7767
  secretParameter: "consumerKey",
@@ -7408,8 +7788,12 @@ const TradingApiFp = function(configuration) {
7408
7788
  orders: requestParameters.orders,
7409
7789
  client_order_id: requestParameters.client_order_id
7410
7790
  };
7411
- return createRequestFunction(await localVarAxiosParamCreator.placeComplexOrder(requestParameters.accountId, manualTradeFormComplex, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7412
- authModes: ["commercialApiKey", "personalApiKey"],
7791
+ return createRequestFunction(await localVarAxiosParamCreator.placeComplexOrder(requestParameters.accountId, manualTradeFormComplex, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7792
+ authModes: [
7793
+ "commercialApiKey",
7794
+ "personalApiKey",
7795
+ "oauth"
7796
+ ],
7413
7797
  requestSigningByAuthMode: {
7414
7798
  "commercialApiKey": {
7415
7799
  secretParameter: "consumerKey",
@@ -7442,8 +7826,12 @@ const TradingApiFp = function(configuration) {
7442
7826
  post_only: requestParameters.post_only,
7443
7827
  expiration_date: requestParameters.expiration_date
7444
7828
  };
7445
- return createRequestFunction(await localVarAxiosParamCreator.placeCryptoOrder(requestParameters.accountId, cryptoOrderForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7446
- authModes: ["commercialApiKey", "personalApiKey"],
7829
+ return createRequestFunction(await localVarAxiosParamCreator.placeCryptoOrder(requestParameters.accountId, cryptoOrderForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7830
+ authModes: [
7831
+ "commercialApiKey",
7832
+ "personalApiKey",
7833
+ "oauth"
7834
+ ],
7447
7835
  requestSigningByAuthMode: {
7448
7836
  "commercialApiKey": {
7449
7837
  secretParameter: "consumerKey",
@@ -7480,8 +7868,12 @@ const TradingApiFp = function(configuration) {
7480
7868
  notional_value: requestParameters.notional_value,
7481
7869
  client_order_id: requestParameters.client_order_id
7482
7870
  };
7483
- return createRequestFunction(await localVarAxiosParamCreator.placeForceOrder(manualTradeFormWithOptions, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7484
- authModes: ["commercialApiKey", "personalApiKey"],
7871
+ return createRequestFunction(await localVarAxiosParamCreator.placeForceOrder(manualTradeFormWithOptions, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7872
+ authModes: [
7873
+ "commercialApiKey",
7874
+ "personalApiKey",
7875
+ "oauth"
7876
+ ],
7485
7877
  requestSigningByAuthMode: {
7486
7878
  "commercialApiKey": {
7487
7879
  secretParameter: "consumerKey",
@@ -7511,8 +7903,12 @@ const TradingApiFp = function(configuration) {
7511
7903
  price_effect: requestParameters.price_effect,
7512
7904
  legs: requestParameters.legs
7513
7905
  };
7514
- return createRequestFunction(await localVarAxiosParamCreator.placeMlegOrder(requestParameters.accountId, mlegTradeForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7515
- authModes: ["commercialApiKey", "personalApiKey"],
7906
+ return createRequestFunction(await localVarAxiosParamCreator.placeMlegOrder(requestParameters.accountId, mlegTradeForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7907
+ authModes: [
7908
+ "commercialApiKey",
7909
+ "personalApiKey",
7910
+ "oauth"
7911
+ ],
7516
7912
  requestSigningByAuthMode: {
7517
7913
  "commercialApiKey": {
7518
7914
  secretParameter: "consumerKey",
@@ -7535,8 +7931,12 @@ const TradingApiFp = function(configuration) {
7535
7931
  async placeOrder(...args) {
7536
7932
  const [requestParameters = {}, options] = args;
7537
7933
  const validatedTradeBody = { wait_to_confirm: requestParameters.wait_to_confirm };
7538
- return createRequestFunction(await localVarAxiosParamCreator.placeOrder(requestParameters.tradeId, validatedTradeBody, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7539
- authModes: ["commercialApiKey", "personalApiKey"],
7934
+ return createRequestFunction(await localVarAxiosParamCreator.placeOrder(requestParameters.tradeId, validatedTradeBody, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7935
+ authModes: [
7936
+ "commercialApiKey",
7937
+ "personalApiKey",
7938
+ "oauth"
7939
+ ],
7540
7940
  requestSigningByAuthMode: {
7541
7941
  "commercialApiKey": {
7542
7942
  secretParameter: "consumerKey",
@@ -7569,8 +7969,12 @@ const TradingApiFp = function(configuration) {
7569
7969
  post_only: requestParameters.post_only,
7570
7970
  expiration_date: requestParameters.expiration_date
7571
7971
  };
7572
- return createRequestFunction(await localVarAxiosParamCreator.previewCryptoOrder(requestParameters.accountId, cryptoOrderForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7573
- authModes: ["commercialApiKey", "personalApiKey"],
7972
+ return createRequestFunction(await localVarAxiosParamCreator.previewCryptoOrder(requestParameters.accountId, cryptoOrderForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
7973
+ authModes: [
7974
+ "commercialApiKey",
7975
+ "personalApiKey",
7976
+ "oauth"
7977
+ ],
7574
7978
  requestSigningByAuthMode: {
7575
7979
  "commercialApiKey": {
7576
7980
  secretParameter: "consumerKey",
@@ -7602,8 +8006,12 @@ const TradingApiFp = function(configuration) {
7602
8006
  stop: requestParameters.stop,
7603
8007
  units: requestParameters.units
7604
8008
  };
7605
- return createRequestFunction(await localVarAxiosParamCreator.replaceOrder(requestParameters.accountId, manualTradeReplaceForm, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7606
- authModes: ["commercialApiKey", "personalApiKey"],
8009
+ return createRequestFunction(await localVarAxiosParamCreator.replaceOrder(requestParameters.accountId, manualTradeReplaceForm, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
8010
+ authModes: [
8011
+ "commercialApiKey",
8012
+ "personalApiKey",
8013
+ "oauth"
8014
+ ],
7607
8015
  requestSigningByAuthMode: {
7608
8016
  "commercialApiKey": {
7609
8017
  secretParameter: "consumerKey",
@@ -7625,8 +8033,12 @@ const TradingApiFp = function(configuration) {
7625
8033
  */
7626
8034
  async searchCryptocurrencyPairInstruments(...args) {
7627
8035
  const [requestParameters = {}, options] = args;
7628
- return createRequestFunction(await localVarAxiosParamCreator.searchCryptocurrencyPairInstruments(requestParameters.accountId, requestParameters.base, requestParameters.quote, requestParameters.userId, requestParameters.userSecret, options), globalAxios, BASE_PATH, configuration, {
7629
- authModes: ["commercialApiKey", "personalApiKey"],
8036
+ return createRequestFunction(await localVarAxiosParamCreator.searchCryptocurrencyPairInstruments(requestParameters.accountId, requestParameters.base, requestParameters.quote, requestParameters.userId, requestParameters.userSecret, options), axios, BASE_PATH, configuration, {
8037
+ authModes: [
8038
+ "commercialApiKey",
8039
+ "personalApiKey",
8040
+ "oauth"
8041
+ ],
7630
8042
  requestSigningByAuthMode: {
7631
8043
  "commercialApiKey": {
7632
8044
  secretParameter: "consumerKey",
@@ -7979,6 +8391,15 @@ var PersonalApiKeyAuth = class PersonalApiKeyAuth {
7979
8391
  return new PersonalApiKeyAuth(params);
7980
8392
  }
7981
8393
  };
8394
+ var OAuthAuth = class OAuthAuth {
8395
+ constructor(params) {
8396
+ this.mode = "oauth";
8397
+ this.accessToken = params.accessToken;
8398
+ }
8399
+ static create(params) {
8400
+ return new OAuthAuth(params);
8401
+ }
8402
+ };
7982
8403
  var SnaptradeAuth = class {
7983
8404
  constructor() {}
7984
8405
  static ["commercialApiKey"](params) {
@@ -7987,6 +8408,9 @@ var SnaptradeAuth = class {
7987
8408
  static ["personalApiKey"](params) {
7988
8409
  return PersonalApiKeyAuth.create(params);
7989
8410
  }
8411
+ static ["oauth"](params) {
8412
+ return OAuthAuth.create(params);
8413
+ }
7990
8414
  };
7991
8415
  //#endregion
7992
8416
  //#region configuration.ts
@@ -8002,9 +8426,10 @@ var Configuration = class {
8002
8426
  this.consumerKey = param.auth.consumerKey;
8003
8427
  if (param.auth.clientId !== void 0) this.apiKey["clientId"] = param.auth.clientId;
8004
8428
  }
8429
+ if (param.auth.mode === "oauth") this.accessToken = param.auth.accessToken;
8005
8430
  this.basePath = param.basePath;
8006
8431
  this.baseOptions = param.baseOptions ?? {};
8007
- this.userAgent = param.userAgent === void 0 ? "Konfig/13.1.14/typescript" : param.userAgent;
8432
+ this.userAgent = param.userAgent === void 0 ? "Konfig/13.2.0/typescript" : param.userAgent;
8008
8433
  this.formDataCtor = param.formDataCtor;
8009
8434
  }
8010
8435
  /**
@@ -8043,4 +8468,109 @@ var Snaptrade = class extends SnaptradeCustom {
8043
8468
  }
8044
8469
  };
8045
8470
  //#endregion
8046
- export { AccountInformationApi, AccountInformationApiAxiosParamCreator, AccountInformationApiFactory, AccountInformationApiFp, AccountInformationApiGenerated, ApiStatusApi, ApiStatusApiAxiosParamCreator, ApiStatusApiFactory, ApiStatusApiFp, ApiStatusApiGenerated, AuthenticationApi, AuthenticationApiAxiosParamCreator, AuthenticationApiFactory, AuthenticationApiFp, AuthenticationApiGenerated, CommercialApiKeyAuth, Configuration, ConnectionsApi, ConnectionsApiAxiosParamCreator, ConnectionsApiFactory, ConnectionsApiFp, ConnectionsApiGenerated, ExperimentalEndpointsApi, ExperimentalEndpointsApiAxiosParamCreator, ExperimentalEndpointsApiFactory, ExperimentalEndpointsApiFp, ExperimentalEndpointsApiGenerated, ManagementApi, ManagementApiAxiosParamCreator, ManagementApiFactory, ManagementApiFp, ManagementApiGenerated, PersonalApiKeyAuth, ReferenceDataApi, ReferenceDataApiAxiosParamCreator, ReferenceDataApiFactory, ReferenceDataApiFp, ReferenceDataApiGenerated, Snaptrade, SnaptradeAuth, SnaptradeError, TradingApi, TradingApiAxiosParamCreator, TradingApiFactory, TradingApiFp, TradingApiGenerated, parseIfJson, readableStreamToString };
8471
+ //#region oauth-device.ts
8472
+ const expired = () => /* @__PURE__ */ new Error("Device authorization expired. Start a new authorization.");
8473
+ const aborted = () => Object.assign(/* @__PURE__ */ new Error("Device authorization cancelled."), { name: "AbortError" });
8474
+ const delay = (milliseconds, signal) => new Promise((resolve, reject) => {
8475
+ if (signal.aborted) {
8476
+ reject(aborted());
8477
+ return;
8478
+ }
8479
+ const cancel = () => {
8480
+ clearTimeout(timer);
8481
+ signal.removeEventListener("abort", cancel);
8482
+ reject(aborted());
8483
+ };
8484
+ const timer = setTimeout(() => {
8485
+ signal.removeEventListener("abort", cancel);
8486
+ resolve();
8487
+ }, milliseconds);
8488
+ signal.addEventListener("abort", cancel, { once: true });
8489
+ });
8490
+ /** Explicit device login for pre-registered public clients. Tokens remain application-owned. */
8491
+ var SnaptradeOAuthDevice = class {
8492
+ constructor(options = {}) {
8493
+ this.issuer = (options.issuer ?? new URL(BASE_PATH).origin).replace(/\/+$/, "");
8494
+ this.http = options.axios ?? axios;
8495
+ }
8496
+ /** Display userCode and verificationUri; keep deviceCode private. Access is read-only. */
8497
+ async startDeviceAuthorization(params) {
8498
+ const startedAt = Date.now();
8499
+ const { data } = await this.http.post(`${this.issuer}/oauth/device_authorization/`, new URLSearchParams({
8500
+ client_id: params.clientId,
8501
+ scope: "read"
8502
+ }).toString(), {
8503
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
8504
+ signal: params.signal
8505
+ });
8506
+ if (typeof data.device_code !== "string" || !data.device_code || typeof data.user_code !== "string" || !data.user_code || typeof data.verification_uri !== "string" || !data.verification_uri || !Number.isFinite(data.expires_in) || data.expires_in <= 0 || data.interval !== void 0 && (!Number.isFinite(data.interval) || data.interval <= 0)) throw new Error("Invalid device authorization response.");
8507
+ return {
8508
+ deviceCode: data.device_code,
8509
+ userCode: data.user_code,
8510
+ verificationUri: data.verification_uri,
8511
+ verificationUriComplete: data.verification_uri_complete,
8512
+ expiresAt: startedAt + data.expires_in * 1e3,
8513
+ interval: data.interval ?? 5
8514
+ };
8515
+ }
8516
+ /** Polls only for initial login. Does not store tokens or refresh them. */
8517
+ async waitForDeviceToken(params) {
8518
+ const { authorization, signal } = params;
8519
+ if (signal?.aborted) throw aborted();
8520
+ const remaining = authorization.expiresAt - Date.now();
8521
+ if (!Number.isFinite(remaining) || remaining <= 0) throw expired();
8522
+ if (!Number.isFinite(authorization.interval) || authorization.interval <= 0) throw new Error("Invalid polling interval.");
8523
+ const controller = new AbortController();
8524
+ const cancel = () => controller.abort();
8525
+ signal?.addEventListener("abort", cancel, { once: true });
8526
+ const deadline = setTimeout(cancel, Math.min(remaining, 2147483647));
8527
+ let interval = authorization.interval * 1e3;
8528
+ try {
8529
+ while (true) {
8530
+ await delay(Math.min(interval, Math.max(0, authorization.expiresAt - Date.now())), controller.signal);
8531
+ if (Date.now() >= authorization.expiresAt) throw expired();
8532
+ try {
8533
+ const { data } = await this.http.post(`${this.issuer}/oauth/token/`, new URLSearchParams({
8534
+ client_id: params.clientId,
8535
+ device_code: authorization.deviceCode,
8536
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
8537
+ }).toString(), {
8538
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
8539
+ signal: controller.signal,
8540
+ timeout: Math.min(3e4, Math.max(1, authorization.expiresAt - Date.now()))
8541
+ });
8542
+ if (typeof data.access_token !== "string" || !data.access_token) throw new Error("OAuth response is missing access_token.");
8543
+ return {
8544
+ accessToken: data.access_token,
8545
+ refreshToken: data.refresh_token,
8546
+ tokenType: data.token_type,
8547
+ expiresIn: data.expires_in,
8548
+ scope: data.scope
8549
+ };
8550
+ } catch (error) {
8551
+ const response = error;
8552
+ const code = response.response?.data?.error;
8553
+ if (code === "authorization_pending") continue;
8554
+ if (code === "slow_down") {
8555
+ interval += 5e3;
8556
+ continue;
8557
+ }
8558
+ if (response.code === "ECONNABORTED" || response.code === "ETIMEDOUT") {
8559
+ interval *= 2;
8560
+ continue;
8561
+ }
8562
+ throw error;
8563
+ }
8564
+ }
8565
+ } catch (error) {
8566
+ if (signal?.aborted) throw aborted();
8567
+ if (controller.signal.aborted || Date.now() >= authorization.expiresAt) throw expired();
8568
+ throw error;
8569
+ } finally {
8570
+ clearTimeout(deadline);
8571
+ signal?.removeEventListener("abort", cancel);
8572
+ }
8573
+ }
8574
+ };
8575
+ //#endregion
8576
+ export { AccountInformationApi, AccountInformationApiAxiosParamCreator, AccountInformationApiFactory, AccountInformationApiFp, AccountInformationApiGenerated, ApiStatusApi, ApiStatusApiAxiosParamCreator, ApiStatusApiFactory, ApiStatusApiFp, ApiStatusApiGenerated, AuthenticationApi, AuthenticationApiAxiosParamCreator, AuthenticationApiFactory, AuthenticationApiFp, AuthenticationApiGenerated, CommercialApiKeyAuth, Configuration, ConnectionsApi, ConnectionsApiAxiosParamCreator, ConnectionsApiFactory, ConnectionsApiFp, ConnectionsApiGenerated, ExperimentalEndpointsApi, ExperimentalEndpointsApiAxiosParamCreator, ExperimentalEndpointsApiFactory, ExperimentalEndpointsApiFp, ExperimentalEndpointsApiGenerated, ManagementApi, ManagementApiAxiosParamCreator, ManagementApiFactory, ManagementApiFp, ManagementApiGenerated, OAuthAuth, PersonalApiKeyAuth, ReferenceDataApi, ReferenceDataApiAxiosParamCreator, ReferenceDataApiFactory, ReferenceDataApiFp, ReferenceDataApiGenerated, Snaptrade, SnaptradeAuth, SnaptradeError, SnaptradeOAuthDevice, TradingApi, TradingApiAxiosParamCreator, TradingApiFactory, TradingApiFp, TradingApiGenerated, parseIfJson, readableStreamToString };