@finatic/client 0.9.6 → 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.js CHANGED
@@ -946,25 +946,6 @@ function convertToPlainObject(data) {
946
946
  return data;
947
947
  }
948
948
 
949
- /* tslint:disable */
950
- /* eslint-disable */
951
- /**
952
- * Finatic FastAPI Backend
953
- * FinaticAPI REST API
954
- *
955
- * The version of the OpenAPI document: 1.0.0
956
- *
957
- *
958
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
959
- * https://openapi-generator.tech
960
- * Do not edit the class manually.
961
- */
962
- exports.AccountStatus = void 0;
963
- (function (AccountStatus) {
964
- AccountStatus["Active"] = "active";
965
- AccountStatus["Inactive"] = "inactive";
966
- })(exports.AccountStatus || (exports.AccountStatus = {}));
967
-
968
949
  /* tslint:disable */
969
950
  /* eslint-disable */
970
951
  /**
@@ -2058,7 +2039,7 @@ class BrokersWrapper {
2058
2039
  * If the company is the only one with access, the entire connection is deleted.
2059
2040
  * If other companies have access, only the company's access is removed.
2060
2041
  * @param params.connectionId {string} Connection ID
2061
- * @returns {Promise<FinaticResponse<DisconnectActionResult>>} Standard response with success/Error/Warning structure
2042
+ * @returns {Promise<FinaticResponse<DisconnectCompanyFromBrokerConnectionResult>>} Standard response with success/Error/Warning structure
2062
2043
  *
2063
2044
  * Generated from: DELETE /api/v1/brokers/disconnect-company/{connection_id}
2064
2045
  * @methodId disconnect_company_from_broker_api_v1_brokers_disconnect_company__connection_id__delete
@@ -2421,7 +2402,7 @@ class BrokersWrapper {
2421
2402
  * @param params.symbol {string} (optional) Filter by symbol
2422
2403
  * @param params.side {BrokerDataOrderSideEnum} (optional) Filter by position side (e.g., 'long', 'short')
2423
2404
  * @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
2424
- * @param params.positionStatus {BrokerDataPositionStatusEnum} (optional) Filter by position status: 'open' (quantity > 0) or 'closed' (quantity = 0)
2405
+ * @param params.positionStatus {BrokerDataPositionStatusEnum} (optional) Filter by position status: 'active' (open positions) or 'closed' (closed positions). Use 'all' or omit to get both.
2425
2406
  * @param params.limit {number} (optional) Maximum number of positions to return
2426
2407
  * @param params.offset {number} (optional) Number of positions to skip for pagination
2427
2408
  * @param params.updatedAfter {string} (optional) Filter positions updated after this timestamp
@@ -2817,7 +2798,6 @@ class BrokersWrapper {
2817
2798
  * @param params.brokerId {string} (optional) Filter by broker ID
2818
2799
  * @param params.connectionId {string} (optional) Filter by connection ID
2819
2800
  * @param params.accountType {BrokerDataAccountTypeEnum} (optional) Filter by account type (e.g., 'margin', 'cash', 'crypto_wallet', 'live', 'sim')
2820
- * @param params.status {AccountStatus} (optional) Filter by account status (e.g., 'active', 'inactive')
2821
2801
  * @param params.currency {string} (optional) Filter by currency (e.g., 'USD', 'EUR')
2822
2802
  * @param params.limit {number} (optional) Maximum number of accounts to return
2823
2803
  * @param params.offset {number} (optional) Number of accounts to skip for pagination
@@ -2894,7 +2874,7 @@ class BrokersWrapper {
2894
2874
  });
2895
2875
  try {
2896
2876
  const response = await retryApiCall(async () => {
2897
- 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 } : {}) } : {}) } });
2877
+ 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 } : {}) } : {}) } });
2898
2878
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2899
2879
  }, {}, this.sdkConfig);
2900
2880
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3984,7 +3964,7 @@ class CompanyWrapper {
3984
3964
  *
3985
3965
  * Get public company details by ID (no user check, no sensitive data).
3986
3966
  * @param params.companyId {string} Company ID
3987
- * @returns {Promise<FinaticResponse<CompanyResponse>>} Standard response with success/Error/Warning structure
3967
+ * @returns {Promise<FinaticResponse<Accounts>>} Standard response with success/Error/Warning structure
3988
3968
  *
3989
3969
  * Generated from: GET /api/v1/company/{company_id}
3990
3970
  * @methodId get_company_api_v1_company__company_id__get
@@ -4605,16 +4585,15 @@ class SessionWrapper {
4605
4585
  /**
4606
4586
  * Get Session User
4607
4587
  *
4608
- * Get user information and fresh tokens for a completed session.
4588
+ * Get user information for a completed session.
4609
4589
  *
4610
4590
  * This endpoint is designed for server SDKs to retrieve user information
4611
- * and authentication tokens after successful OTP verification.
4591
+ * after successful OTP verification.
4612
4592
  *
4613
4593
  *
4614
4594
  * Security:
4615
4595
  * - Requires valid session in ACTIVE state
4616
4596
  * - Validates device fingerprint binding
4617
- * - Generates fresh tokens (not returning stored ones)
4618
4597
  * - Only accessible to authenticated sessions with user_id
4619
4598
  * - Validates that header session_id matches path session_id
4620
4599
  * @param params.sessionId {string} Session ID
@@ -7840,7 +7819,7 @@ class EventEmitter {
7840
7819
  */
7841
7820
  const defaultConfig = {
7842
7821
  // API Configuration
7843
- baseUrl: process.env['FINATIC_API_URL'] || 'https://api.finatic.com',
7822
+ baseUrl: process.env['FINATIC_API_URL'] || 'https://api.finatic.dev',
7844
7823
  ...(process.env['FINATIC_API_KEY'] ? { apiKey: process.env['FINATIC_API_KEY'] } : {}),
7845
7824
  timeout: parseInt(process.env['FINATIC_TIMEOUT'] || '30000', 10),
7846
7825
  headers: {},
@@ -7875,7 +7854,7 @@ const defaultConfig = {
7875
7854
  // Client SDK Session Configuration
7876
7855
  sessionStorageKey: 'finatic_session',
7877
7856
  portalConfig: {
7878
- baseUrl: process.env['FINATIC_PORTAL_URL'] || 'https://portal.finatic.com',
7857
+ baseUrl: process.env['FINATIC_PORTAL_URL'] || 'https://portal.finatic.dev',
7879
7858
  autoOpenOnError: process.env['FINATIC_PORTAL_AUTO_OPEN'] !== 'false',
7880
7859
  iframeStyle: {
7881
7860
  border: 'none',
@@ -8240,6 +8219,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8240
8219
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8241
8220
  const localVarHeaderParameter = {};
8242
8221
  const localVarQueryParameter = {};
8222
+ localVarHeaderParameter['Accept'] = 'application/json';
8243
8223
  if (sessionId != null) {
8244
8224
  localVarHeaderParameter['session-id'] = String(sessionId);
8245
8225
  }
@@ -8252,7 +8232,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8252
8232
  };
8253
8233
  },
8254
8234
  /**
8255
- * 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
8235
+ * 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
8256
8236
  * @summary Get Session User
8257
8237
  * @param {string} sessionId Session ID
8258
8238
  * @param {string} xSessionId Session ID from header (must match path parameter)
@@ -8275,6 +8255,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8275
8255
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8276
8256
  const localVarHeaderParameter = {};
8277
8257
  const localVarQueryParameter = {};
8258
+ localVarHeaderParameter['Accept'] = 'application/json';
8278
8259
  if (xSessionId != null) {
8279
8260
  localVarHeaderParameter['x-session-id'] = String(xSessionId);
8280
8261
  }
@@ -8306,6 +8287,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8306
8287
  const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
8307
8288
  const localVarHeaderParameter = {};
8308
8289
  const localVarQueryParameter = {};
8290
+ localVarHeaderParameter['Accept'] = 'application/json';
8309
8291
  if (xApiKey != null) {
8310
8292
  localVarHeaderParameter['x-api-key'] = String(xApiKey);
8311
8293
  }
@@ -8341,6 +8323,7 @@ const SessionApiAxiosParamCreator = function (configuration) {
8341
8323
  const localVarHeaderParameter = {};
8342
8324
  const localVarQueryParameter = {};
8343
8325
  localVarHeaderParameter['Content-Type'] = 'application/json';
8326
+ localVarHeaderParameter['Accept'] = 'application/json';
8344
8327
  if (oneTimeToken != null) {
8345
8328
  localVarHeaderParameter['One-Time-Token'] = String(oneTimeToken);
8346
8329
  }
@@ -8375,7 +8358,7 @@ const SessionApiFp = function (configuration) {
8375
8358
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
8376
8359
  },
8377
8360
  /**
8378
- * 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
8361
+ * 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
8379
8362
  * @summary Get Session User
8380
8363
  * @param {string} sessionId Session ID
8381
8364
  * @param {string} xSessionId Session ID from header (must match path parameter)
@@ -8432,7 +8415,7 @@ class SessionApi extends BaseAPI {
8432
8415
  return SessionApiFp(this.configuration).getPortalUrlApiV1SessionPortalGet(requestParameters.sessionId, options).then((request) => request(this.axios, this.basePath));
8433
8416
  }
8434
8417
  /**
8435
- * 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
8418
+ * 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
8436
8419
  * @summary Get Session User
8437
8420
  * @param {SessionApiGetSessionUserApiV1SessionSessionIdUserGetRequest} requestParameters Request parameters.
8438
8421
  * @param {*} [options] Override http request option.
@@ -8502,6 +8485,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8502
8485
  const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options };
8503
8486
  const localVarHeaderParameter = {};
8504
8487
  const localVarQueryParameter = {};
8488
+ localVarHeaderParameter['Accept'] = 'application/json';
8505
8489
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8506
8490
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8507
8491
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8516,7 +8500,6 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8516
8500
  * @param {string | null} [brokerId] Filter by broker ID
8517
8501
  * @param {string | null} [connectionId] Filter by connection ID
8518
8502
  * @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;)
8519
- * @param {AccountStatus | null} [status] Filter by account status (e.g., \&#39;active\&#39;, \&#39;inactive\&#39;)
8520
8503
  * @param {string | null} [currency] Filter by currency (e.g., \&#39;USD\&#39;, \&#39;EUR\&#39;)
8521
8504
  * @param {number} [limit] Maximum number of accounts to return
8522
8505
  * @param {number} [offset] Number of accounts to skip for pagination
@@ -8524,7 +8507,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8524
8507
  * @param {*} [options] Override http request option.
8525
8508
  * @throws {RequiredError}
8526
8509
  */
8527
- getAccountsApiV1BrokersDataAccountsGet: async (brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options = {}) => {
8510
+ getAccountsApiV1BrokersDataAccountsGet: async (brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options = {}) => {
8528
8511
  const localVarPath = `/api/v1/brokers/data/accounts`;
8529
8512
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
8530
8513
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -8544,9 +8527,6 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8544
8527
  if (accountType !== undefined) {
8545
8528
  localVarQueryParameter['account_type'] = accountType;
8546
8529
  }
8547
- if (status !== undefined) {
8548
- localVarQueryParameter['status'] = status;
8549
- }
8550
8530
  if (currency !== undefined) {
8551
8531
  localVarQueryParameter['currency'] = currency;
8552
8532
  }
@@ -8559,6 +8539,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8559
8539
  if (includeMetadata !== undefined) {
8560
8540
  localVarQueryParameter['include_metadata'] = includeMetadata;
8561
8541
  }
8542
+ localVarHeaderParameter['Accept'] = 'application/json';
8562
8543
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8563
8544
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8564
8545
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8624,6 +8605,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8624
8605
  if (includeMetadata !== undefined) {
8625
8606
  localVarQueryParameter['include_metadata'] = includeMetadata;
8626
8607
  }
8608
+ localVarHeaderParameter['Accept'] = 'application/json';
8627
8609
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8628
8610
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8629
8611
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8649,6 +8631,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8649
8631
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8650
8632
  const localVarHeaderParameter = {};
8651
8633
  const localVarQueryParameter = {};
8634
+ localVarHeaderParameter['Accept'] = 'application/json';
8652
8635
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8653
8636
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8654
8637
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8694,6 +8677,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8694
8677
  if (includeMetadata !== undefined) {
8695
8678
  localVarQueryParameter['include_metadata'] = includeMetadata;
8696
8679
  }
8680
+ localVarHeaderParameter['Accept'] = 'application/json';
8697
8681
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8698
8682
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8699
8683
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8739,6 +8723,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8739
8723
  if (includeMetadata !== undefined) {
8740
8724
  localVarQueryParameter['include_metadata'] = includeMetadata;
8741
8725
  }
8726
+ localVarHeaderParameter['Accept'] = 'application/json';
8742
8727
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8743
8728
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8744
8729
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8796,6 +8781,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8796
8781
  if (includeMetadata !== undefined) {
8797
8782
  localVarQueryParameter['include_metadata'] = includeMetadata;
8798
8783
  }
8784
+ localVarHeaderParameter['Accept'] = 'application/json';
8799
8785
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8800
8786
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8801
8787
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8873,6 +8859,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8873
8859
  if (includeMetadata !== undefined) {
8874
8860
  localVarQueryParameter['include_metadata'] = includeMetadata;
8875
8861
  }
8862
+ localVarHeaderParameter['Accept'] = 'application/json';
8876
8863
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8877
8864
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8878
8865
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8914,6 +8901,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8914
8901
  if (offset !== undefined) {
8915
8902
  localVarQueryParameter['offset'] = offset;
8916
8903
  }
8904
+ localVarHeaderParameter['Accept'] = 'application/json';
8917
8905
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8918
8906
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8919
8907
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8967,6 +8955,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8967
8955
  if (offset !== undefined) {
8968
8956
  localVarQueryParameter['offset'] = offset;
8969
8957
  }
8958
+ localVarHeaderParameter['Accept'] = 'application/json';
8970
8959
  setSearchParams(localVarUrlObj, localVarQueryParameter);
8971
8960
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8972
8961
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -8984,7 +8973,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
8984
8973
  * @param {string | null} [symbol] Filter by symbol
8985
8974
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
8986
8975
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
8987
- * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;open\&#39; (quantity &gt; 0) or \&#39;closed\&#39; (quantity &#x3D; 0)
8976
+ * @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.
8988
8977
  * @param {number} [limit] Maximum number of positions to return
8989
8978
  * @param {number} [offset] Number of positions to skip for pagination
8990
8979
  * @param {string | null} [updatedAfter] Filter positions updated after this timestamp
@@ -9044,6 +9033,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
9044
9033
  if (includeMetadata !== undefined) {
9045
9034
  localVarQueryParameter['include_metadata'] = includeMetadata;
9046
9035
  }
9036
+ localVarHeaderParameter['Accept'] = 'application/json';
9047
9037
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9048
9038
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9049
9039
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9069,6 +9059,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
9069
9059
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9070
9060
  const localVarHeaderParameter = {};
9071
9061
  const localVarQueryParameter = {};
9062
+ localVarHeaderParameter['Accept'] = 'application/json';
9072
9063
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9073
9064
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9074
9065
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9104,7 +9095,6 @@ const BrokersApiFp = function (configuration) {
9104
9095
  * @param {string | null} [brokerId] Filter by broker ID
9105
9096
  * @param {string | null} [connectionId] Filter by connection ID
9106
9097
  * @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;)
9107
- * @param {AccountStatus | null} [status] Filter by account status (e.g., \&#39;active\&#39;, \&#39;inactive\&#39;)
9108
9098
  * @param {string | null} [currency] Filter by currency (e.g., \&#39;USD\&#39;, \&#39;EUR\&#39;)
9109
9099
  * @param {number} [limit] Maximum number of accounts to return
9110
9100
  * @param {number} [offset] Number of accounts to skip for pagination
@@ -9112,8 +9102,8 @@ const BrokersApiFp = function (configuration) {
9112
9102
  * @param {*} [options] Override http request option.
9113
9103
  * @throws {RequiredError}
9114
9104
  */
9115
- async getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options) {
9116
- const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, status, currency, limit, offset, includeMetadata, options);
9105
+ async getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options) {
9106
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountsApiV1BrokersDataAccountsGet(brokerId, connectionId, accountType, currency, limit, offset, includeMetadata, options);
9117
9107
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
9118
9108
  const localVarOperationServerBasePath = operationServerMap['BrokersApi.getAccountsApiV1BrokersDataAccountsGet']?.[localVarOperationServerIndex]?.url;
9119
9109
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
@@ -9272,7 +9262,7 @@ const BrokersApiFp = function (configuration) {
9272
9262
  * @param {string | null} [symbol] Filter by symbol
9273
9263
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
9274
9264
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
9275
- * @param {BrokerDataPositionStatusEnum | null} [positionStatus] Filter by position status: \&#39;open\&#39; (quantity &gt; 0) or \&#39;closed\&#39; (quantity &#x3D; 0)
9265
+ * @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.
9276
9266
  * @param {number} [limit] Maximum number of positions to return
9277
9267
  * @param {number} [offset] Number of positions to skip for pagination
9278
9268
  * @param {string | null} [updatedAfter] Filter positions updated after this timestamp
@@ -9323,7 +9313,7 @@ class BrokersApi extends BaseAPI {
9323
9313
  * @throws {RequiredError}
9324
9314
  */
9325
9315
  getAccountsApiV1BrokersDataAccountsGet(requestParameters = {}, options) {
9326
- 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));
9316
+ 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));
9327
9317
  }
9328
9318
  /**
9329
9319
  * 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.
@@ -9464,35 +9454,7 @@ const CompanyApiAxiosParamCreator = function (configuration) {
9464
9454
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9465
9455
  const localVarHeaderParameter = {};
9466
9456
  const localVarQueryParameter = {};
9467
- setSearchParams(localVarUrlObj, localVarQueryParameter);
9468
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9469
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
9470
- return {
9471
- url: toPathString(localVarUrlObj),
9472
- options: localVarRequestOptions,
9473
- };
9474
- },
9475
- /**
9476
- * Get public company details by ID (no user check, no sensitive data).
9477
- * @summary Get Company
9478
- * @param {string} companyId Company ID
9479
- * @param {*} [options] Override http request option.
9480
- * @throws {RequiredError}
9481
- */
9482
- getCompanyApiV1CompanyCompanyIdGet_1: async (companyId, options = {}) => {
9483
- // verify required parameter 'companyId' is not null or undefined
9484
- assertParamExists('getCompanyApiV1CompanyCompanyIdGet_1', 'companyId', companyId);
9485
- const localVarPath = `/api/v1/company/{company_id}`
9486
- .replace(`{${"company_id"}}`, encodeURIComponent(String(companyId)));
9487
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
9488
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
9489
- let baseOptions;
9490
- if (configuration) {
9491
- baseOptions = configuration.baseOptions;
9492
- }
9493
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
9494
- const localVarHeaderParameter = {};
9495
- const localVarQueryParameter = {};
9457
+ localVarHeaderParameter['Accept'] = 'application/json';
9496
9458
  setSearchParams(localVarUrlObj, localVarQueryParameter);
9497
9459
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
9498
9460
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -9522,19 +9484,6 @@ const CompanyApiFp = function (configuration) {
9522
9484
  const localVarOperationServerBasePath = operationServerMap['CompanyApi.getCompanyApiV1CompanyCompanyIdGet']?.[localVarOperationServerIndex]?.url;
9523
9485
  return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
9524
9486
  },
9525
- /**
9526
- * Get public company details by ID (no user check, no sensitive data).
9527
- * @summary Get Company
9528
- * @param {string} companyId Company ID
9529
- * @param {*} [options] Override http request option.
9530
- * @throws {RequiredError}
9531
- */
9532
- async getCompanyApiV1CompanyCompanyIdGet_1(companyId, options) {
9533
- const localVarAxiosArgs = await localVarAxiosParamCreator.getCompanyApiV1CompanyCompanyIdGet_1(companyId, options);
9534
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
9535
- const localVarOperationServerBasePath = operationServerMap['CompanyApi.getCompanyApiV1CompanyCompanyIdGet_1']?.[localVarOperationServerIndex]?.url;
9536
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
9537
- },
9538
9487
  };
9539
9488
  };
9540
9489
  /**
@@ -9551,16 +9500,6 @@ class CompanyApi extends BaseAPI {
9551
9500
  getCompanyApiV1CompanyCompanyIdGet(requestParameters, options) {
9552
9501
  return CompanyApiFp(this.configuration).getCompanyApiV1CompanyCompanyIdGet(requestParameters.companyId, options).then((request) => request(this.axios, this.basePath));
9553
9502
  }
9554
- /**
9555
- * Get public company details by ID (no user check, no sensitive data).
9556
- * @summary Get Company
9557
- * @param {CompanyApiGetCompanyApiV1CompanyCompanyIdGet0Request} requestParameters Request parameters.
9558
- * @param {*} [options] Override http request option.
9559
- * @throws {RequiredError}
9560
- */
9561
- getCompanyApiV1CompanyCompanyIdGet_1(requestParameters, options) {
9562
- return CompanyApiFp(this.configuration).getCompanyApiV1CompanyCompanyIdGet_1(requestParameters.companyId, options).then((request) => request(this.axios, this.basePath));
9563
- }
9564
9503
  }
9565
9504
 
9566
9505
  /**
@@ -9874,41 +9813,37 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
9874
9813
  this.logger.debug?.('Portal URL generated', { portalUrl });
9875
9814
  return portalUrl;
9876
9815
  }
9877
- /**
9878
- * Open portal in iframe (Client SDK only).
9879
- * The portal handles user authentication and linking to session at the source of truth.
9880
- * This method just records the userId for SDK state.
9881
- *
9882
- * @methodId open_portal_client_sdk
9883
- * @category session
9884
- * @param params - Optional parameters object
9885
- * @param params.theme - Optional theme preset or custom theme object
9886
- * @param params.brokers - Optional array of broker IDs to filter
9887
- * @param params.email - Optional email address
9888
- * @param params.mode - Optional mode ('light' or 'dark')
9889
- * @param onSuccess - Optional callback when portal authentication succeeds
9890
- * @param onError - Optional callback when portal authentication fails
9891
- * @param onClose - Optional callback when portal is closed
9892
- * @returns Promise that resolves when portal is opened
9893
- * @example
9894
- * ```typescript-client
9895
- * await finatic.openPortal({
9896
- * theme: 'default',
9897
- * brokers: ['broker-1'],
9898
- * email: 'user@example.com',
9899
- * mode: 'dark'
9900
- * },
9901
- * (userId) => console.log('User authenticated:', userId),
9902
- * (error) => console.error('Portal error:', error),
9903
- * () => console.log('Portal closed')
9904
- * );
9905
- * ```
9906
- */
9907
- async openPortal(params, onSuccess, onError, onClose) {
9816
+ // Implementation handles both patterns
9817
+ async openPortal(optionsOrParams, onSuccess, onError, onClose) {
9908
9818
  if (!this.sessionId) {
9909
9819
  throw new Error('Session not initialized. Call startSession() first.');
9910
9820
  }
9911
- // Get portal URL with all parameters
9821
+ // Detect which pattern is being used:
9822
+ // - Old pattern: second parameter (onSuccess) is explicitly a function
9823
+ // - New pattern: second parameter is not a function (undefined or not provided)
9824
+ // In new pattern, callbacks are inside the first parameter object
9825
+ const isNewPattern = typeof onSuccess !== 'function';
9826
+ let params;
9827
+ let successCallback;
9828
+ let errorCallback;
9829
+ let closeCallback;
9830
+ if (isNewPattern) {
9831
+ // New pattern: extract callbacks from options object
9832
+ const options = optionsOrParams;
9833
+ const { onSuccess: optOnSuccess, onError: optOnError, onClose: optOnClose, ...portalParams } = options;
9834
+ params = portalParams;
9835
+ successCallback = optOnSuccess;
9836
+ errorCallback = optOnError;
9837
+ closeCallback = optOnClose;
9838
+ }
9839
+ else {
9840
+ // Old pattern: params and callbacks are separate
9841
+ params = optionsOrParams;
9842
+ successCallback = onSuccess;
9843
+ errorCallback = onError;
9844
+ closeCallback = onClose;
9845
+ }
9846
+ // Get portal URL with all parameters (excluding callbacks)
9912
9847
  const portalUrl = await this.getPortalUrl(params);
9913
9848
  // Create portal UI if not exists
9914
9849
  if (!this.portalUI) {
@@ -9922,19 +9857,19 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
9922
9857
  // Emit portal success event
9923
9858
  this.emit('portal:success', userId);
9924
9859
  // Call optional callback
9925
- onSuccess?.(userId);
9860
+ successCallback?.(userId);
9926
9861
  },
9927
9862
  onError: (error) => {
9928
9863
  // Emit portal error event
9929
9864
  this.emit('portal:error', error);
9930
9865
  // Call optional callback
9931
- onError?.(error);
9866
+ errorCallback?.(error);
9932
9867
  },
9933
9868
  onClose: () => {
9934
9869
  // Emit portal close event
9935
9870
  this.emit('portal:close');
9936
9871
  // Call optional callback
9937
- onClose?.();
9872
+ closeCallback?.();
9938
9873
  },
9939
9874
  });
9940
9875
  }