kalshi-typescript 2.1.1 → 2.1.3

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.
Files changed (210) hide show
  1. package/.openapi-generator/FILES +4 -1
  2. package/.openapi-generator-ignore +9 -2
  3. package/README.md +200 -29
  4. package/api/api-keys-api.ts +5 -5
  5. package/api/communications-api.ts +12 -12
  6. package/api/events-api.ts +4 -4
  7. package/api/exchange-api.ts +9 -9
  8. package/api/markets-api.ts +10 -10
  9. package/api/milestones-api.ts +3 -3
  10. package/api/multivariate-collections-api.ts +4 -4
  11. package/api/portfolio-api.ts +95 -21
  12. package/api/series-api.ts +3 -3
  13. package/api/structured-targets-api.ts +3 -3
  14. package/auth.ts +38 -0
  15. package/base.ts +51 -17
  16. package/common.ts +1 -1
  17. package/configuration.ts +1 -1
  18. package/dist/api/api-keys-api.d.ts +4 -4
  19. package/dist/api/api-keys-api.js +8 -8
  20. package/dist/api/communications-api.d.ts +11 -11
  21. package/dist/api/communications-api.js +22 -22
  22. package/dist/api/events-api.d.ts +3 -3
  23. package/dist/api/events-api.js +6 -6
  24. package/dist/api/exchange-api.d.ts +8 -8
  25. package/dist/api/exchange-api.js +12 -12
  26. package/dist/api/markets-api.d.ts +9 -9
  27. package/dist/api/markets-api.js +14 -14
  28. package/dist/api/milestones-api.d.ts +2 -2
  29. package/dist/api/milestones-api.js +4 -4
  30. package/dist/api/multivariate-collections-api.d.ts +3 -3
  31. package/dist/api/multivariate-collections-api.js +6 -6
  32. package/dist/api/portfolio-api.d.ts +52 -19
  33. package/dist/api/portfolio-api.js +107 -39
  34. package/dist/api/series-api.d.ts +2 -2
  35. package/dist/api/series-api.js +4 -4
  36. package/dist/api/structured-targets-api.d.ts +2 -2
  37. package/dist/api/structured-targets-api.js +4 -4
  38. package/dist/auth.d.ts +7 -0
  39. package/dist/auth.js +33 -0
  40. package/dist/base.d.ts +25 -10
  41. package/dist/base.js +37 -6
  42. package/dist/esm/api/api-keys-api.d.ts +4 -4
  43. package/dist/esm/api/api-keys-api.js +9 -9
  44. package/dist/esm/api/communications-api.d.ts +11 -11
  45. package/dist/esm/api/communications-api.js +23 -23
  46. package/dist/esm/api/events-api.d.ts +3 -3
  47. package/dist/esm/api/events-api.js +7 -7
  48. package/dist/esm/api/exchange-api.d.ts +8 -8
  49. package/dist/esm/api/exchange-api.js +13 -13
  50. package/dist/esm/api/markets-api.d.ts +9 -9
  51. package/dist/esm/api/markets-api.js +15 -15
  52. package/dist/esm/api/milestones-api.d.ts +2 -2
  53. package/dist/esm/api/milestones-api.js +5 -5
  54. package/dist/esm/api/multivariate-collections-api.d.ts +3 -3
  55. package/dist/esm/api/multivariate-collections-api.js +7 -7
  56. package/dist/esm/api/portfolio-api.d.ts +52 -19
  57. package/dist/esm/api/portfolio-api.js +108 -40
  58. package/dist/esm/api/series-api.d.ts +2 -2
  59. package/dist/esm/api/series-api.js +5 -5
  60. package/dist/esm/api/structured-targets-api.d.ts +2 -2
  61. package/dist/esm/api/structured-targets-api.js +5 -5
  62. package/dist/esm/auth.d.ts +7 -0
  63. package/dist/esm/auth.js +29 -0
  64. package/dist/esm/base.d.ts +25 -10
  65. package/dist/esm/base.js +36 -5
  66. package/dist/esm/models/amend-order-request.d.ts +30 -0
  67. package/dist/esm/models/amend-order-request.js +8 -1
  68. package/dist/esm/models/create-order-group-request.d.ts +4 -1
  69. package/dist/esm/models/create-order-group-response.d.ts +4 -2
  70. package/dist/esm/models/create-order-request.d.ts +8 -0
  71. package/dist/esm/models/error-response-error.d.ts +1 -1
  72. package/dist/esm/models/event-position.d.ts +53 -0
  73. package/dist/esm/models/event-position.js +14 -0
  74. package/dist/esm/models/get-order-group-response.d.ts +21 -0
  75. package/dist/esm/models/get-order-group-response.js +14 -0
  76. package/dist/esm/models/get-order-response.d.ts +1 -1
  77. package/dist/esm/models/get-positions-response.d.ts +3 -1
  78. package/dist/esm/models/index.d.ts +2 -0
  79. package/dist/esm/models/index.js +2 -0
  80. package/dist/esm/models/order-group.d.ts +8 -4
  81. package/dist/esm/models/order.d.ts +16 -0
  82. package/dist/models/amend-order-request.d.ts +30 -0
  83. package/dist/models/amend-order-request.js +9 -0
  84. package/dist/models/create-order-group-request.d.ts +4 -1
  85. package/dist/models/create-order-group-response.d.ts +4 -2
  86. package/dist/models/create-order-request.d.ts +8 -0
  87. package/dist/models/error-response-error.d.ts +1 -1
  88. package/dist/models/event-position.d.ts +53 -0
  89. package/dist/models/event-position.js +15 -0
  90. package/dist/models/get-order-group-response.d.ts +21 -0
  91. package/dist/models/get-order-group-response.js +15 -0
  92. package/dist/models/get-order-response.d.ts +1 -1
  93. package/dist/models/get-positions-response.d.ts +3 -1
  94. package/dist/models/index.d.ts +2 -0
  95. package/dist/models/index.js +2 -0
  96. package/dist/models/order-group.d.ts +8 -4
  97. package/dist/models/order.d.ts +16 -0
  98. package/docs/AcceptQuoteRequest.md +1 -1
  99. package/docs/AmendOrderRequest.md +11 -1
  100. package/docs/AmendOrderResponse.md +1 -1
  101. package/docs/Announcement.md +1 -1
  102. package/docs/ApiKey.md +1 -1
  103. package/docs/ApiKeysApi.md +20 -8
  104. package/docs/BatchCancelOrdersRequest.md +1 -1
  105. package/docs/BatchCancelOrdersResponse.md +1 -1
  106. package/docs/BatchCancelOrdersResponseResponsesInner.md +1 -1
  107. package/docs/BatchCreateOrdersRequest.md +1 -1
  108. package/docs/BatchCreateOrdersResponse.md +1 -1
  109. package/docs/BatchCreateOrdersResponseResponsesInner.md +1 -1
  110. package/docs/CancelOrderResponse.md +1 -1
  111. package/docs/Candlestick.md +1 -1
  112. package/docs/CommunicationsApi.md +55 -22
  113. package/docs/CreateApiKeyRequest.md +1 -1
  114. package/docs/CreateApiKeyResponse.md +1 -1
  115. package/docs/CreateOrderGroupRequest.md +3 -3
  116. package/docs/CreateOrderGroupResponse.md +3 -3
  117. package/docs/CreateOrderRequest.md +5 -1
  118. package/docs/CreateOrderResponse.md +1 -1
  119. package/docs/CreateQuoteRequest.md +1 -1
  120. package/docs/CreateQuoteResponse.md +1 -1
  121. package/docs/CreateRFQRequest.md +1 -1
  122. package/docs/CreateRFQResponse.md +1 -1
  123. package/docs/DailySchedule.md +1 -1
  124. package/docs/DecreaseOrderRequest.md +1 -1
  125. package/docs/DecreaseOrderResponse.md +1 -1
  126. package/docs/ErrorResponse.md +1 -1
  127. package/docs/ErrorResponseError.md +2 -2
  128. package/docs/Event.md +1 -1
  129. package/docs/EventPosition.md +38 -0
  130. package/docs/EventsApi.md +15 -6
  131. package/docs/ExchangeApi.md +21 -9
  132. package/docs/ExchangeStatus.md +1 -1
  133. package/docs/Fill.md +1 -1
  134. package/docs/GenerateApiKeyRequest.md +1 -1
  135. package/docs/GenerateApiKeyResponse.md +1 -1
  136. package/docs/GetApiKeysResponse.md +1 -1
  137. package/docs/GetBalanceResponse.md +1 -1
  138. package/docs/GetCommunicationsIDResponse.md +1 -1
  139. package/docs/GetEventMetadataResponse.md +1 -1
  140. package/docs/GetEventResponse.md +1 -1
  141. package/docs/GetEventsResponse.md +1 -1
  142. package/docs/GetExchangeAnnouncementsResponse.md +1 -1
  143. package/docs/GetExchangeScheduleResponse.md +1 -1
  144. package/docs/GetExchangeScheduleResponseSchedule.md +1 -1
  145. package/docs/GetFillsResponse.md +1 -1
  146. package/docs/GetMarketCandlesticksResponse.md +1 -1
  147. package/docs/GetMarketOrderbookResponse.md +1 -1
  148. package/docs/GetMarketOrderbookResponseOrderbook.md +1 -1
  149. package/docs/GetMarketResponse.md +1 -1
  150. package/docs/GetMarketsResponse.md +1 -1
  151. package/docs/GetMilestoneResponse.md +1 -1
  152. package/docs/GetMilestonesResponse.md +1 -1
  153. package/docs/GetMultivariateEventCollectionResponse.md +1 -1
  154. package/docs/GetMultivariateEventCollectionsResponse.md +1 -1
  155. package/docs/GetOrderGroupResponse.md +22 -0
  156. package/docs/GetOrderGroupsResponse.md +1 -1
  157. package/docs/GetOrderQueuePositionResponse.md +1 -1
  158. package/docs/GetOrderResponse.md +2 -2
  159. package/docs/GetOrdersResponse.md +1 -1
  160. package/docs/GetPositionsResponse.md +5 -3
  161. package/docs/GetQueuePositionsRequest.md +1 -1
  162. package/docs/GetQueuePositionsResponse.md +1 -1
  163. package/docs/GetQuoteResponse.md +1 -1
  164. package/docs/GetQuotesResponse.md +1 -1
  165. package/docs/GetRFQResponse.md +1 -1
  166. package/docs/GetRFQsResponse.md +1 -1
  167. package/docs/GetSeriesByTickerResponse.md +1 -1
  168. package/docs/GetSeriesResponse.md +1 -1
  169. package/docs/GetSettlementsResponse.md +1 -1
  170. package/docs/GetStructuredTargetResponse.md +1 -1
  171. package/docs/GetStructuredTargetsResponse.md +1 -1
  172. package/docs/GetTotalRestingOrderValueResponse.md +1 -1
  173. package/docs/GetTradesResponse.md +1 -1
  174. package/docs/GetUserDataTimestampResponse.md +1 -1
  175. package/docs/LookupBundleRequest.md +1 -1
  176. package/docs/LookupBundleRequestBundleInner.md +1 -1
  177. package/docs/LookupBundleResponse.md +1 -1
  178. package/docs/Market.md +1 -1
  179. package/docs/MarketsApi.md +26 -11
  180. package/docs/Milestone.md +1 -1
  181. package/docs/MilestonesApi.md +10 -4
  182. package/docs/MultivariateCollectionsApi.md +15 -6
  183. package/docs/MultivariateEventCollection.md +1 -1
  184. package/docs/MultivariateEventCollectionEventsInner.md +1 -1
  185. package/docs/Order.md +9 -1
  186. package/docs/OrderGroup.md +5 -9
  187. package/docs/OrderbookLevel.md +1 -1
  188. package/docs/PortfolioApi.md +154 -39
  189. package/docs/Position.md +1 -1
  190. package/docs/Quote.md +1 -1
  191. package/docs/RFQ.md +1 -1
  192. package/docs/Series.md +1 -1
  193. package/docs/SeriesApi.md +10 -4
  194. package/docs/Settlement.md +1 -1
  195. package/docs/StructuredTarget.md +1 -1
  196. package/docs/StructuredTargetsApi.md +10 -4
  197. package/docs/Trade.md +1 -1
  198. package/models/amend-order-request.ts +34 -0
  199. package/models/create-order-group-request.ts +4 -1
  200. package/models/create-order-group-response.ts +4 -4
  201. package/models/create-order-request.ts +8 -0
  202. package/models/error-response-error.ts +1 -1
  203. package/models/event-position.ts +59 -0
  204. package/models/get-order-group-response.ts +27 -0
  205. package/models/get-order-response.ts +1 -1
  206. package/models/get-positions-response.ts +5 -1
  207. package/models/index.ts +2 -0
  208. package/models/order-group.ts +8 -4
  209. package/models/order.ts +16 -0
  210. package/package.json +4 -4
@@ -28,7 +28,7 @@ import { URL } from 'url';
28
28
  // @ts-ignore
29
29
  import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
30
30
  // @ts-ignore
31
- import { BASE_PATH, BaseAPI, operationServerMap } from '../base';
31
+ import { BASE_PATH, BaseAPI } from '../base';
32
32
  /**
33
33
  * PortfolioApi - axios parameter creator
34
34
  */
@@ -416,6 +416,38 @@ export const PortfolioApiAxiosParamCreator = function (configuration) {
416
416
  options: localVarRequestOptions,
417
417
  };
418
418
  }),
419
+ /**
420
+ * Get details of a specific order group
421
+ * @summary Get Order Group
422
+ * @param {string} orderGroupId Order group ID
423
+ * @param {*} [options] Override http request option.
424
+ * @throws {RequiredError}
425
+ */
426
+ getOrderGroup: (orderGroupId_1, ...args_1) => __awaiter(this, [orderGroupId_1, ...args_1], void 0, function* (orderGroupId, options = {}) {
427
+ // verify required parameter 'orderGroupId' is not null or undefined
428
+ assertParamExists('getOrderGroup', 'orderGroupId', orderGroupId);
429
+ const localVarPath = `/portfolio/order_groups/{order_group_id}`
430
+ .replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
431
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
432
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
433
+ let baseOptions;
434
+ if (configuration) {
435
+ baseOptions = configuration.baseOptions;
436
+ }
437
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
438
+ const localVarHeaderParameter = {};
439
+ const localVarQueryParameter = {};
440
+ // authentication bearerAuth required
441
+ // http bearer authentication required
442
+ yield setBearerAuthToObject(localVarHeaderParameter, configuration);
443
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
444
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
445
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
446
+ return {
447
+ url: toPathString(localVarUrlObj),
448
+ options: localVarRequestOptions,
449
+ };
450
+ }),
419
451
  /**
420
452
  * Get order groups for the logged-in user
421
453
  * @summary Get Order Groups
@@ -711,7 +743,7 @@ export const PortfolioApiAxiosParamCreator = function (configuration) {
711
743
  if (configuration) {
712
744
  baseOptions = configuration.baseOptions;
713
745
  }
714
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
746
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
715
747
  const localVarHeaderParameter = {};
716
748
  const localVarQueryParameter = {};
717
749
  // authentication bearerAuth required
@@ -743,10 +775,10 @@ export const PortfolioApiFp = function (configuration) {
743
775
  */
744
776
  amendOrder(orderId, amendOrderRequest, options) {
745
777
  return __awaiter(this, void 0, void 0, function* () {
746
- var _a, _b, _c;
778
+ var _a;
747
779
  const localVarAxiosArgs = yield localVarAxiosParamCreator.amendOrder(orderId, amendOrderRequest, options);
748
780
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
749
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.amendOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
781
+ const localVarOperationServerBasePath = undefined;
750
782
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
751
783
  });
752
784
  },
@@ -759,10 +791,10 @@ export const PortfolioApiFp = function (configuration) {
759
791
  */
760
792
  batchCancelOrders(batchCancelOrdersRequest, options) {
761
793
  return __awaiter(this, void 0, void 0, function* () {
762
- var _a, _b, _c;
794
+ var _a;
763
795
  const localVarAxiosArgs = yield localVarAxiosParamCreator.batchCancelOrders(batchCancelOrdersRequest, options);
764
796
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
765
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.batchCancelOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
797
+ const localVarOperationServerBasePath = undefined;
766
798
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
767
799
  });
768
800
  },
@@ -775,10 +807,10 @@ export const PortfolioApiFp = function (configuration) {
775
807
  */
776
808
  batchCreateOrders(batchCreateOrdersRequest, options) {
777
809
  return __awaiter(this, void 0, void 0, function* () {
778
- var _a, _b, _c;
810
+ var _a;
779
811
  const localVarAxiosArgs = yield localVarAxiosParamCreator.batchCreateOrders(batchCreateOrdersRequest, options);
780
812
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
781
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.batchCreateOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
813
+ const localVarOperationServerBasePath = undefined;
782
814
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
783
815
  });
784
816
  },
@@ -791,10 +823,10 @@ export const PortfolioApiFp = function (configuration) {
791
823
  */
792
824
  cancelOrder(orderId, options) {
793
825
  return __awaiter(this, void 0, void 0, function* () {
794
- var _a, _b, _c;
826
+ var _a;
795
827
  const localVarAxiosArgs = yield localVarAxiosParamCreator.cancelOrder(orderId, options);
796
828
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
797
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.cancelOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
829
+ const localVarOperationServerBasePath = undefined;
798
830
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
799
831
  });
800
832
  },
@@ -807,10 +839,10 @@ export const PortfolioApiFp = function (configuration) {
807
839
  */
808
840
  createOrder(createOrderRequest, options) {
809
841
  return __awaiter(this, void 0, void 0, function* () {
810
- var _a, _b, _c;
842
+ var _a;
811
843
  const localVarAxiosArgs = yield localVarAxiosParamCreator.createOrder(createOrderRequest, options);
812
844
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
813
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.createOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
845
+ const localVarOperationServerBasePath = undefined;
814
846
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
815
847
  });
816
848
  },
@@ -823,10 +855,10 @@ export const PortfolioApiFp = function (configuration) {
823
855
  */
824
856
  createOrderGroup(createOrderGroupRequest, options) {
825
857
  return __awaiter(this, void 0, void 0, function* () {
826
- var _a, _b, _c;
858
+ var _a;
827
859
  const localVarAxiosArgs = yield localVarAxiosParamCreator.createOrderGroup(createOrderGroupRequest, options);
828
860
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
829
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.createOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
861
+ const localVarOperationServerBasePath = undefined;
830
862
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
831
863
  });
832
864
  },
@@ -840,10 +872,10 @@ export const PortfolioApiFp = function (configuration) {
840
872
  */
841
873
  decreaseOrder(orderId, decreaseOrderRequest, options) {
842
874
  return __awaiter(this, void 0, void 0, function* () {
843
- var _a, _b, _c;
875
+ var _a;
844
876
  const localVarAxiosArgs = yield localVarAxiosParamCreator.decreaseOrder(orderId, decreaseOrderRequest, options);
845
877
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
846
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.decreaseOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
878
+ const localVarOperationServerBasePath = undefined;
847
879
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
848
880
  });
849
881
  },
@@ -856,10 +888,10 @@ export const PortfolioApiFp = function (configuration) {
856
888
  */
857
889
  deleteOrderGroup(orderGroupId, options) {
858
890
  return __awaiter(this, void 0, void 0, function* () {
859
- var _a, _b, _c;
891
+ var _a;
860
892
  const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteOrderGroup(orderGroupId, options);
861
893
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
862
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.deleteOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
894
+ const localVarOperationServerBasePath = undefined;
863
895
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
864
896
  });
865
897
  },
@@ -871,10 +903,10 @@ export const PortfolioApiFp = function (configuration) {
871
903
  */
872
904
  getBalance(options) {
873
905
  return __awaiter(this, void 0, void 0, function* () {
874
- var _a, _b, _c;
906
+ var _a;
875
907
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getBalance(options);
876
908
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
877
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getBalance']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
909
+ const localVarOperationServerBasePath = undefined;
878
910
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
879
911
  });
880
912
  },
@@ -892,10 +924,10 @@ export const PortfolioApiFp = function (configuration) {
892
924
  */
893
925
  getFills(ticker, orderId, minTs, maxTs, limit, cursor, options) {
894
926
  return __awaiter(this, void 0, void 0, function* () {
895
- var _a, _b, _c;
927
+ var _a;
896
928
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getFills(ticker, orderId, minTs, maxTs, limit, cursor, options);
897
929
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
898
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getFills']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
930
+ const localVarOperationServerBasePath = undefined;
899
931
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
900
932
  });
901
933
  },
@@ -908,10 +940,26 @@ export const PortfolioApiFp = function (configuration) {
908
940
  */
909
941
  getOrder(orderId, options) {
910
942
  return __awaiter(this, void 0, void 0, function* () {
911
- var _a, _b, _c;
943
+ var _a;
912
944
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrder(orderId, options);
913
945
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
914
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
946
+ const localVarOperationServerBasePath = undefined;
947
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
948
+ });
949
+ },
950
+ /**
951
+ * Get details of a specific order group
952
+ * @summary Get Order Group
953
+ * @param {string} orderGroupId Order group ID
954
+ * @param {*} [options] Override http request option.
955
+ * @throws {RequiredError}
956
+ */
957
+ getOrderGroup(orderGroupId, options) {
958
+ return __awaiter(this, void 0, void 0, function* () {
959
+ var _a;
960
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroup(orderGroupId, options);
961
+ const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
962
+ const localVarOperationServerBasePath = undefined;
915
963
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
916
964
  });
917
965
  },
@@ -926,10 +974,10 @@ export const PortfolioApiFp = function (configuration) {
926
974
  */
927
975
  getOrderGroups(status, limit, cursor, options) {
928
976
  return __awaiter(this, void 0, void 0, function* () {
929
- var _a, _b, _c;
977
+ var _a;
930
978
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroups(status, limit, cursor, options);
931
979
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
932
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getOrderGroups']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
980
+ const localVarOperationServerBasePath = undefined;
933
981
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
934
982
  });
935
983
  },
@@ -942,10 +990,10 @@ export const PortfolioApiFp = function (configuration) {
942
990
  */
943
991
  getOrderQueuePosition(orderId, options) {
944
992
  return __awaiter(this, void 0, void 0, function* () {
945
- var _a, _b, _c;
993
+ var _a;
946
994
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderQueuePosition(orderId, options);
947
995
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
948
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getOrderQueuePosition']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
996
+ const localVarOperationServerBasePath = undefined;
949
997
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
950
998
  });
951
999
  },
@@ -964,10 +1012,10 @@ export const PortfolioApiFp = function (configuration) {
964
1012
  */
965
1013
  getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, options) {
966
1014
  return __awaiter(this, void 0, void 0, function* () {
967
- var _a, _b, _c;
1015
+ var _a;
968
1016
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, options);
969
1017
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
970
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1018
+ const localVarOperationServerBasePath = undefined;
971
1019
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
972
1020
  });
973
1021
  },
@@ -985,10 +1033,10 @@ export const PortfolioApiFp = function (configuration) {
985
1033
  */
986
1034
  getPositions(ticker, eventTicker, countDown, countUp, limit, cursor, options) {
987
1035
  return __awaiter(this, void 0, void 0, function* () {
988
- var _a, _b, _c;
1036
+ var _a;
989
1037
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getPositions(ticker, eventTicker, countDown, countUp, limit, cursor, options);
990
1038
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
991
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getPositions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1039
+ const localVarOperationServerBasePath = undefined;
992
1040
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
993
1041
  });
994
1042
  },
@@ -1001,10 +1049,10 @@ export const PortfolioApiFp = function (configuration) {
1001
1049
  */
1002
1050
  getQueuePositions(getQueuePositionsRequest, options) {
1003
1051
  return __awaiter(this, void 0, void 0, function* () {
1004
- var _a, _b, _c;
1052
+ var _a;
1005
1053
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getQueuePositions(getQueuePositionsRequest, options);
1006
1054
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1007
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getQueuePositions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1055
+ const localVarOperationServerBasePath = undefined;
1008
1056
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1009
1057
  });
1010
1058
  },
@@ -1018,10 +1066,10 @@ export const PortfolioApiFp = function (configuration) {
1018
1066
  */
1019
1067
  getSettlements(limit, cursor, options) {
1020
1068
  return __awaiter(this, void 0, void 0, function* () {
1021
- var _a, _b, _c;
1069
+ var _a;
1022
1070
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getSettlements(limit, cursor, options);
1023
1071
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1024
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getSettlements']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1072
+ const localVarOperationServerBasePath = undefined;
1025
1073
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1026
1074
  });
1027
1075
  },
@@ -1033,10 +1081,10 @@ export const PortfolioApiFp = function (configuration) {
1033
1081
  */
1034
1082
  getTotalRestingOrderValue(options) {
1035
1083
  return __awaiter(this, void 0, void 0, function* () {
1036
- var _a, _b, _c;
1084
+ var _a;
1037
1085
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getTotalRestingOrderValue(options);
1038
1086
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1039
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getTotalRestingOrderValue']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1087
+ const localVarOperationServerBasePath = undefined;
1040
1088
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1041
1089
  });
1042
1090
  },
@@ -1049,10 +1097,10 @@ export const PortfolioApiFp = function (configuration) {
1049
1097
  */
1050
1098
  resetOrderGroup(orderGroupId, options) {
1051
1099
  return __awaiter(this, void 0, void 0, function* () {
1052
- var _a, _b, _c;
1100
+ var _a;
1053
1101
  const localVarAxiosArgs = yield localVarAxiosParamCreator.resetOrderGroup(orderGroupId, options);
1054
1102
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1055
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.resetOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1103
+ const localVarOperationServerBasePath = undefined;
1056
1104
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1057
1105
  });
1058
1106
  },
@@ -1180,6 +1228,16 @@ export const PortfolioApiFactory = function (configuration, basePath, axios) {
1180
1228
  getOrder(orderId, options) {
1181
1229
  return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath));
1182
1230
  },
1231
+ /**
1232
+ * Get details of a specific order group
1233
+ * @summary Get Order Group
1234
+ * @param {string} orderGroupId Order group ID
1235
+ * @param {*} [options] Override http request option.
1236
+ * @throws {RequiredError}
1237
+ */
1238
+ getOrderGroup(orderGroupId, options) {
1239
+ return localVarFp.getOrderGroup(orderGroupId, options).then((request) => request(axios, basePath));
1240
+ },
1183
1241
  /**
1184
1242
  * Get order groups for the logged-in user
1185
1243
  * @summary Get Order Groups
@@ -1395,6 +1453,16 @@ export class PortfolioApi extends BaseAPI {
1395
1453
  getOrder(orderId, options) {
1396
1454
  return PortfolioApiFp(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath));
1397
1455
  }
1456
+ /**
1457
+ * Get details of a specific order group
1458
+ * @summary Get Order Group
1459
+ * @param {string} orderGroupId Order group ID
1460
+ * @param {*} [options] Override http request option.
1461
+ * @throws {RequiredError}
1462
+ */
1463
+ getOrderGroup(orderGroupId, options) {
1464
+ return PortfolioApiFp(this.configuration).getOrderGroup(orderGroupId, options).then((request) => request(this.axios, this.basePath));
1465
+ }
1398
1466
  /**
1399
1467
  * Get order groups for the logged-in user
1400
1468
  * @summary Get Order Groups
@@ -88,7 +88,7 @@ export declare class SeriesApi extends BaseAPI {
88
88
  * @param {*} [options] Override http request option.
89
89
  * @throws {RequiredError}
90
90
  */
91
- getSeries(status?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesResponse, any>>;
91
+ getSeries(status?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesResponse, any, {}>>;
92
92
  /**
93
93
  * Get a single series by its ticker
94
94
  * @summary Get Series by Ticker
@@ -96,5 +96,5 @@ export declare class SeriesApi extends BaseAPI {
96
96
  * @param {*} [options] Override http request option.
97
97
  * @throws {RequiredError}
98
98
  */
99
- getSeriesByTicker(ticker: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesByTickerResponse, any>>;
99
+ getSeriesByTicker(ticker: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesByTickerResponse, any, {}>>;
100
100
  }
@@ -28,7 +28,7 @@ import { URL } from 'url';
28
28
  // @ts-ignore
29
29
  import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, toPathString, createRequestFunction } from '../common';
30
30
  // @ts-ignore
31
- import { BASE_PATH, BaseAPI, operationServerMap } from '../base';
31
+ import { BASE_PATH, BaseAPI } from '../base';
32
32
  /**
33
33
  * SeriesApi - axios parameter creator
34
34
  */
@@ -115,10 +115,10 @@ export const SeriesApiFp = function (configuration) {
115
115
  */
116
116
  getSeries(status, options) {
117
117
  return __awaiter(this, void 0, void 0, function* () {
118
- var _a, _b, _c;
118
+ var _a;
119
119
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getSeries(status, options);
120
120
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
121
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['SeriesApi.getSeries']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
121
+ const localVarOperationServerBasePath = undefined;
122
122
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
123
123
  });
124
124
  },
@@ -131,10 +131,10 @@ export const SeriesApiFp = function (configuration) {
131
131
  */
132
132
  getSeriesByTicker(ticker, options) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
- var _a, _b, _c;
134
+ var _a;
135
135
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getSeriesByTicker(ticker, options);
136
136
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
137
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['SeriesApi.getSeriesByTicker']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
137
+ const localVarOperationServerBasePath = undefined;
138
138
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
139
139
  });
140
140
  },
@@ -91,7 +91,7 @@ export declare class StructuredTargetsApi extends BaseAPI {
91
91
  * @param {*} [options] Override http request option.
92
92
  * @throws {RequiredError}
93
93
  */
94
- getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetResponse, any>>;
94
+ getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetResponse, any, {}>>;
95
95
  /**
96
96
  * Get all structured targets
97
97
  * @summary Get Structured Targets
@@ -100,5 +100,5 @@ export declare class StructuredTargetsApi extends BaseAPI {
100
100
  * @param {*} [options] Override http request option.
101
101
  * @throws {RequiredError}
102
102
  */
103
- getStructuredTargets(status?: string, pageSize?: number, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetsResponse, any>>;
103
+ getStructuredTargets(status?: string, pageSize?: number, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetsResponse, any, {}>>;
104
104
  }
@@ -28,7 +28,7 @@ import { URL } from 'url';
28
28
  // @ts-ignore
29
29
  import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, toPathString, createRequestFunction } from '../common';
30
30
  // @ts-ignore
31
- import { BASE_PATH, BaseAPI, operationServerMap } from '../base';
31
+ import { BASE_PATH, BaseAPI } from '../base';
32
32
  /**
33
33
  * StructuredTargetsApi - axios parameter creator
34
34
  */
@@ -119,10 +119,10 @@ export const StructuredTargetsApiFp = function (configuration) {
119
119
  */
120
120
  getStructuredTarget(structuredTargetId, options) {
121
121
  return __awaiter(this, void 0, void 0, function* () {
122
- var _a, _b, _c;
122
+ var _a;
123
123
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTarget(structuredTargetId, options);
124
124
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
125
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['StructuredTargetsApi.getStructuredTarget']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
125
+ const localVarOperationServerBasePath = undefined;
126
126
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
127
127
  });
128
128
  },
@@ -136,10 +136,10 @@ export const StructuredTargetsApiFp = function (configuration) {
136
136
  */
137
137
  getStructuredTargets(status, pageSize, options) {
138
138
  return __awaiter(this, void 0, void 0, function* () {
139
- var _a, _b, _c;
139
+ var _a;
140
140
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTargets(status, pageSize, options);
141
141
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
142
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['StructuredTargetsApi.getStructuredTargets']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
142
+ const localVarOperationServerBasePath = undefined;
143
143
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
144
144
  });
145
145
  },
@@ -0,0 +1,7 @@
1
+ export declare class KalshiAuth {
2
+ private apiKey;
3
+ private privateKeyPem;
4
+ constructor(apiKey: string, privateKeyPem: string);
5
+ private signPssText;
6
+ generateAuthHeaders(method: string, path: string): Record<string, string>;
7
+ }
@@ -0,0 +1,29 @@
1
+ import * as crypto from 'crypto';
2
+ export class KalshiAuth {
3
+ constructor(apiKey, privateKeyPem) {
4
+ this.apiKey = apiKey;
5
+ this.privateKeyPem = privateKeyPem;
6
+ }
7
+ signPssText(text) {
8
+ const sign = crypto.createSign('RSA-SHA256');
9
+ sign.update(text);
10
+ sign.end();
11
+ const signature = sign.sign({
12
+ key: this.privateKeyPem,
13
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
14
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
15
+ });
16
+ return signature.toString('base64');
17
+ }
18
+ generateAuthHeaders(method, path) {
19
+ const currentTimeMilliseconds = Date.now();
20
+ const timestampStr = currentTimeMilliseconds.toString();
21
+ const msgString = timestampStr + method + path;
22
+ const sig = this.signPssText(msgString);
23
+ return {
24
+ 'KALSHI-ACCESS-KEY': this.apiKey,
25
+ 'KALSHI-ACCESS-SIGNATURE': sig,
26
+ 'KALSHI-ACCESS-TIMESTAMP': timestampStr
27
+ };
28
+ }
29
+ }
@@ -10,33 +10,48 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import type { Configuration } from './configuration';
13
- import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
13
+ import type { AxiosInstance, AxiosRequestConfig } from 'axios';
14
+ import { KalshiAuth } from './auth';
14
15
  export declare const BASE_PATH: string;
16
+ /**
17
+ *
18
+ * @export
19
+ */
15
20
  export declare const COLLECTION_FORMATS: {
16
21
  csv: string;
17
22
  ssv: string;
18
23
  tsv: string;
19
24
  pipes: string;
20
25
  };
26
+ /**
27
+ *
28
+ * @export
29
+ * @interface RequestArgs
30
+ */
21
31
  export interface RequestArgs {
22
32
  url: string;
23
- options: RawAxiosRequestConfig;
33
+ options: AxiosRequestConfig;
24
34
  }
35
+ /**
36
+ *
37
+ * @export
38
+ * @class BaseAPI
39
+ */
25
40
  export declare class BaseAPI {
26
41
  protected basePath: string;
27
42
  protected axios: AxiosInstance;
28
43
  protected configuration: Configuration | undefined;
44
+ protected auth: KalshiAuth | undefined;
29
45
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
30
46
  }
47
+ /**
48
+ *
49
+ * @export
50
+ * @class RequiredError
51
+ * @extends {Error}
52
+ */
31
53
  export declare class RequiredError extends Error {
32
54
  field: string;
55
+ name: "RequiredError";
33
56
  constructor(field: string, msg?: string);
34
57
  }
35
- interface ServerMap {
36
- [key: string]: {
37
- url: string;
38
- description: string;
39
- }[];
40
- }
41
- export declare const operationServerMap: ServerMap;
42
- export {};
package/dist/esm/base.js CHANGED
@@ -1,5 +1,3 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
1
  /**
4
2
  * Kalshi Trading API
5
3
  * Complete API for the Kalshi trading platform including all handlers for SDK generation
@@ -12,25 +10,59 @@
12
10
  * Do not edit the class manually.
13
11
  */
14
12
  import globalAxios from 'axios';
13
+ import { KalshiAuth } from './auth';
15
14
  export const BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2".replace(/\/+$/, "");
15
+ /**
16
+ *
17
+ * @export
18
+ */
16
19
  export const COLLECTION_FORMATS = {
17
20
  csv: ",",
18
21
  ssv: " ",
19
22
  tsv: "\t",
20
23
  pipes: "|",
21
24
  };
25
+ /**
26
+ *
27
+ * @export
28
+ * @class BaseAPI
29
+ */
22
30
  export class BaseAPI {
23
31
  constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
24
- var _a;
25
32
  this.basePath = basePath;
26
33
  this.axios = axios;
27
34
  if (configuration) {
28
35
  this.configuration = configuration;
29
- this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
36
+ this.basePath = configuration.basePath || this.basePath;
37
+ // Initialize auth if credentials are provided
38
+ if (configuration.apiKey && (configuration.privateKeyPath || configuration.privateKeyPem)) {
39
+ const privateKey = configuration.privateKeyPem ||
40
+ (configuration.privateKeyPath ? require('fs').readFileSync(configuration.privateKeyPath, 'utf8') : '');
41
+ this.auth = new KalshiAuth(configuration.apiKey, privateKey);
42
+ }
30
43
  }
44
+ // Add request interceptor for authentication
45
+ this.axios.interceptors.request.use((config) => {
46
+ if (this.auth && config.url && config.method) {
47
+ // Extract path from URL
48
+ const url = new URL(config.url, this.basePath);
49
+ const path = url.pathname;
50
+ const method = config.method.toUpperCase();
51
+ // Generate and add auth headers
52
+ const authHeaders = this.auth.generateAuthHeaders(method, path);
53
+ Object.assign(config.headers, authHeaders);
54
+ }
55
+ return config;
56
+ });
31
57
  }
32
58
  }
33
59
  ;
60
+ /**
61
+ *
62
+ * @export
63
+ * @class RequiredError
64
+ * @extends {Error}
65
+ */
34
66
  export class RequiredError extends Error {
35
67
  constructor(field, msg) {
36
68
  super(msg);
@@ -38,4 +70,3 @@ export class RequiredError extends Error {
38
70
  this.name = "RequiredError";
39
71
  }
40
72
  }
41
- export const operationServerMap = {};