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
@@ -419,6 +419,38 @@ const PortfolioApiAxiosParamCreator = function (configuration) {
419
419
  options: localVarRequestOptions,
420
420
  };
421
421
  }),
422
+ /**
423
+ * Get details of a specific order group
424
+ * @summary Get Order Group
425
+ * @param {string} orderGroupId Order group ID
426
+ * @param {*} [options] Override http request option.
427
+ * @throws {RequiredError}
428
+ */
429
+ getOrderGroup: (orderGroupId_1, ...args_1) => __awaiter(this, [orderGroupId_1, ...args_1], void 0, function* (orderGroupId, options = {}) {
430
+ // verify required parameter 'orderGroupId' is not null or undefined
431
+ (0, common_1.assertParamExists)('getOrderGroup', 'orderGroupId', orderGroupId);
432
+ const localVarPath = `/portfolio/order_groups/{order_group_id}`
433
+ .replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
434
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
435
+ const localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
436
+ let baseOptions;
437
+ if (configuration) {
438
+ baseOptions = configuration.baseOptions;
439
+ }
440
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
441
+ const localVarHeaderParameter = {};
442
+ const localVarQueryParameter = {};
443
+ // authentication bearerAuth required
444
+ // http bearer authentication required
445
+ yield (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
446
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
447
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
448
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
449
+ return {
450
+ url: (0, common_1.toPathString)(localVarUrlObj),
451
+ options: localVarRequestOptions,
452
+ };
453
+ }),
422
454
  /**
423
455
  * Get order groups for the logged-in user
424
456
  * @summary Get Order Groups
@@ -714,7 +746,7 @@ const PortfolioApiAxiosParamCreator = function (configuration) {
714
746
  if (configuration) {
715
747
  baseOptions = configuration.baseOptions;
716
748
  }
717
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
749
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
718
750
  const localVarHeaderParameter = {};
719
751
  const localVarQueryParameter = {};
720
752
  // authentication bearerAuth required
@@ -747,10 +779,10 @@ const PortfolioApiFp = function (configuration) {
747
779
  */
748
780
  amendOrder(orderId, amendOrderRequest, options) {
749
781
  return __awaiter(this, void 0, void 0, function* () {
750
- var _a, _b, _c;
782
+ var _a;
751
783
  const localVarAxiosArgs = yield localVarAxiosParamCreator.amendOrder(orderId, amendOrderRequest, options);
752
784
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
753
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.amendOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
785
+ const localVarOperationServerBasePath = undefined;
754
786
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
755
787
  });
756
788
  },
@@ -763,10 +795,10 @@ const PortfolioApiFp = function (configuration) {
763
795
  */
764
796
  batchCancelOrders(batchCancelOrdersRequest, options) {
765
797
  return __awaiter(this, void 0, void 0, function* () {
766
- var _a, _b, _c;
798
+ var _a;
767
799
  const localVarAxiosArgs = yield localVarAxiosParamCreator.batchCancelOrders(batchCancelOrdersRequest, options);
768
800
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
769
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.batchCancelOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
801
+ const localVarOperationServerBasePath = undefined;
770
802
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
771
803
  });
772
804
  },
@@ -779,10 +811,10 @@ const PortfolioApiFp = function (configuration) {
779
811
  */
780
812
  batchCreateOrders(batchCreateOrdersRequest, options) {
781
813
  return __awaiter(this, void 0, void 0, function* () {
782
- var _a, _b, _c;
814
+ var _a;
783
815
  const localVarAxiosArgs = yield localVarAxiosParamCreator.batchCreateOrders(batchCreateOrdersRequest, options);
784
816
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
785
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.batchCreateOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
817
+ const localVarOperationServerBasePath = undefined;
786
818
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
787
819
  });
788
820
  },
@@ -795,10 +827,10 @@ const PortfolioApiFp = function (configuration) {
795
827
  */
796
828
  cancelOrder(orderId, options) {
797
829
  return __awaiter(this, void 0, void 0, function* () {
798
- var _a, _b, _c;
830
+ var _a;
799
831
  const localVarAxiosArgs = yield localVarAxiosParamCreator.cancelOrder(orderId, options);
800
832
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
801
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.cancelOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
833
+ const localVarOperationServerBasePath = undefined;
802
834
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
803
835
  });
804
836
  },
@@ -811,10 +843,10 @@ const PortfolioApiFp = function (configuration) {
811
843
  */
812
844
  createOrder(createOrderRequest, options) {
813
845
  return __awaiter(this, void 0, void 0, function* () {
814
- var _a, _b, _c;
846
+ var _a;
815
847
  const localVarAxiosArgs = yield localVarAxiosParamCreator.createOrder(createOrderRequest, options);
816
848
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
817
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.createOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
849
+ const localVarOperationServerBasePath = undefined;
818
850
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
819
851
  });
820
852
  },
@@ -827,10 +859,10 @@ const PortfolioApiFp = function (configuration) {
827
859
  */
828
860
  createOrderGroup(createOrderGroupRequest, options) {
829
861
  return __awaiter(this, void 0, void 0, function* () {
830
- var _a, _b, _c;
862
+ var _a;
831
863
  const localVarAxiosArgs = yield localVarAxiosParamCreator.createOrderGroup(createOrderGroupRequest, options);
832
864
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
833
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.createOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
865
+ const localVarOperationServerBasePath = undefined;
834
866
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
835
867
  });
836
868
  },
@@ -844,10 +876,10 @@ const PortfolioApiFp = function (configuration) {
844
876
  */
845
877
  decreaseOrder(orderId, decreaseOrderRequest, options) {
846
878
  return __awaiter(this, void 0, void 0, function* () {
847
- var _a, _b, _c;
879
+ var _a;
848
880
  const localVarAxiosArgs = yield localVarAxiosParamCreator.decreaseOrder(orderId, decreaseOrderRequest, options);
849
881
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
850
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.decreaseOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
882
+ const localVarOperationServerBasePath = undefined;
851
883
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
852
884
  });
853
885
  },
@@ -860,10 +892,10 @@ const PortfolioApiFp = function (configuration) {
860
892
  */
861
893
  deleteOrderGroup(orderGroupId, options) {
862
894
  return __awaiter(this, void 0, void 0, function* () {
863
- var _a, _b, _c;
895
+ var _a;
864
896
  const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteOrderGroup(orderGroupId, options);
865
897
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
866
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.deleteOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
898
+ const localVarOperationServerBasePath = undefined;
867
899
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
868
900
  });
869
901
  },
@@ -875,10 +907,10 @@ const PortfolioApiFp = function (configuration) {
875
907
  */
876
908
  getBalance(options) {
877
909
  return __awaiter(this, void 0, void 0, function* () {
878
- var _a, _b, _c;
910
+ var _a;
879
911
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getBalance(options);
880
912
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
881
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getBalance']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
913
+ const localVarOperationServerBasePath = undefined;
882
914
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
883
915
  });
884
916
  },
@@ -896,10 +928,10 @@ const PortfolioApiFp = function (configuration) {
896
928
  */
897
929
  getFills(ticker, orderId, minTs, maxTs, limit, cursor, options) {
898
930
  return __awaiter(this, void 0, void 0, function* () {
899
- var _a, _b, _c;
931
+ var _a;
900
932
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getFills(ticker, orderId, minTs, maxTs, limit, cursor, options);
901
933
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
902
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getFills']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
934
+ const localVarOperationServerBasePath = undefined;
903
935
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
904
936
  });
905
937
  },
@@ -912,10 +944,26 @@ const PortfolioApiFp = function (configuration) {
912
944
  */
913
945
  getOrder(orderId, options) {
914
946
  return __awaiter(this, void 0, void 0, function* () {
915
- var _a, _b, _c;
947
+ var _a;
916
948
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrder(orderId, options);
917
949
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
918
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getOrder']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
950
+ const localVarOperationServerBasePath = undefined;
951
+ return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
952
+ });
953
+ },
954
+ /**
955
+ * Get details of a specific order group
956
+ * @summary Get Order Group
957
+ * @param {string} orderGroupId Order group ID
958
+ * @param {*} [options] Override http request option.
959
+ * @throws {RequiredError}
960
+ */
961
+ getOrderGroup(orderGroupId, options) {
962
+ return __awaiter(this, void 0, void 0, function* () {
963
+ var _a;
964
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroup(orderGroupId, options);
965
+ const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
966
+ const localVarOperationServerBasePath = undefined;
919
967
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
920
968
  });
921
969
  },
@@ -930,10 +978,10 @@ const PortfolioApiFp = function (configuration) {
930
978
  */
931
979
  getOrderGroups(status, limit, cursor, options) {
932
980
  return __awaiter(this, void 0, void 0, function* () {
933
- var _a, _b, _c;
981
+ var _a;
934
982
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroups(status, limit, cursor, options);
935
983
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
936
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getOrderGroups']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
984
+ const localVarOperationServerBasePath = undefined;
937
985
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
938
986
  });
939
987
  },
@@ -946,10 +994,10 @@ const PortfolioApiFp = function (configuration) {
946
994
  */
947
995
  getOrderQueuePosition(orderId, options) {
948
996
  return __awaiter(this, void 0, void 0, function* () {
949
- var _a, _b, _c;
997
+ var _a;
950
998
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderQueuePosition(orderId, options);
951
999
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
952
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getOrderQueuePosition']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1000
+ const localVarOperationServerBasePath = undefined;
953
1001
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
954
1002
  });
955
1003
  },
@@ -968,10 +1016,10 @@ const PortfolioApiFp = function (configuration) {
968
1016
  */
969
1017
  getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, options) {
970
1018
  return __awaiter(this, void 0, void 0, function* () {
971
- var _a, _b, _c;
1019
+ var _a;
972
1020
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, options);
973
1021
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
974
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getOrders']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1022
+ const localVarOperationServerBasePath = undefined;
975
1023
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
976
1024
  });
977
1025
  },
@@ -989,10 +1037,10 @@ const PortfolioApiFp = function (configuration) {
989
1037
  */
990
1038
  getPositions(ticker, eventTicker, countDown, countUp, limit, cursor, options) {
991
1039
  return __awaiter(this, void 0, void 0, function* () {
992
- var _a, _b, _c;
1040
+ var _a;
993
1041
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getPositions(ticker, eventTicker, countDown, countUp, limit, cursor, options);
994
1042
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
995
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getPositions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1043
+ const localVarOperationServerBasePath = undefined;
996
1044
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
997
1045
  });
998
1046
  },
@@ -1005,10 +1053,10 @@ const PortfolioApiFp = function (configuration) {
1005
1053
  */
1006
1054
  getQueuePositions(getQueuePositionsRequest, options) {
1007
1055
  return __awaiter(this, void 0, void 0, function* () {
1008
- var _a, _b, _c;
1056
+ var _a;
1009
1057
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getQueuePositions(getQueuePositionsRequest, options);
1010
1058
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1011
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getQueuePositions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1059
+ const localVarOperationServerBasePath = undefined;
1012
1060
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1013
1061
  });
1014
1062
  },
@@ -1022,10 +1070,10 @@ const PortfolioApiFp = function (configuration) {
1022
1070
  */
1023
1071
  getSettlements(limit, cursor, options) {
1024
1072
  return __awaiter(this, void 0, void 0, function* () {
1025
- var _a, _b, _c;
1073
+ var _a;
1026
1074
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getSettlements(limit, cursor, options);
1027
1075
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1028
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getSettlements']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1076
+ const localVarOperationServerBasePath = undefined;
1029
1077
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1030
1078
  });
1031
1079
  },
@@ -1037,10 +1085,10 @@ const PortfolioApiFp = function (configuration) {
1037
1085
  */
1038
1086
  getTotalRestingOrderValue(options) {
1039
1087
  return __awaiter(this, void 0, void 0, function* () {
1040
- var _a, _b, _c;
1088
+ var _a;
1041
1089
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getTotalRestingOrderValue(options);
1042
1090
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1043
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getTotalRestingOrderValue']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1091
+ const localVarOperationServerBasePath = undefined;
1044
1092
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1045
1093
  });
1046
1094
  },
@@ -1053,10 +1101,10 @@ const PortfolioApiFp = function (configuration) {
1053
1101
  */
1054
1102
  resetOrderGroup(orderGroupId, options) {
1055
1103
  return __awaiter(this, void 0, void 0, function* () {
1056
- var _a, _b, _c;
1104
+ var _a;
1057
1105
  const localVarAxiosArgs = yield localVarAxiosParamCreator.resetOrderGroup(orderGroupId, options);
1058
1106
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1059
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.resetOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1107
+ const localVarOperationServerBasePath = undefined;
1060
1108
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1061
1109
  });
1062
1110
  },
@@ -1185,6 +1233,16 @@ const PortfolioApiFactory = function (configuration, basePath, axios) {
1185
1233
  getOrder(orderId, options) {
1186
1234
  return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath));
1187
1235
  },
1236
+ /**
1237
+ * Get details of a specific order group
1238
+ * @summary Get Order Group
1239
+ * @param {string} orderGroupId Order group ID
1240
+ * @param {*} [options] Override http request option.
1241
+ * @throws {RequiredError}
1242
+ */
1243
+ getOrderGroup(orderGroupId, options) {
1244
+ return localVarFp.getOrderGroup(orderGroupId, options).then((request) => request(axios, basePath));
1245
+ },
1188
1246
  /**
1189
1247
  * Get order groups for the logged-in user
1190
1248
  * @summary Get Order Groups
@@ -1401,6 +1459,16 @@ class PortfolioApi extends base_1.BaseAPI {
1401
1459
  getOrder(orderId, options) {
1402
1460
  return (0, exports.PortfolioApiFp)(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath));
1403
1461
  }
1462
+ /**
1463
+ * Get details of a specific order group
1464
+ * @summary Get Order Group
1465
+ * @param {string} orderGroupId Order group ID
1466
+ * @param {*} [options] Override http request option.
1467
+ * @throws {RequiredError}
1468
+ */
1469
+ getOrderGroup(orderGroupId, options) {
1470
+ return (0, exports.PortfolioApiFp)(this.configuration).getOrderGroup(orderGroupId, options).then((request) => request(this.axios, this.basePath));
1471
+ }
1404
1472
  /**
1405
1473
  * Get order groups for the logged-in user
1406
1474
  * @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
  }
@@ -119,10 +119,10 @@ const SeriesApiFp = function (configuration) {
119
119
  */
120
120
  getSeries(status, 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.getSeries(status, 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 = base_1.operationServerMap['SeriesApi.getSeries']) === 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
127
127
  });
128
128
  },
@@ -135,10 +135,10 @@ const SeriesApiFp = function (configuration) {
135
135
  */
136
136
  getSeriesByTicker(ticker, options) {
137
137
  return __awaiter(this, void 0, void 0, function* () {
138
- var _a, _b, _c;
138
+ var _a;
139
139
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getSeriesByTicker(ticker, options);
140
140
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
141
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['SeriesApi.getSeriesByTicker']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
141
+ const localVarOperationServerBasePath = undefined;
142
142
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
143
143
  });
144
144
  },
@@ -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
  }
@@ -123,10 +123,10 @@ const StructuredTargetsApiFp = function (configuration) {
123
123
  */
124
124
  getStructuredTarget(structuredTargetId, options) {
125
125
  return __awaiter(this, void 0, void 0, function* () {
126
- var _a, _b, _c;
126
+ var _a;
127
127
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTarget(structuredTargetId, options);
128
128
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
129
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['StructuredTargetsApi.getStructuredTarget']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
129
+ const localVarOperationServerBasePath = undefined;
130
130
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
131
131
  });
132
132
  },
@@ -140,10 +140,10 @@ const StructuredTargetsApiFp = function (configuration) {
140
140
  */
141
141
  getStructuredTargets(status, pageSize, options) {
142
142
  return __awaiter(this, void 0, void 0, function* () {
143
- var _a, _b, _c;
143
+ var _a;
144
144
  const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTargets(status, pageSize, options);
145
145
  const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
146
- const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['StructuredTargetsApi.getStructuredTargets']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
146
+ const localVarOperationServerBasePath = undefined;
147
147
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
148
148
  });
149
149
  },
package/dist/auth.d.ts ADDED
@@ -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
+ }
package/dist/auth.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KalshiAuth = void 0;
4
+ const crypto = require("crypto");
5
+ class KalshiAuth {
6
+ constructor(apiKey, privateKeyPem) {
7
+ this.apiKey = apiKey;
8
+ this.privateKeyPem = privateKeyPem;
9
+ }
10
+ signPssText(text) {
11
+ const sign = crypto.createSign('RSA-SHA256');
12
+ sign.update(text);
13
+ sign.end();
14
+ const signature = sign.sign({
15
+ key: this.privateKeyPem,
16
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
17
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
18
+ });
19
+ return signature.toString('base64');
20
+ }
21
+ generateAuthHeaders(method, path) {
22
+ const currentTimeMilliseconds = Date.now();
23
+ const timestampStr = currentTimeMilliseconds.toString();
24
+ const msgString = timestampStr + method + path;
25
+ const sig = this.signPssText(msgString);
26
+ return {
27
+ 'KALSHI-ACCESS-KEY': this.apiKey,
28
+ 'KALSHI-ACCESS-SIGNATURE': sig,
29
+ 'KALSHI-ACCESS-TIMESTAMP': timestampStr
30
+ };
31
+ }
32
+ }
33
+ exports.KalshiAuth = KalshiAuth;
package/dist/base.d.ts CHANGED
@@ -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/base.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
2
  /**
5
3
  * Kalshi Trading API
6
4
  * Complete API for the Kalshi trading platform including all handlers for SDK generation
@@ -13,28 +11,62 @@
13
11
  * Do not edit the class manually.
14
12
  */
15
13
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
14
+ exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
17
15
  const axios_1 = require("axios");
16
+ const auth_1 = require("./auth");
18
17
  exports.BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2".replace(/\/+$/, "");
18
+ /**
19
+ *
20
+ * @export
21
+ */
19
22
  exports.COLLECTION_FORMATS = {
20
23
  csv: ",",
21
24
  ssv: " ",
22
25
  tsv: "\t",
23
26
  pipes: "|",
24
27
  };
28
+ /**
29
+ *
30
+ * @export
31
+ * @class BaseAPI
32
+ */
25
33
  class BaseAPI {
26
34
  constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
27
- var _a;
28
35
  this.basePath = basePath;
29
36
  this.axios = axios;
30
37
  if (configuration) {
31
38
  this.configuration = configuration;
32
- this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
39
+ this.basePath = configuration.basePath || this.basePath;
40
+ // Initialize auth if credentials are provided
41
+ if (configuration.apiKey && (configuration.privateKeyPath || configuration.privateKeyPem)) {
42
+ const privateKey = configuration.privateKeyPem ||
43
+ (configuration.privateKeyPath ? require('fs').readFileSync(configuration.privateKeyPath, 'utf8') : '');
44
+ this.auth = new auth_1.KalshiAuth(configuration.apiKey, privateKey);
45
+ }
33
46
  }
47
+ // Add request interceptor for authentication
48
+ this.axios.interceptors.request.use((config) => {
49
+ if (this.auth && config.url && config.method) {
50
+ // Extract path from URL
51
+ const url = new URL(config.url, this.basePath);
52
+ const path = url.pathname;
53
+ const method = config.method.toUpperCase();
54
+ // Generate and add auth headers
55
+ const authHeaders = this.auth.generateAuthHeaders(method, path);
56
+ Object.assign(config.headers, authHeaders);
57
+ }
58
+ return config;
59
+ });
34
60
  }
35
61
  }
36
62
  exports.BaseAPI = BaseAPI;
37
63
  ;
64
+ /**
65
+ *
66
+ * @export
67
+ * @class RequiredError
68
+ * @extends {Error}
69
+ */
38
70
  class RequiredError extends Error {
39
71
  constructor(field, msg) {
40
72
  super(msg);
@@ -43,4 +75,3 @@ class RequiredError extends Error {
43
75
  }
44
76
  }
45
77
  exports.RequiredError = RequiredError;
46
- exports.operationServerMap = {};
@@ -136,7 +136,7 @@ export declare class ApiKeysApi extends BaseAPI {
136
136
  * @param {*} [options] Override http request option.
137
137
  * @throws {RequiredError}
138
138
  */
139
- createApiKey(createApiKeyRequest: CreateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateApiKeyResponse, any>>;
139
+ createApiKey(createApiKeyRequest: CreateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateApiKeyResponse, any, {}>>;
140
140
  /**
141
141
  * Delete an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
142
142
  * @summary Delete API Key
@@ -144,7 +144,7 @@ export declare class ApiKeysApi extends BaseAPI {
144
144
  * @param {*} [options] Override http request option.
145
145
  * @throws {RequiredError}
146
146
  */
147
- deleteApiKey(apiKey: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
147
+ deleteApiKey(apiKey: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
148
148
  /**
149
149
  * Generate a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
150
150
  * @summary Generate API Key
@@ -152,12 +152,12 @@ export declare class ApiKeysApi extends BaseAPI {
152
152
  * @param {*} [options] Override http request option.
153
153
  * @throws {RequiredError}
154
154
  */
155
- generateApiKey(generateApiKeyRequest: GenerateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GenerateApiKeyResponse, any>>;
155
+ generateApiKey(generateApiKeyRequest: GenerateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GenerateApiKeyResponse, any, {}>>;
156
156
  /**
157
157
  * Retrieve all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
158
158
  * @summary Get API Keys
159
159
  * @param {*} [options] Override http request option.
160
160
  * @throws {RequiredError}
161
161
  */
162
- getApiKeys(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetApiKeysResponse, any>>;
162
+ getApiKeys(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetApiKeysResponse, any, {}>>;
163
163
  }