@finatic/client 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -944,25 +944,6 @@ function convertToPlainObject(data) {
944
944
  return data;
945
945
  }
946
946
 
947
- /* tslint:disable */
948
- /* eslint-disable */
949
- /**
950
- * Finatic FastAPI Backend
951
- * FinaticAPI REST API
952
- *
953
- * The version of the OpenAPI document: 1.0.0
954
- *
955
- *
956
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
957
- * https://openapi-generator.tech
958
- * Do not edit the class manually.
959
- */
960
- var AccountStatus;
961
- (function (AccountStatus) {
962
- AccountStatus["Active"] = "active";
963
- AccountStatus["Inactive"] = "inactive";
964
- })(AccountStatus || (AccountStatus = {}));
965
-
966
947
  /* tslint:disable */
967
948
  /* eslint-disable */
968
949
  /**
@@ -2056,7 +2037,7 @@ class BrokersWrapper {
2056
2037
  * If the company is the only one with access, the entire connection is deleted.
2057
2038
  * If other companies have access, only the company's access is removed.
2058
2039
  * @param params.connectionId {string} Connection ID
2059
- * @returns {Promise<FinaticResponse<DisconnectActionResult>>} Standard response with success/Error/Warning structure
2040
+ * @returns {Promise<FinaticResponse<DisconnectCompanyFromBrokerConnectionResult>>} Standard response with success/Error/Warning structure
2060
2041
  *
2061
2042
  * Generated from: DELETE /api/v1/brokers/disconnect-company/{connection_id}
2062
2043
  * @methodId disconnect_company_from_broker_api_v1_brokers_disconnect_company__connection_id__delete
@@ -2419,7 +2400,7 @@ class BrokersWrapper {
2419
2400
  * @param params.symbol {string} (optional) Filter by symbol
2420
2401
  * @param params.side {BrokerDataOrderSideEnum} (optional) Filter by position side (e.g., 'long', 'short')
2421
2402
  * @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
2422
- * @param params.positionStatus {BrokerDataPositionStatusEnum} (optional) Filter by position status: 'open' (quantity > 0) or 'closed' (quantity = 0)
2403
+ * @param params.positionStatus {BrokerDataPositionStatusEnum} (optional) Filter by position status: 'active' (open positions) or 'closed' (closed positions). Use 'all' or omit to get both.
2423
2404
  * @param params.limit {number} (optional) Maximum number of positions to return
2424
2405
  * @param params.offset {number} (optional) Number of positions to skip for pagination
2425
2406
  * @param params.updatedAfter {string} (optional) Filter positions updated after this timestamp
@@ -2815,7 +2796,6 @@ class BrokersWrapper {
2815
2796
  * @param params.brokerId {string} (optional) Filter by broker ID
2816
2797
  * @param params.connectionId {string} (optional) Filter by connection ID
2817
2798
  * @param params.accountType {BrokerDataAccountTypeEnum} (optional) Filter by account type (e.g., 'margin', 'cash', 'crypto_wallet', 'live', 'sim')
2818
- * @param params.status {AccountStatus} (optional) Filter by account status (e.g., 'active', 'inactive')
2819
2799
  * @param params.currency {string} (optional) Filter by currency (e.g., 'USD', 'EUR')
2820
2800
  * @param params.limit {number} (optional) Maximum number of accounts to return
2821
2801
  * @param params.offset {number} (optional) Number of accounts to skip for pagination
@@ -2892,7 +2872,7 @@ class BrokersWrapper {
2892
2872
  });
2893
2873
  try {
2894
2874
  const response = await retryApiCall(async () => {
2895
- const apiResponse = await this.api.getAccountsApiV1BrokersDataAccountsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountType !== undefined ? { accountType: resolvedParams.accountType } : {}), ...(resolvedParams.status !== undefined ? { status: resolvedParams.status } : {}), ...(resolvedParams.currency !== undefined ? { currency: resolvedParams.currency } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
2875
+ const apiResponse = await this.api.getAccountsApiV1BrokersDataAccountsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountType !== undefined ? { accountType: resolvedParams.accountType } : {}), ...(resolvedParams.currency !== undefined ? { currency: resolvedParams.currency } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
2896
2876
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2897
2877
  }, {}, this.sdkConfig);
2898
2878
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3982,7 +3962,7 @@ class CompanyWrapper {
3982
3962
  *
3983
3963
  * Get public company details by ID (no user check, no sensitive data).
3984
3964
  * @param params.companyId {string} Company ID
3985
- * @returns {Promise<FinaticResponse<CompanyResponse>>} Standard response with success/Error/Warning structure
3965
+ * @returns {Promise<FinaticResponse<Accounts>>} Standard response with success/Error/Warning structure
3986
3966
  *
3987
3967
  * Generated from: GET /api/v1/company/{company_id}
3988
3968
  * @methodId get_company_api_v1_company__company_id__get
@@ -4603,16 +4583,15 @@ class SessionWrapper {
4603
4583
  /**
4604
4584
  * Get Session User
4605
4585
  *
4606
- * Get user information and fresh tokens for a completed session.
4586
+ * Get user information for a completed session.
4607
4587
  *
4608
4588
  * This endpoint is designed for server SDKs to retrieve user information
4609
- * and authentication tokens after successful OTP verification.
4589
+ * after successful OTP verification.
4610
4590
  *
4611
4591
  *
4612
4592
  * Security:
4613
4593
  * - Requires valid session in ACTIVE state
4614
4594
  * - Validates device fingerprint binding
4615
- * - Generates fresh tokens (not returning stored ones)
4616
4595
  * - Only accessible to authenticated sessions with user_id
4617
4596
  * - Validates that header session_id matches path session_id
4618
4597
  * @param params.sessionId {string} Session ID
@@ -8238,6 +8217,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8238
8217
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8239
8218
  const localVarHeaderParameter = {};
8240
8219
  const localVarQueryParameter = {};
8220
+ localVarHeaderParameter['Accept'] = 'application/json';
8241
8221
  if (sessionId != null) {
8242
8222
  localVarHeaderParameter['session-id'] = String(sessionId);
8243
8223
  }
@@ -8250,7 +8230,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8250
8230
  };
8251
8231
  },
8252
8232
  /**
8253
- * Get user information and fresh tokens for a completed session. This endpoint is designed for server SDKs to retrieve user information and authentication tokens after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Generates fresh tokens (not returning stored ones) - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8233
+ * Get user information for a completed session. This endpoint is designed for server SDKs to retrieve user information after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8254
8234
  * @summary Get Session User
8255
8235
  * @param {string} sessionId Session ID
8256
8236
  * @param {string} xSessionId Session ID from header (must match path parameter)
@@ -8273,6 +8253,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8273
8253
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8274
8254
  const localVarHeaderParameter = {};
8275
8255
  const localVarQueryParameter = {};
8256
+ localVarHeaderParameter['Accept'] = 'application/json';
8276
8257
  if (xSessionId != null) {
8277
8258
  localVarHeaderParameter['x-session-id'] = String(xSessionId);
8278
8259
  }
@@ -8304,6 +8285,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8304
8285
  const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
8305
8286
  const localVarHeaderParameter = {};
8306
8287
  const localVarQueryParameter = {};
8288
+ localVarHeaderParameter['Accept'] = 'application/json';
8307
8289
  if (xApiKey != null) {
8308
8290
  localVarHeaderParameter['x-api-key'] = String(xApiKey);
8309
8291
  }
@@ -8339,6 +8321,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8339
8321
  const localVarHeaderParameter = {};
8340
8322
  const localVarQueryParameter = {};
8341
8323
  localVarHeaderParameter['Content-Type'] = 'application/json';
8324
+ localVarHeaderParameter['Accept'] = 'application/json';
8342
8325
  if (oneTimeToken != null) {
8343
8326
  localVarHeaderParameter['One-Time-Token'] = String(oneTimeToken);
8344
8327
  }
@@ -8373,7 +8356,7 @@ const SessionApiFp = function (configuration) {
8373
8356
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
8374
8357
  },
8375
8358
  /**
8376
- * Get user information and fresh tokens for a completed session. This endpoint is designed for server SDKs to retrieve user information and authentication tokens after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Generates fresh tokens (not returning stored ones) - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8359
+ * Get user information for a completed session. This endpoint is designed for server SDKs to retrieve user information after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8377
8360
  * @summary Get Session User
8378
8361
  * @param {string} sessionId Session ID
8379
8362
  * @param {string} xSessionId Session ID from header (must match path parameter)
@@ -8430,7 +8413,7 @@ class SessionApi extends BaseAPI {
8430
8413
  return SessionApiFp(this.configuration).getPortalUrlApiV1SessionPortalGet(requestParameters.sessionId, options).then((request) => request(this.axios, this.basePath));
8431
8414
  }
8432
8415
  /**
8433
- * Get user information and fresh tokens for a completed session. This endpoint is designed for server SDKs to retrieve user information and authentication tokens after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Generates fresh tokens (not returning stored ones) - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8416
+ * Get user information for a completed session. This endpoint is designed for server SDKs to retrieve user information after successful OTP verification. Security: - Requires valid session in ACTIVE state - Validates device fingerprint binding - Only accessible to authenticated sessions with user_id - Validates that header session_id matches path session_id
8434
8417
  * @summary Get Session User
8435
8418
  * @param {SessionApiGetSessionUserApiV1SessionSessionIdUserGetRequest} requestParameters Request parameters.
8436
8419
  * @param {*} [options] Override http request option.
@@ -8500,6 +8483,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8500
8483
  const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options };
8501
8484
  const localVarHeaderParameter = {};
8502
8485
  const localVarQueryParameter = {};
8486
+ localVarHeaderParameter['Accept'] = 'application/json';
8503
8487
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8504
8488
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8505
8489
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8514,7 +8498,6 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8514
8498
  * @param {string | null} [brokerId] Filter by broker ID
8515
8499
  * @param {string | null} [connectionId] Filter by connection ID
8516
8500
  * @param {BrokerDataAccountTypeEnum | null} [accountType] Filter by account type (e.g., \&#39;margin\&#39;, \&#39;cash\&#39;, \&#39;crypto_wallet\&#39;, \&#39;live\&#39;, \&#39;sim\&#39;)
8517
- * @param {AccountStatus | null} [status] Filter by account status (e.g., \&#39;active\&#39;, \&#39;inactive\&#39;)
8518
8501
  * @param {string | null} [currency] Filter by currency (e.g., \&#39;USD\&#39;, \&#39;EUR\&#39;)
8519
8502
  * @param {number} [limit] Maximum number of accounts to return
8520
8503
  * @param {number} [offset] Number of accounts to skip for pagination
@@ -8522,7 +8505,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8522
8505
  * @param {*} [options] Override http request option.
8523
8506
  * @throws {RequiredError}
8524
8507
  */
8525
- getAccountsApiV1BrokersDataAccountsGet: async (brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options = {}) => {
8508
+ getAccountsApiV1BrokersDataAccountsGet: async (brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options = {}) => {
8526
8509
  const localVarPath = `/api/v1/brokers/data/accounts`;
8527
8510
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
8528
8511
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -8542,9 +8525,6 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8542
8525
  if (accountType !== undefined) {
8543
8526
  localVarQueryParameter['account_type'] = accountType;
8544
8527
  }
8545
- if (status !== undefined) {
8546
- localVarQueryParameter['status'] = status;
8547
- }
8548
8528
  if (currency !== undefined) {
8549
8529
  localVarQueryParameter['currency'] = currency;
8550
8530
  }
@@ -8557,6 +8537,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8557
8537
  if (includeMetadata !== undefined) {
8558
8538
  localVarQueryParameter['include_metadata'] = includeMetadata;
8559
8539
  }
8540
+ localVarHeaderParameter['Accept'] = 'application/json';
8560
8541
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8561
8542
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8562
8543
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8622,6 +8603,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8622
8603
  if (includeMetadata !== undefined) {
8623
8604
  localVarQueryParameter['include_metadata'] = includeMetadata;
8624
8605
  }
8606
+ localVarHeaderParameter['Accept'] = 'application/json';
8625
8607
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8626
8608
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8627
8609
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8647,6 +8629,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8647
8629
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8648
8630
  const localVarHeaderParameter = {};
8649
8631
  const localVarQueryParameter = {};
8632
+ localVarHeaderParameter['Accept'] = 'application/json';
8650
8633
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8651
8634
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8652
8635
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8692,6 +8675,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8692
8675
  if (includeMetadata !== undefined) {
8693
8676
  localVarQueryParameter['include_metadata'] = includeMetadata;
8694
8677
  }
8678
+ localVarHeaderParameter['Accept'] = 'application/json';
8695
8679
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8696
8680
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8697
8681
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8737,6 +8721,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8737
8721
  if (includeMetadata !== undefined) {
8738
8722
  localVarQueryParameter['include_metadata'] = includeMetadata;
8739
8723
  }
8724
+ localVarHeaderParameter['Accept'] = 'application/json';
8740
8725
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8741
8726
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8742
8727
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8794,6 +8779,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8794
8779
  if (includeMetadata !== undefined) {
8795
8780
  localVarQueryParameter['include_metadata'] = includeMetadata;
8796
8781
  }
8782
+ localVarHeaderParameter['Accept'] = 'application/json';
8797
8783
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8798
8784
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8799
8785
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8871,6 +8857,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8871
8857
  if (includeMetadata !== undefined) {
8872
8858
  localVarQueryParameter['include_metadata'] = includeMetadata;
8873
8859
  }
8860
+ localVarHeaderParameter['Accept'] = 'application/json';
8874
8861
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8875
8862
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8876
8863
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8912,6 +8899,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8912
8899
  if (offset !== undefined) {
8913
8900
  localVarQueryParameter['offset'] = offset;
8914
8901
  }
8902
+ localVarHeaderParameter['Accept'] = 'application/json';
8915
8903
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8916
8904
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8917
8905
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8965,6 +8953,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8965
8953
  if (offset !== undefined) {
8966
8954
  localVarQueryParameter['offset'] = offset;
8967
8955
  }
8956
+ localVarHeaderParameter['Accept'] = 'application/json';
8968
8957
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8969
8958
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8970
8959
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8982,7 +8971,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8982
8971
  * @param {string | null} [symbol] Filter by symbol
8983
8972
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
8984
8973
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
8985
- * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;open\&#39; (quantity &gt; 0) or \&#39;closed\&#39; (quantity &#x3D; 0)
8974
+ * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;active\&#39; (open positions) or \&#39;closed\&#39; (closed positions). Use \&#39;all\&#39; or omit to get both.
8986
8975
  * @param {number} [limit] Maximum number of positions to return
8987
8976
  * @param {number} [offset] Number of positions to skip for pagination
8988
8977
  * @param {string | null} [updatedAfter] Filter positions updated after this timestamp
@@ -9042,6 +9031,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
9042
9031
  if (includeMetadata !== undefined) {
9043
9032
  localVarQueryParameter['include_metadata'] = includeMetadata;
9044
9033
  }
9034
+ localVarHeaderParameter['Accept'] = 'application/json';
9045
9035
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9046
9036
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9047
9037
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9067,6 +9057,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
9067
9057
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9068
9058
  const localVarHeaderParameter = {};
9069
9059
  const localVarQueryParameter = {};
9060
+ localVarHeaderParameter['Accept'] = 'application/json';
9070
9061
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9071
9062
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9072
9063
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9102,7 +9093,6 @@ const BrokersApiFp = function (configuration) {
9102
9093
  * @param {string | null} [brokerId] Filter by broker ID
9103
9094
  * @param {string | null} [connectionId] Filter by connection ID
9104
9095
  * @param {BrokerDataAccountTypeEnum | null} [accountType] Filter by account type (e.g., \&#39;margin\&#39;, \&#39;cash\&#39;, \&#39;crypto_wallet\&#39;, \&#39;live\&#39;, \&#39;sim\&#39;)
9105
- * @param {AccountStatus | null} [status] Filter by account status (e.g., \&#39;active\&#39;, \&#39;inactive\&#39;)
9106
9096
  * @param {string | null} [currency] Filter by currency (e.g., \&#39;USD\&#39;, \&#39;EUR\&#39;)
9107
9097
  * @param {number} [limit] Maximum number of accounts to return
9108
9098
  * @param {number} [offset] Number of accounts to skip for pagination
@@ -9110,8 +9100,8 @@ const BrokersApiFp = function (configuration) {
9110
9100
  * @param {*} [options] Override http request option.
9111
9101
  * @throws {RequiredError}
9112
9102
  */
9113
- async getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options) {
9114
- const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options);
9103
+ async getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options) {
9104
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options);
9115
9105
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
9116
9106
  const localVarOperationServerBasePath = operationServerMap['BrokersApi.getAccountsApiV1BrokersDataAccountsGet']?.[localVarOperationServerIndex]?.url;
9117
9107
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
@@ -9270,7 +9260,7 @@ const BrokersApiFp = function (configuration) {
9270
9260
  * @param {string | null} [symbol] Filter by symbol
9271
9261
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
9272
9262
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
9273
- * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;open\&#39; (quantity &gt; 0) or \&#39;closed\&#39; (quantity &#x3D; 0)
9263
+ * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;active\&#39; (open positions) or \&#39;closed\&#39; (closed positions). Use \&#39;all\&#39; or omit to get both.
9274
9264
  * @param {number} [limit] Maximum number of positions to return
9275
9265
  * @param {number} [offset] Number of positions to skip for pagination
9276
9266
  * @param {string | null} [updatedAfter] Filter positions updated after this timestamp
@@ -9321,7 +9311,7 @@ class BrokersApi extends BaseAPI {
9321
9311
  * @throws {RequiredError}
9322
9312
  */
9323
9313
  getAccountsApiV1BrokersDataAccountsGet(requestParameters = {}, options) {
9324
- return BrokersApiFp(this.configuration).getAccountsApiV1BrokersDataAccountsGet(requestParameters.brokerId, requestParameters.connectionId, requestParameters.accountType, requestParameters.status, requestParameters.currency, requestParameters.limit, requestParameters.offset, requestParameters.includeMetadata, options).then((request) => request(this.axios, this.basePath));
9314
+ return BrokersApiFp(this.configuration).getAccountsApiV1BrokersDataAccountsGet(requestParameters.brokerId, requestParameters.connectionId, requestParameters.accountType, requestParameters.currency, requestParameters.limit, requestParameters.offset, requestParameters.includeMetadata, options).then((request) => request(this.axios, this.basePath));
9325
9315
  }
9326
9316
  /**
9327
9317
  * Get balances for all authorized broker connections. This endpoint is accessible from the portal and uses session-only authentication. Returns balances from connections the company has read access to.
@@ -9462,35 +9452,7 @@ const CompanyApiAxiosParamCreator = function (configuration) {
9462
9452
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9463
9453
  const localVarHeaderParameter = {};
9464
9454
  const localVarQueryParameter = {};
9465
- setSearchParams(localVarUrlObj, localVarQueryParameter);
9466
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9467
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
9468
- return {
9469
- url: toPathString(localVarUrlObj),
9470
- options: localVarRequestOptions,
9471
- };
9472
- },
9473
- /**
9474
- * Get public company details by ID (no user check, no sensitive data).
9475
- * @summary Get Company
9476
- * @param {string} companyId Company ID
9477
- * @param {*} [options] Override http request option.
9478
- * @throws {RequiredError}
9479
- */
9480
- getCompanyApiV1CompanyCompanyIdGet_1: async (companyId, options = {}) => {
9481
- // verify required parameter 'companyId' is not null or undefined
9482
- assertParamExists('getCompanyApiV1CompanyCompanyIdGet_1', 'companyId', companyId);
9483
- const localVarPath = `/api/v1/company/{company_id}`
9484
- .replace(`{${"company_id"}}`, encodeURIComponent(String(companyId)));
9485
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
9486
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
9487
- let baseOptions;
9488
- if (configuration) {
9489
- baseOptions = configuration.baseOptions;
9490
- }
9491
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9492
- const localVarHeaderParameter = {};
9493
- const localVarQueryParameter = {};
9455
+ localVarHeaderParameter['Accept'] = 'application/json';
9494
9456
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9495
9457
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9496
9458
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9520,19 +9482,6 @@ const CompanyApiFp = function (configuration) {
9520
9482
  const localVarOperationServerBasePath = operationServerMap['CompanyApi.getCompanyApiV1CompanyCompanyIdGet']?.[localVarOperationServerIndex]?.url;
9521
9483
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
9522
9484
  },
9523
- /**
9524
- * Get public company details by ID (no user check, no sensitive data).
9525
- * @summary Get Company
9526
- * @param {string} companyId Company ID
9527
- * @param {*} [options] Override http request option.
9528
- * @throws {RequiredError}
9529
- */
9530
- async getCompanyApiV1CompanyCompanyIdGet_1(companyId, options) {
9531
- const localVarAxiosArgs = await localVarAxiosParamCreator.getCompanyApiV1CompanyCompanyIdGet_1(companyId, options);
9532
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
9533
- const localVarOperationServerBasePath = operationServerMap['CompanyApi.getCompanyApiV1CompanyCompanyIdGet_1']?.[localVarOperationServerIndex]?.url;
9534
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
9535
- },
9536
9485
  };
9537
9486
  };
9538
9487
  /**
@@ -9549,16 +9498,6 @@ class CompanyApi extends BaseAPI {
9549
9498
  getCompanyApiV1CompanyCompanyIdGet(requestParameters, options) {
9550
9499
  return CompanyApiFp(this.configuration).getCompanyApiV1CompanyCompanyIdGet(requestParameters.companyId, options).then((request) => request(this.axios, this.basePath));
9551
9500
  }
9552
- /**
9553
- * Get public company details by ID (no user check, no sensitive data).
9554
- * @summary Get Company
9555
- * @param {CompanyApiGetCompanyApiV1CompanyCompanyIdGet0Request} requestParameters Request parameters.
9556
- * @param {*} [options] Override http request option.
9557
- * @throws {RequiredError}
9558
- */
9559
- getCompanyApiV1CompanyCompanyIdGet_1(requestParameters, options) {
9560
- return CompanyApiFp(this.configuration).getCompanyApiV1CompanyCompanyIdGet_1(requestParameters.companyId, options).then((request) => request(this.axios, this.basePath));
9561
- }
9562
9501
  }
9563
9502
 
9564
9503
  /**
@@ -9872,41 +9811,37 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
9872
9811
  this.logger.debug?.('Portal URL generated', { portalUrl });
9873
9812
  return portalUrl;
9874
9813
  }
9875
- /**
9876
- * Open portal in iframe (Client SDK only).
9877
- * The portal handles user authentication and linking to session at the source of truth.
9878
- * This method just records the userId for SDK state.
9879
- *
9880
- * @methodId open_portal_client_sdk
9881
- * @category session
9882
- * @param params - Optional parameters object
9883
- * @param params.theme - Optional theme preset or custom theme object
9884
- * @param params.brokers - Optional array of broker IDs to filter
9885
- * @param params.email - Optional email address
9886
- * @param params.mode - Optional mode ('light' or 'dark')
9887
- * @param onSuccess - Optional callback when portal authentication succeeds
9888
- * @param onError - Optional callback when portal authentication fails
9889
- * @param onClose - Optional callback when portal is closed
9890
- * @returns Promise that resolves when portal is opened
9891
- * @example
9892
- * ```typescript-client
9893
- * await finatic.openPortal({
9894
- * theme: 'default',
9895
- * brokers: ['broker-1'],
9896
- * email: 'user@example.com',
9897
- * mode: 'dark'
9898
- * },
9899
- * (userId) => console.log('User authenticated:', userId),
9900
- * (error) => console.error('Portal error:', error),
9901
- * () => console.log('Portal closed')
9902
- * );
9903
- * ```
9904
- */
9905
- async openPortal(params, onSuccess, onError, onClose) {
9814
+ // Implementation handles both patterns
9815
+ async openPortal(optionsOrParams, onSuccess, onError, onClose) {
9906
9816
  if (!this.sessionId) {
9907
9817
  throw new Error('Session not initialized. Call startSession() first.');
9908
9818
  }
9909
- // Get portal URL with all parameters
9819
+ // Detect which pattern is being used:
9820
+ // - Old pattern: second parameter (onSuccess) is explicitly a function
9821
+ // - New pattern: second parameter is not a function (undefined or not provided)
9822
+ // In new pattern, callbacks are inside the first parameter object
9823
+ const isNewPattern = typeof onSuccess !== 'function';
9824
+ let params;
9825
+ let successCallback;
9826
+ let errorCallback;
9827
+ let closeCallback;
9828
+ if (isNewPattern) {
9829
+ // New pattern: extract callbacks from options object
9830
+ const options = optionsOrParams;
9831
+ const { onSuccess: optOnSuccess, onError: optOnError, onClose: optOnClose, ...portalParams } = options;
9832
+ params = portalParams;
9833
+ successCallback = optOnSuccess;
9834
+ errorCallback = optOnError;
9835
+ closeCallback = optOnClose;
9836
+ }
9837
+ else {
9838
+ // Old pattern: params and callbacks are separate
9839
+ params = optionsOrParams;
9840
+ successCallback = onSuccess;
9841
+ errorCallback = onError;
9842
+ closeCallback = onClose;
9843
+ }
9844
+ // Get portal URL with all parameters (excluding callbacks)
9910
9845
  const portalUrl = await this.getPortalUrl(params);
9911
9846
  // Create portal UI if not exists
9912
9847
  if (!this.portalUI) {
@@ -9920,19 +9855,19 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
9920
9855
  // Emit portal success event
9921
9856
  this.emit('portal:success', userId);
9922
9857
  // Call optional callback
9923
- onSuccess?.(userId);
9858
+ successCallback?.(userId);
9924
9859
  },
9925
9860
  onError: (error) => {
9926
9861
  // Emit portal error event
9927
9862
  this.emit('portal:error', error);
9928
9863
  // Call optional callback
9929
- onError?.(error);
9864
+ errorCallback?.(error);
9930
9865
  },
9931
9866
  onClose: () => {
9932
9867
  // Emit portal close event
9933
9868
  this.emit('portal:close');
9934
9869
  // Call optional callback
9935
- onClose?.();
9870
+ closeCallback?.();
9936
9871
  },
9937
9872
  });
9938
9873
  }
@@ -12014,5 +11949,5 @@ class FinaticConnect extends FinaticConnect$1 {
12014
11949
  // Marker to verify custom class is being used
12015
11950
  FinaticConnect.__CUSTOM_CLASS__ = true;
12016
11951
 
12017
- export { AccountStatus, ApiError, BrokerDataAccountTypeEnum, BrokerDataAssetTypeEnum, BrokerDataOrderSideEnum, BrokerDataPositionStatusEnum, BrokersWrapper, CompanyWrapper, Configuration, EventEmitter, FDXAccountStatus, FDXAccountType, FDXAssetType, FDXBalanceType, FDXOrderClass, FDXOrderEventType, FDXOrderGroupType, FDXOrderSide, FDXOrderStatus, FDXOrderType, FDXPositionSide, FDXPositionStatus, FDXSecurityIdType, FDXTimeInForce, FinaticConnect, FinaticError, PaginatedData, SessionStatus, SessionWrapper, ValidationError, addErrorInterceptor, addRequestInterceptor, addResponseInterceptor, appendBrokerFilterToURL, appendThemeToURL, applyErrorInterceptors, applyRequestInterceptors, applyResponseInterceptors, coerceEnumValue, convertToPlainObject, defaultConfig, generateCacheKey, generateRequestId, getCache, getConfig, getLogger, handleError, numberSchema, retryApiCall, stringSchema, unwrapAxiosResponse, validateParams };
11952
+ export { ApiError, BrokerDataAccountTypeEnum, BrokerDataAssetTypeEnum, BrokerDataOrderSideEnum, BrokerDataPositionStatusEnum, BrokersWrapper, CompanyWrapper, Configuration, EventEmitter, FDXAccountStatus, FDXAccountType, FDXAssetType, FDXBalanceType, FDXOrderClass, FDXOrderEventType, FDXOrderGroupType, FDXOrderSide, FDXOrderStatus, FDXOrderType, FDXPositionSide, FDXPositionStatus, FDXSecurityIdType, FDXTimeInForce, FinaticConnect, FinaticError, PaginatedData, SessionStatus, SessionWrapper, ValidationError, addErrorInterceptor, addRequestInterceptor, addResponseInterceptor, appendBrokerFilterToURL, appendThemeToURL, applyErrorInterceptors, applyRequestInterceptors, applyResponseInterceptors, coerceEnumValue, convertToPlainObject, defaultConfig, generateCacheKey, generateRequestId, getCache, getConfig, getLogger, handleError, numberSchema, retryApiCall, stringSchema, unwrapAxiosResponse, validateParams };
12018
11953
  //# sourceMappingURL=index.mjs.map