@brokerize/client 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +3 -0
  2. package/dist/apiCtx.d.ts +22 -0
  3. package/dist/apiCtx.js +25 -2
  4. package/dist/authorizedApiContext.js +7 -6
  5. package/dist/cjs/apiCtx.d.ts +22 -0
  6. package/dist/cjs/apiCtx.js +27 -2
  7. package/dist/cjs/authorizedApiContext.js +6 -5
  8. package/dist/cjs/index.js +9 -9
  9. package/dist/cjs/modelExports.d.ts +2 -0
  10. package/dist/cjs/swagger/models/GetQuoteParams.d.ts +8 -0
  11. package/dist/cjs/swagger/models/GetQuoteParams.js +4 -0
  12. package/dist/cjs/swagger/models/OrderCreate.d.ts +8 -0
  13. package/dist/cjs/swagger/models/OrderCreate.js +4 -0
  14. package/dist/cjs/swagger/models/OrderFormLegalCheckbox.d.ts +45 -0
  15. package/dist/cjs/swagger/models/OrderFormLegalCheckbox.js +48 -0
  16. package/dist/cjs/swagger/models/OrderFormLegalCheckboxConstraint.d.ts +43 -0
  17. package/dist/cjs/swagger/models/OrderFormLegalCheckboxConstraint.js +58 -0
  18. package/dist/cjs/swagger/models/PreparedTrade.d.ts +8 -1
  19. package/dist/cjs/swagger/models/PreparedTrade.js +5 -0
  20. package/dist/cjs/swagger/models/index.d.ts +2 -0
  21. package/dist/cjs/swagger/models/index.js +2 -0
  22. package/dist/client.d.ts +122 -2
  23. package/dist/index.js +10 -10
  24. package/dist/modelExports.d.ts +2 -0
  25. package/dist/swagger/models/GetQuoteParams.d.ts +8 -0
  26. package/dist/swagger/models/GetQuoteParams.js +4 -0
  27. package/dist/swagger/models/OrderCreate.d.ts +8 -0
  28. package/dist/swagger/models/OrderCreate.js +4 -0
  29. package/dist/swagger/models/OrderFormLegalCheckbox.d.ts +45 -0
  30. package/dist/swagger/models/OrderFormLegalCheckbox.js +42 -0
  31. package/dist/swagger/models/OrderFormLegalCheckboxConstraint.d.ts +43 -0
  32. package/dist/swagger/models/OrderFormLegalCheckboxConstraint.js +52 -0
  33. package/dist/swagger/models/PreparedTrade.d.ts +8 -1
  34. package/dist/swagger/models/PreparedTrade.js +5 -0
  35. package/dist/swagger/models/index.d.ts +2 -0
  36. package/dist/swagger/models/index.js +2 -0
  37. package/dist/tsdoc-metadata.json +1 -1
  38. package/package.json +8 -8
package/README.md CHANGED
@@ -20,6 +20,9 @@ async function someBrokerizeActions() {
20
20
  createWebSocket: (url, protocol) => new WebSocket(url, protocol),
21
21
  // basePath: 'https://api-preview.brokerize.com', // this is the default value
22
22
  // basePathCryptoService: 'https://crypto-service-api.com' // the optional external crypto service
23
+ // acceptLanguage: 'de', // optional `Accept-Language` header for localized responses (e.g. legal terms).
24
+ // // may also be a function `() => 'de'` that is evaluated on every request,
25
+ // // so runtime language changes are picked up without recreating the client.
23
26
  })
24
27
 
25
28
  /* create a guest user. the result contains the user's tokens and be stored, e.g. in a cookie or session storage */
package/dist/apiCtx.d.ts CHANGED
@@ -19,7 +19,29 @@ export interface BrokerizeConfig {
19
19
  * The AWS cognito configuration, if the application is supposed to be used with brokerize accounts.
20
20
  */
21
21
  cognito?: CognitoConfig;
22
+ /**
23
+ * Optional value for the `Accept-Language` header sent with API requests. Use this to request
24
+ * localized backend responses (e.g. legal terms) in the language selected in your application,
25
+ * overriding the language the browser would send by default.
26
+ *
27
+ * Accepts a static value (e.g. `"de"`, `"en"`, `"de-DE"`) or a function that returns the current
28
+ * language. The function is evaluated on every request, so runtime language changes are picked up
29
+ * without recreating the client. Return `undefined`/`null` (or provide no value) to omit the
30
+ * header and let the runtime/browser default apply.
31
+ */
32
+ acceptLanguage?: string | (() => string | null | undefined | Promise<string | null | undefined>);
22
33
  }
34
+ /**
35
+ * Resolves the configured `Accept-Language` value (static or via a getter function) to a string,
36
+ * or `undefined` if none is configured / the getter yields an empty value.
37
+ */
38
+ export declare function resolveAcceptLanguage(cfg: BrokerizeConfig): Promise<string | undefined>;
39
+ /**
40
+ * Adds the configured `Accept-Language` header to the given headers object (mutating and returning
41
+ * it) if a language is configured. No-op otherwise. Used to apply the configured language uniformly
42
+ * to authorized and unauthenticated requests.
43
+ */
44
+ export declare function withAcceptLanguage(cfg: BrokerizeConfig, headers: Record<string, string>): Promise<Record<string, string>>;
23
45
  export type AuthContextConfiguration = GuestAuthContextConfiguration | RegisteredUserAuthContextConfiguration;
24
46
  export type RegisteredUserAuthContextConfiguration = {
25
47
  type: "registered";
package/dist/apiCtx.js CHANGED
@@ -2,6 +2,29 @@
2
2
  but reduced to the parts actually used by bg-trading. */
3
3
  import { BrokerizeError } from "./index.js";
4
4
  import { Configuration } from "./swagger/index.js";
5
+ /**
6
+ * Resolves the configured `Accept-Language` value (static or via a getter function) to a string,
7
+ * or `undefined` if none is configured / the getter yields an empty value.
8
+ */
9
+ export async function resolveAcceptLanguage(cfg) {
10
+ const { acceptLanguage } = cfg;
11
+ const value = typeof acceptLanguage === "function"
12
+ ? await acceptLanguage()
13
+ : acceptLanguage;
14
+ return value || undefined;
15
+ }
16
+ /**
17
+ * Adds the configured `Accept-Language` header to the given headers object (mutating and returning
18
+ * it) if a language is configured. No-op otherwise. Used to apply the configured language uniformly
19
+ * to authorized and unauthenticated requests.
20
+ */
21
+ export async function withAcceptLanguage(cfg, headers) {
22
+ const acceptLanguage = await resolveAcceptLanguage(cfg);
23
+ if (acceptLanguage) {
24
+ headers["Accept-Language"] = acceptLanguage;
25
+ }
26
+ return headers;
27
+ }
5
28
  export function createConfiguration(cfg) {
6
29
  if (!cfg.clientId) {
7
30
  throw new Error("You must configure a clientId to use the brokerize API.");
@@ -33,10 +56,10 @@ export function createAuth({ authCfg, cfg, options, tokenRefreshCallback, }) {
33
56
  }
34
57
  const response = await fetch(cfg.basePath + "/user/token", {
35
58
  method: "POST",
36
- headers: {
59
+ headers: await withAcceptLanguage(cfg, {
37
60
  "x-brkrz-client-id": cfg.clientId,
38
61
  "Content-Type": "application/x-www-form-urlencoded",
39
- },
62
+ }),
40
63
  // XXX some runtimes do not have URLSearchParams, so just produce the body in the old-fashioned way
41
64
  body: `grant_type=refresh_token&refresh_token=${encodeURIComponent(guestAuthCfg.tokens.response.refreshToken)}`,
42
65
  });
@@ -1,5 +1,5 @@
1
1
  import { Subject } from "rxjs";
2
- import { createConfiguration } from "./apiCtx.js";
2
+ import { createConfiguration, withAcceptLanguage, } from "./apiCtx.js";
3
3
  import { BrokerizeError } from "./errors.js";
4
4
  import { createPollingSubscription } from "./pollingSubscription.js";
5
5
  import * as openApiClient from "./swagger/index.js";
@@ -74,13 +74,14 @@ export class AuthorizedApiContext {
74
74
  throw new Error("AuthorizedApiContext is destroyed");
75
75
  }
76
76
  const tok = await this._auth.getToken();
77
+ const headers = await withAcceptLanguage(this._cfg, {
78
+ "x-brkrz-client-id": this._cfg.clientId,
79
+ Authorization: "Bearer " + tok.idToken,
80
+ "Content-Type": "application/json",
81
+ });
77
82
  return {
78
83
  signal: this._abortController.signal,
79
- headers: {
80
- "x-brkrz-client-id": this._cfg.clientId,
81
- Authorization: "Bearer " + tok.idToken,
82
- "Content-Type": "application/json",
83
- },
84
+ headers,
84
85
  };
85
86
  }
86
87
  async getBrokers() {
@@ -19,7 +19,29 @@ export interface BrokerizeConfig {
19
19
  * The AWS cognito configuration, if the application is supposed to be used with brokerize accounts.
20
20
  */
21
21
  cognito?: CognitoConfig;
22
+ /**
23
+ * Optional value for the `Accept-Language` header sent with API requests. Use this to request
24
+ * localized backend responses (e.g. legal terms) in the language selected in your application,
25
+ * overriding the language the browser would send by default.
26
+ *
27
+ * Accepts a static value (e.g. `"de"`, `"en"`, `"de-DE"`) or a function that returns the current
28
+ * language. The function is evaluated on every request, so runtime language changes are picked up
29
+ * without recreating the client. Return `undefined`/`null` (or provide no value) to omit the
30
+ * header and let the runtime/browser default apply.
31
+ */
32
+ acceptLanguage?: string | (() => string | null | undefined | Promise<string | null | undefined>);
22
33
  }
34
+ /**
35
+ * Resolves the configured `Accept-Language` value (static or via a getter function) to a string,
36
+ * or `undefined` if none is configured / the getter yields an empty value.
37
+ */
38
+ export declare function resolveAcceptLanguage(cfg: BrokerizeConfig): Promise<string | undefined>;
39
+ /**
40
+ * Adds the configured `Accept-Language` header to the given headers object (mutating and returning
41
+ * it) if a language is configured. No-op otherwise. Used to apply the configured language uniformly
42
+ * to authorized and unauthenticated requests.
43
+ */
44
+ export declare function withAcceptLanguage(cfg: BrokerizeConfig, headers: Record<string, string>): Promise<Record<string, string>>;
23
45
  export type AuthContextConfiguration = GuestAuthContextConfiguration | RegisteredUserAuthContextConfiguration;
24
46
  export type RegisteredUserAuthContextConfiguration = {
25
47
  type: "registered";
@@ -1,11 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveAcceptLanguage = resolveAcceptLanguage;
4
+ exports.withAcceptLanguage = withAcceptLanguage;
3
5
  exports.createConfiguration = createConfiguration;
4
6
  exports.createAuth = createAuth;
5
7
  /* Import/Export the DOM parts we rely on. Those are partial copies from the official TypeScript DOM library definitions (https://github.com/microsoft/TypeScript/blob/master/lib/lib.dom.d.ts),
6
8
  but reduced to the parts actually used by bg-trading. */
7
9
  const _1 = require(".");
8
10
  const swagger_1 = require("./swagger");
11
+ /**
12
+ * Resolves the configured `Accept-Language` value (static or via a getter function) to a string,
13
+ * or `undefined` if none is configured / the getter yields an empty value.
14
+ */
15
+ async function resolveAcceptLanguage(cfg) {
16
+ const { acceptLanguage } = cfg;
17
+ const value = typeof acceptLanguage === "function"
18
+ ? await acceptLanguage()
19
+ : acceptLanguage;
20
+ return value || undefined;
21
+ }
22
+ /**
23
+ * Adds the configured `Accept-Language` header to the given headers object (mutating and returning
24
+ * it) if a language is configured. No-op otherwise. Used to apply the configured language uniformly
25
+ * to authorized and unauthenticated requests.
26
+ */
27
+ async function withAcceptLanguage(cfg, headers) {
28
+ const acceptLanguage = await resolveAcceptLanguage(cfg);
29
+ if (acceptLanguage) {
30
+ headers["Accept-Language"] = acceptLanguage;
31
+ }
32
+ return headers;
33
+ }
9
34
  function createConfiguration(cfg) {
10
35
  if (!cfg.clientId) {
11
36
  throw new Error("You must configure a clientId to use the brokerize API.");
@@ -37,10 +62,10 @@ function createAuth({ authCfg, cfg, options, tokenRefreshCallback, }) {
37
62
  }
38
63
  const response = await fetch(cfg.basePath + "/user/token", {
39
64
  method: "POST",
40
- headers: {
65
+ headers: await withAcceptLanguage(cfg, {
41
66
  "x-brkrz-client-id": cfg.clientId,
42
67
  "Content-Type": "application/x-www-form-urlencoded",
43
- },
68
+ }),
44
69
  // XXX some runtimes do not have URLSearchParams, so just produce the body in the old-fashioned way
45
70
  body: `grant_type=refresh_token&refresh_token=${encodeURIComponent(guestAuthCfg.tokens.response.refreshToken)}`,
46
71
  });
@@ -111,13 +111,14 @@ class AuthorizedApiContext {
111
111
  throw new Error("AuthorizedApiContext is destroyed");
112
112
  }
113
113
  const tok = await this._auth.getToken();
114
+ const headers = await (0, apiCtx_1.withAcceptLanguage)(this._cfg, {
115
+ "x-brkrz-client-id": this._cfg.clientId,
116
+ Authorization: "Bearer " + tok.idToken,
117
+ "Content-Type": "application/json",
118
+ });
114
119
  return {
115
120
  signal: this._abortController.signal,
116
- headers: {
117
- "x-brkrz-client-id": this._cfg.clientId,
118
- Authorization: "Bearer " + tok.idToken,
119
- "Content-Type": "application/json",
120
- },
121
+ headers,
121
122
  };
122
123
  }
123
124
  async getBrokers() {
package/dist/cjs/index.js CHANGED
@@ -88,10 +88,10 @@ class Brokerize {
88
88
  async refreshGuestUser(refreshToken) {
89
89
  const response = await fetch(this._cfg.basePath + "/user/token", {
90
90
  method: "POST",
91
- headers: {
91
+ headers: await (0, apiCtx_1.withAcceptLanguage)(this._cfg, {
92
92
  "x-brkrz-client-id": this._cfg.clientId,
93
93
  "Content-Type": "application/x-www-form-urlencoded",
94
- },
94
+ }),
95
95
  // XXX some runtimes do not have URLSearchParams, so just produce the body in the old-fashioned way
96
96
  body: `grant_type=refresh_token&refresh_token=${encodeURIComponent(refreshToken)}`,
97
97
  });
@@ -123,10 +123,10 @@ class Brokerize {
123
123
  async createGuestUser() {
124
124
  const updatedAt = Date.now();
125
125
  const user = await this._userApi.createGuestUser({
126
- headers: {
126
+ headers: await (0, apiCtx_1.withAcceptLanguage)(this._cfg, {
127
127
  "x-brkrz-client-id": this._cfg.clientId,
128
128
  "Content-Type": "application/json",
129
- },
129
+ }),
130
130
  });
131
131
  return {
132
132
  type: "guest",
@@ -173,24 +173,24 @@ class Brokerize {
173
173
  },
174
174
  });
175
175
  }
176
- checkRecoveryPhrase(recoveryPhrase) {
176
+ async checkRecoveryPhrase(recoveryPhrase) {
177
177
  return this._userApi.checkRecoveryPhrase({
178
178
  obtainTokenByRecoveryPhraseParams: { recoveryPhrase },
179
179
  }, {
180
- headers: {
180
+ headers: await (0, apiCtx_1.withAcceptLanguage)(this._cfg, {
181
181
  "x-brkrz-client-id": this._cfg.clientId,
182
182
  "Content-Type": "application/json",
183
- },
183
+ }),
184
184
  });
185
185
  }
186
186
  async obtainTokenByRecoveryPhrase(recoveryPhrase) {
187
187
  const tokResult = await this._userApi.obtainTokenByRecoveryPhrase({
188
188
  obtainTokenByRecoveryPhraseParams: { recoveryPhrase },
189
189
  }, {
190
- headers: {
190
+ headers: await (0, apiCtx_1.withAcceptLanguage)(this._cfg, {
191
191
  "x-brkrz-client-id": this._cfg.clientId,
192
192
  "Content-Type": "application/json",
193
- },
193
+ }),
194
194
  });
195
195
  const updatedAt = Date.now();
196
196
  return {
@@ -169,3 +169,5 @@ export { CheckRecoveryPhrase200Response } from "./swagger/models/CheckRecoveryPh
169
169
  export { SyncHint } from "./swagger/models/SyncHint";
170
170
  export { SyncHintAssumeOrderExecuted } from "./swagger/models/SyncHintAssumeOrderExecuted";
171
171
  export { SyncHintManualReload } from "./swagger/models/SyncHintManualReload";
172
+ export { OrderFormLegalCheckbox } from "./swagger/models/OrderFormLegalCheckbox";
173
+ export { OrderFormLegalCheckboxConstraint } from "./swagger/models/OrderFormLegalCheckboxConstraint";
@@ -48,6 +48,14 @@ export interface GetQuoteParams {
48
48
  * @memberof GetQuoteParams
49
49
  */
50
50
  isin: string;
51
+ /**
52
+ * Whether the user checked the legal checkbox.
53
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
54
+ * current order values (send the selected value even if the user left it at the default).
55
+ * @type {boolean}
56
+ * @memberof GetQuoteParams
57
+ */
58
+ legalCheckboxChecked?: boolean;
51
59
  /**
52
60
  * If a list of sellPositions has been provided in `PrepareTrade`, this must contain the selected position id to sell from
53
61
  * @type {string}
@@ -35,6 +35,9 @@ function GetQuoteParamsFromJSONTyped(json, ignoreDiscriminator) {
35
35
  : json["cashAccountId"],
36
36
  direction: (0, Direction_1.DirectionFromJSON)(json["direction"]),
37
37
  isin: json["isin"],
38
+ legalCheckboxChecked: !(0, runtime_1.exists)(json, "legalCheckboxChecked")
39
+ ? undefined
40
+ : json["legalCheckboxChecked"],
38
41
  sellPositionId: !(0, runtime_1.exists)(json, "sellPositionId")
39
42
  ? undefined
40
43
  : json["sellPositionId"],
@@ -55,6 +58,7 @@ function GetQuoteParamsToJSONRecursive(value, ignoreParent = false) {
55
58
  cashAccountId: value.cashAccountId,
56
59
  direction: (0, Direction_1.DirectionToJSON)(value.direction),
57
60
  isin: value.isin,
61
+ legalCheckboxChecked: value.legalCheckboxChecked,
58
62
  sellPositionId: value.sellPositionId,
59
63
  size: value.size,
60
64
  sizeUnit: value.sizeUnit,
@@ -77,6 +77,14 @@ export interface OrderCreate {
77
77
  * @memberof OrderCreate
78
78
  */
79
79
  isin: string;
80
+ /**
81
+ * Whether the user checked the legal checkbox.
82
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
83
+ * current order values (send the selected value even if the user left it at the default).
84
+ * @type {boolean}
85
+ * @memberof OrderCreate
86
+ */
87
+ legalCheckboxChecked?: boolean;
80
88
  /**
81
89
  * The limit of an order specifies a maximum (direction buy) or minimum (direction sell) value to execute the
82
90
  * order at.
@@ -53,6 +53,9 @@ function OrderCreateFromJSONTyped(json, ignoreDiscriminator) {
53
53
  ifDoneLimit: !(0, runtime_1.exists)(json, "ifDoneLimit") ? undefined : json["ifDoneLimit"],
54
54
  intent: !(0, runtime_1.exists)(json, "intent") ? undefined : json["intent"],
55
55
  isin: json["isin"],
56
+ legalCheckboxChecked: !(0, runtime_1.exists)(json, "legalCheckboxChecked")
57
+ ? undefined
58
+ : json["legalCheckboxChecked"],
56
59
  limit: !(0, runtime_1.exists)(json, "limit") ? undefined : json["limit"],
57
60
  limitCurrencyIso: !(0, runtime_1.exists)(json, "limitCurrencyIso")
58
61
  ? undefined
@@ -101,6 +104,7 @@ function OrderCreateToJSONRecursive(value, ignoreParent = false) {
101
104
  ifDoneLimit: value.ifDoneLimit,
102
105
  intent: value.intent,
103
106
  isin: value.isin,
107
+ legalCheckboxChecked: value.legalCheckboxChecked,
104
108
  limit: value.limit,
105
109
  limitCurrencyIso: value.limitCurrencyIso,
106
110
  orderExtension: (0, OrderExtension_1.OrderExtensionToJSON)(value.orderExtension),
@@ -0,0 +1,45 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { OrderFormLegalCheckboxConstraint } from "./OrderFormLegalCheckboxConstraint";
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface OrderFormLegalCheckbox
16
+ */
17
+ export interface OrderFormLegalCheckbox {
18
+ /**
19
+ * Determines in which cases the legal checkbox must be shown. Iterate over the
20
+ * constraints; if at least one matches the current order values, the checkbox is
21
+ * applicable and must be presented. In that case `legalCheckboxChecked` must be sent
22
+ * with the order (even if the user did not change the default value).
23
+ * @type {Array<OrderFormLegalCheckboxConstraint>}
24
+ * @memberof OrderFormLegalCheckbox
25
+ */
26
+ constraints: Array<OrderFormLegalCheckboxConstraint>;
27
+ /**
28
+ * If `true`, the checkbox must be checked by default.
29
+ * If `false`, the checkbox must *not* be checked by default.
30
+ * @type {boolean}
31
+ * @memberof OrderFormLegalCheckbox
32
+ */
33
+ defaultChecked: boolean;
34
+ /**
35
+ * The text to show for the "legal checkbox". This must be displayed in the OrderForm before
36
+ * the order/getQuote button.
37
+ * @type {string}
38
+ * @memberof OrderFormLegalCheckbox
39
+ */
40
+ text: string;
41
+ }
42
+ export declare function OrderFormLegalCheckboxFromJSON(json: any): OrderFormLegalCheckbox;
43
+ export declare function OrderFormLegalCheckboxFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckbox;
44
+ export declare function OrderFormLegalCheckboxToJSONRecursive(value?: OrderFormLegalCheckbox | null, ignoreParent?: boolean): any;
45
+ export declare function OrderFormLegalCheckboxToJSON(value?: OrderFormLegalCheckbox | null): any;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brokerize
6
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
7
+ *
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.OrderFormLegalCheckboxFromJSON = OrderFormLegalCheckboxFromJSON;
16
+ exports.OrderFormLegalCheckboxFromJSONTyped = OrderFormLegalCheckboxFromJSONTyped;
17
+ exports.OrderFormLegalCheckboxToJSONRecursive = OrderFormLegalCheckboxToJSONRecursive;
18
+ exports.OrderFormLegalCheckboxToJSON = OrderFormLegalCheckboxToJSON;
19
+ const OrderFormLegalCheckboxConstraint_1 = require("./OrderFormLegalCheckboxConstraint");
20
+ function OrderFormLegalCheckboxFromJSON(json) {
21
+ return OrderFormLegalCheckboxFromJSONTyped(json, false);
22
+ }
23
+ function OrderFormLegalCheckboxFromJSONTyped(json, ignoreDiscriminator) {
24
+ if (json === undefined || json === null) {
25
+ return json;
26
+ }
27
+ return {
28
+ constraints: json["constraints"].map(OrderFormLegalCheckboxConstraint_1.OrderFormLegalCheckboxConstraintFromJSON),
29
+ defaultChecked: json["defaultChecked"],
30
+ text: json["text"],
31
+ };
32
+ }
33
+ function OrderFormLegalCheckboxToJSONRecursive(value, ignoreParent = false) {
34
+ if (value === undefined) {
35
+ return undefined;
36
+ }
37
+ if (value === null) {
38
+ return null;
39
+ }
40
+ return {
41
+ constraints: value.constraints.map(OrderFormLegalCheckboxConstraint_1.OrderFormLegalCheckboxConstraintToJSON),
42
+ defaultChecked: value.defaultChecked,
43
+ text: value.text,
44
+ };
45
+ }
46
+ function OrderFormLegalCheckboxToJSON(value) {
47
+ return OrderFormLegalCheckboxToJSONRecursive(value, false);
48
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { Direction } from "./Direction";
12
+ import { OrderModel } from "./OrderModel";
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface OrderFormLegalCheckboxConstraint
17
+ */
18
+ export interface OrderFormLegalCheckboxConstraint {
19
+ /**
20
+ * If set, only consider this a match if the selected direction is contained in this list.
21
+ * @type {Array<Direction>}
22
+ * @memberof OrderFormLegalCheckboxConstraint
23
+ */
24
+ directions?: Array<Direction>;
25
+ /**
26
+ * If set, only consider this a match if the selected `Exchange.id` is contained in the list.
27
+ * @type {Array<string>}
28
+ * @memberof OrderFormLegalCheckboxConstraint
29
+ */
30
+ exchangeIds?: Array<string>;
31
+ /**
32
+ * If set, only consider this a match if the selected `orderModel` is contained in the list.
33
+ * If a matching constraint includes `'quote'`, the value must also be supplied to
34
+ * `GetQuote` (via `GetQuoteParams.legalCheckboxChecked`), not only at order creation.
35
+ * @type {Array<OrderModel>}
36
+ * @memberof OrderFormLegalCheckboxConstraint
37
+ */
38
+ orderModels?: Array<OrderModel>;
39
+ }
40
+ export declare function OrderFormLegalCheckboxConstraintFromJSON(json: any): OrderFormLegalCheckboxConstraint;
41
+ export declare function OrderFormLegalCheckboxConstraintFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckboxConstraint;
42
+ export declare function OrderFormLegalCheckboxConstraintToJSONRecursive(value?: OrderFormLegalCheckboxConstraint | null, ignoreParent?: boolean): any;
43
+ export declare function OrderFormLegalCheckboxConstraintToJSON(value?: OrderFormLegalCheckboxConstraint | null): any;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brokerize
6
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
7
+ *
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.OrderFormLegalCheckboxConstraintFromJSON = OrderFormLegalCheckboxConstraintFromJSON;
16
+ exports.OrderFormLegalCheckboxConstraintFromJSONTyped = OrderFormLegalCheckboxConstraintFromJSONTyped;
17
+ exports.OrderFormLegalCheckboxConstraintToJSONRecursive = OrderFormLegalCheckboxConstraintToJSONRecursive;
18
+ exports.OrderFormLegalCheckboxConstraintToJSON = OrderFormLegalCheckboxConstraintToJSON;
19
+ const runtime_1 = require("../runtime");
20
+ const Direction_1 = require("./Direction");
21
+ const OrderModel_1 = require("./OrderModel");
22
+ function OrderFormLegalCheckboxConstraintFromJSON(json) {
23
+ return OrderFormLegalCheckboxConstraintFromJSONTyped(json, false);
24
+ }
25
+ function OrderFormLegalCheckboxConstraintFromJSONTyped(json, ignoreDiscriminator) {
26
+ if (json === undefined || json === null) {
27
+ return json;
28
+ }
29
+ return {
30
+ directions: !(0, runtime_1.exists)(json, "directions")
31
+ ? undefined
32
+ : json["directions"].map(Direction_1.DirectionFromJSON),
33
+ exchangeIds: !(0, runtime_1.exists)(json, "exchangeIds") ? undefined : json["exchangeIds"],
34
+ orderModels: !(0, runtime_1.exists)(json, "orderModels")
35
+ ? undefined
36
+ : json["orderModels"].map(OrderModel_1.OrderModelFromJSON),
37
+ };
38
+ }
39
+ function OrderFormLegalCheckboxConstraintToJSONRecursive(value, ignoreParent = false) {
40
+ if (value === undefined) {
41
+ return undefined;
42
+ }
43
+ if (value === null) {
44
+ return null;
45
+ }
46
+ return {
47
+ directions: value.directions === undefined
48
+ ? undefined
49
+ : value.directions.map(Direction_1.DirectionToJSON),
50
+ exchangeIds: value.exchangeIds,
51
+ orderModels: value.orderModels === undefined
52
+ ? undefined
53
+ : value.orderModels.map(OrderModel_1.OrderModelToJSON),
54
+ };
55
+ }
56
+ function OrderFormLegalCheckboxConstraintToJSON(value) {
57
+ return OrderFormLegalCheckboxConstraintToJSONRecursive(value, false);
58
+ }
@@ -9,6 +9,7 @@
9
9
  * Do not edit the class manually.
10
10
  */
11
11
  import { Exchange } from "./Exchange";
12
+ import { OrderFormLegalCheckbox } from "./OrderFormLegalCheckbox";
12
13
  import { OrderIntentAvailability } from "./OrderIntentAvailability";
13
14
  import { RiskClassInfo } from "./RiskClassInfo";
14
15
  import { Security } from "./Security";
@@ -56,7 +57,7 @@ export interface PreparedTrade {
56
57
  * (hence the flag name). However, in modern usage, `costDetailsLink` may be present instead.
57
58
  *
58
59
  * In that case, clients can render an action such as "Show detailed costs," which then loads the cost
59
- * estimartion and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
60
+ * estimation and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
60
61
  * @type {boolean}
61
62
  * @memberof PreparedTrade
62
63
  */
@@ -74,6 +75,12 @@ export interface PreparedTrade {
74
75
  * @memberof PreparedTrade
75
76
  */
76
77
  exchanges: Array<Exchange>;
78
+ /**
79
+ *
80
+ * @type {OrderFormLegalCheckbox}
81
+ * @memberof PreparedTrade
82
+ */
83
+ legalCheckbox?: OrderFormLegalCheckbox;
77
84
  /**
78
85
  * If this is true, frontends are not allowed to set an exchange default. Users must select an exchange explicitly.
79
86
  * @type {boolean}
@@ -18,6 +18,7 @@ exports.PreparedTradeToJSONRecursive = PreparedTradeToJSONRecursive;
18
18
  exports.PreparedTradeToJSON = PreparedTradeToJSON;
19
19
  const runtime_1 = require("../runtime");
20
20
  const Exchange_1 = require("./Exchange");
21
+ const OrderFormLegalCheckbox_1 = require("./OrderFormLegalCheckbox");
21
22
  const OrderIntentAvailability_1 = require("./OrderIntentAvailability");
22
23
  const RiskClassInfo_1 = require("./RiskClassInfo");
23
24
  const Security_1 = require("./Security");
@@ -45,6 +46,9 @@ function PreparedTradeFromJSONTyped(json, ignoreDiscriminator) {
45
46
  : json["costEstimationIsOnlyDetailedTable"],
46
47
  costEstimationMustBeShown: json["costEstimationMustBeShown"],
47
48
  exchanges: json["exchanges"].map(Exchange_1.ExchangeFromJSON),
49
+ legalCheckbox: !(0, runtime_1.exists)(json, "legalCheckbox")
50
+ ? undefined
51
+ : (0, OrderFormLegalCheckbox_1.OrderFormLegalCheckboxFromJSON)(json["legalCheckbox"]),
48
52
  noExchangeDefault: !(0, runtime_1.exists)(json, "noExchangeDefault")
49
53
  ? undefined
50
54
  : json["noExchangeDefault"],
@@ -91,6 +95,7 @@ function PreparedTradeToJSONRecursive(value, ignoreParent = false) {
91
95
  costEstimationIsOnlyDetailedTable: value.costEstimationIsOnlyDetailedTable,
92
96
  costEstimationMustBeShown: value.costEstimationMustBeShown,
93
97
  exchanges: value.exchanges.map(Exchange_1.ExchangeToJSON),
98
+ legalCheckbox: (0, OrderFormLegalCheckbox_1.OrderFormLegalCheckboxToJSON)(value.legalCheckbox),
94
99
  noExchangeDefault: value.noExchangeDefault,
95
100
  riskClassInfo: (0, RiskClassInfo_1.RiskClassInfoToJSON)(value.riskClassInfo),
96
101
  security: (0, Security_1.SecurityToJSON)(value.security),
@@ -169,6 +169,8 @@ export * from "./OrderCostEstimation";
169
169
  export * from "./OrderCreate";
170
170
  export * from "./OrderExecution";
171
171
  export * from "./OrderExtension";
172
+ export * from "./OrderFormLegalCheckbox";
173
+ export * from "./OrderFormLegalCheckboxConstraint";
172
174
  export * from "./OrderIntent";
173
175
  export * from "./OrderIntentAvailability";
174
176
  export * from "./OrderModel";
@@ -187,6 +187,8 @@ __exportStar(require("./OrderCostEstimation"), exports);
187
187
  __exportStar(require("./OrderCreate"), exports);
188
188
  __exportStar(require("./OrderExecution"), exports);
189
189
  __exportStar(require("./OrderExtension"), exports);
190
+ __exportStar(require("./OrderFormLegalCheckbox"), exports);
191
+ __exportStar(require("./OrderFormLegalCheckboxConstraint"), exports);
190
192
  __exportStar(require("./OrderIntent"), exports);
191
193
  __exportStar(require("./OrderIntentAvailability"), exports);
192
194
  __exportStar(require("./OrderModel"), exports);
package/dist/client.d.ts CHANGED
@@ -1508,6 +1508,17 @@ export declare interface BrokerizeConfig {
1508
1508
  * The AWS cognito configuration, if the application is supposed to be used with brokerize accounts.
1509
1509
  */
1510
1510
  cognito?: CognitoConfig;
1511
+ /**
1512
+ * Optional value for the `Accept-Language` header sent with API requests. Use this to request
1513
+ * localized backend responses (e.g. legal terms) in the language selected in your application,
1514
+ * overriding the language the browser would send by default.
1515
+ *
1516
+ * Accepts a static value (e.g. `"de"`, `"en"`, `"de-DE"`) or a function that returns the current
1517
+ * language. The function is evaluated on every request, so runtime language changes are picked up
1518
+ * without recreating the client. Return `undefined`/`null` (or provide no value) to omit the
1519
+ * header and let the runtime/browser default apply.
1520
+ */
1521
+ acceptLanguage?: string | (() => string | null | undefined | Promise<string | null | undefined>);
1511
1522
  }
1512
1523
 
1513
1524
  export declare class BrokerizeError extends Error {
@@ -6941,6 +6952,14 @@ declare interface GetQuoteParams {
6941
6952
  * @memberof GetQuoteParams
6942
6953
  */
6943
6954
  isin: string;
6955
+ /**
6956
+ * Whether the user checked the legal checkbox.
6957
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
6958
+ * current order values (send the selected value even if the user left it at the default).
6959
+ * @type {boolean}
6960
+ * @memberof GetQuoteParams
6961
+ */
6962
+ legalCheckboxChecked?: boolean;
6944
6963
  /**
6945
6964
  * If a list of sellPositions has been provided in `PrepareTrade`, this must contain the selected position id to sell from
6946
6965
  * @type {string}
@@ -7920,7 +7939,9 @@ declare namespace Models {
7920
7939
  CheckRecoveryPhrase200Response,
7921
7940
  SyncHint,
7922
7941
  SyncHintAssumeOrderExecuted,
7923
- SyncHintManualReload
7942
+ SyncHintManualReload,
7943
+ OrderFormLegalCheckbox,
7944
+ OrderFormLegalCheckboxConstraint
7924
7945
  }
7925
7946
  }
7926
7947
  export { Models }
@@ -9071,6 +9092,16 @@ declare namespace openApiClient {
9071
9092
  OrderExtensionFromJSONTyped,
9072
9093
  OrderExtensionToJSON,
9073
9094
  OrderExtension,
9095
+ OrderFormLegalCheckboxFromJSON,
9096
+ OrderFormLegalCheckboxFromJSONTyped,
9097
+ OrderFormLegalCheckboxToJSONRecursive,
9098
+ OrderFormLegalCheckboxToJSON,
9099
+ OrderFormLegalCheckbox,
9100
+ OrderFormLegalCheckboxConstraintFromJSON,
9101
+ OrderFormLegalCheckboxConstraintFromJSONTyped,
9102
+ OrderFormLegalCheckboxConstraintToJSONRecursive,
9103
+ OrderFormLegalCheckboxConstraintToJSON,
9104
+ OrderFormLegalCheckboxConstraint,
9074
9105
  OrderIntentFromJSON,
9075
9106
  OrderIntentFromJSONTyped,
9076
9107
  OrderIntentToJSON,
@@ -10211,6 +10242,14 @@ declare interface OrderCreate {
10211
10242
  * @memberof OrderCreate
10212
10243
  */
10213
10244
  isin: string;
10245
+ /**
10246
+ * Whether the user checked the legal checkbox.
10247
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
10248
+ * current order values (send the selected value even if the user left it at the default).
10249
+ * @type {boolean}
10250
+ * @memberof OrderCreate
10251
+ */
10252
+ legalCheckboxChecked?: boolean;
10214
10253
  /**
10215
10254
  * The limit of an order specifies a maximum (direction buy) or minimum (direction sell) value to execute the
10216
10255
  * order at.
@@ -10454,6 +10493,81 @@ declare function OrderExtensionFromJSONTyped(json: any, ignoreDiscriminator: boo
10454
10493
 
10455
10494
  declare function OrderExtensionToJSON(value?: OrderExtension | null): any;
10456
10495
 
10496
+ /**
10497
+ *
10498
+ * @export
10499
+ * @interface OrderFormLegalCheckbox
10500
+ */
10501
+ declare interface OrderFormLegalCheckbox {
10502
+ /**
10503
+ * Determines in which cases the legal checkbox must be shown. Iterate over the
10504
+ * constraints; if at least one matches the current order values, the checkbox is
10505
+ * applicable and must be presented. In that case `legalCheckboxChecked` must be sent
10506
+ * with the order (even if the user did not change the default value).
10507
+ * @type {Array<OrderFormLegalCheckboxConstraint>}
10508
+ * @memberof OrderFormLegalCheckbox
10509
+ */
10510
+ constraints: Array<OrderFormLegalCheckboxConstraint>;
10511
+ /**
10512
+ * If `true`, the checkbox must be checked by default.
10513
+ * If `false`, the checkbox must *not* be checked by default.
10514
+ * @type {boolean}
10515
+ * @memberof OrderFormLegalCheckbox
10516
+ */
10517
+ defaultChecked: boolean;
10518
+ /**
10519
+ * The text to show for the "legal checkbox". This must be displayed in the OrderForm before
10520
+ * the order/getQuote button.
10521
+ * @type {string}
10522
+ * @memberof OrderFormLegalCheckbox
10523
+ */
10524
+ text: string;
10525
+ }
10526
+
10527
+ /**
10528
+ *
10529
+ * @export
10530
+ * @interface OrderFormLegalCheckboxConstraint
10531
+ */
10532
+ declare interface OrderFormLegalCheckboxConstraint {
10533
+ /**
10534
+ * If set, only consider this a match if the selected direction is contained in this list.
10535
+ * @type {Array<Direction>}
10536
+ * @memberof OrderFormLegalCheckboxConstraint
10537
+ */
10538
+ directions?: Array<Direction>;
10539
+ /**
10540
+ * If set, only consider this a match if the selected `Exchange.id` is contained in the list.
10541
+ * @type {Array<string>}
10542
+ * @memberof OrderFormLegalCheckboxConstraint
10543
+ */
10544
+ exchangeIds?: Array<string>;
10545
+ /**
10546
+ * If set, only consider this a match if the selected `orderModel` is contained in the list.
10547
+ * If a matching constraint includes `'quote'`, the value must also be supplied to
10548
+ * `GetQuote` (via `GetQuoteParams.legalCheckboxChecked`), not only at order creation.
10549
+ * @type {Array<OrderModel>}
10550
+ * @memberof OrderFormLegalCheckboxConstraint
10551
+ */
10552
+ orderModels?: Array<OrderModel>;
10553
+ }
10554
+
10555
+ declare function OrderFormLegalCheckboxConstraintFromJSON(json: any): OrderFormLegalCheckboxConstraint;
10556
+
10557
+ declare function OrderFormLegalCheckboxConstraintFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckboxConstraint;
10558
+
10559
+ declare function OrderFormLegalCheckboxConstraintToJSON(value?: OrderFormLegalCheckboxConstraint | null): any;
10560
+
10561
+ declare function OrderFormLegalCheckboxConstraintToJSONRecursive(value?: OrderFormLegalCheckboxConstraint | null, ignoreParent?: boolean): any;
10562
+
10563
+ declare function OrderFormLegalCheckboxFromJSON(json: any): OrderFormLegalCheckbox;
10564
+
10565
+ declare function OrderFormLegalCheckboxFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckbox;
10566
+
10567
+ declare function OrderFormLegalCheckboxToJSON(value?: OrderFormLegalCheckbox | null): any;
10568
+
10569
+ declare function OrderFormLegalCheckboxToJSONRecursive(value?: OrderFormLegalCheckbox | null, ignoreParent?: boolean): any;
10570
+
10457
10571
  declare function OrderFromJSON(json: any): Order;
10458
10572
 
10459
10573
  declare function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order;
@@ -11855,7 +11969,7 @@ declare interface PreparedTrade {
11855
11969
  * (hence the flag name). However, in modern usage, `costDetailsLink` may be present instead.
11856
11970
  *
11857
11971
  * In that case, clients can render an action such as "Show detailed costs," which then loads the cost
11858
- * estimartion and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
11972
+ * estimation and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
11859
11973
  * @type {boolean}
11860
11974
  * @memberof PreparedTrade
11861
11975
  */
@@ -11873,6 +11987,12 @@ declare interface PreparedTrade {
11873
11987
  * @memberof PreparedTrade
11874
11988
  */
11875
11989
  exchanges: Array<Exchange>;
11990
+ /**
11991
+ *
11992
+ * @type {OrderFormLegalCheckbox}
11993
+ * @memberof PreparedTrade
11994
+ */
11995
+ legalCheckbox?: OrderFormLegalCheckbox;
11876
11996
  /**
11877
11997
  * If this is true, frontends are not allowed to set an exchange default. Users must select an exchange explicitly.
11878
11998
  * @type {boolean}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* Import/Export the DOM parts we rely on. Those are partial copies from the official TypeScript DOM library definitions (https://github.com/microsoft/TypeScript/blob/master/lib/lib.dom.d.ts),
2
2
  but reduced to the parts actually used by bg-trading. */
3
- import { createAuth, createConfiguration, } from "./apiCtx.js";
3
+ import { createAuth, createConfiguration, withAcceptLanguage, } from "./apiCtx.js";
4
4
  import { AuthorizedApiContext, getWebSocketURLByBasePath, } from "./authorizedApiContext.js";
5
5
  import { BrokerizeError } from "./errors.js";
6
6
  import * as openApiClient from "./swagger/index.js";
@@ -48,10 +48,10 @@ export class Brokerize {
48
48
  async refreshGuestUser(refreshToken) {
49
49
  const response = await fetch(this._cfg.basePath + "/user/token", {
50
50
  method: "POST",
51
- headers: {
51
+ headers: await withAcceptLanguage(this._cfg, {
52
52
  "x-brkrz-client-id": this._cfg.clientId,
53
53
  "Content-Type": "application/x-www-form-urlencoded",
54
- },
54
+ }),
55
55
  // XXX some runtimes do not have URLSearchParams, so just produce the body in the old-fashioned way
56
56
  body: `grant_type=refresh_token&refresh_token=${encodeURIComponent(refreshToken)}`,
57
57
  });
@@ -83,10 +83,10 @@ export class Brokerize {
83
83
  async createGuestUser() {
84
84
  const updatedAt = Date.now();
85
85
  const user = await this._userApi.createGuestUser({
86
- headers: {
86
+ headers: await withAcceptLanguage(this._cfg, {
87
87
  "x-brkrz-client-id": this._cfg.clientId,
88
88
  "Content-Type": "application/json",
89
- },
89
+ }),
90
90
  });
91
91
  return {
92
92
  type: "guest",
@@ -133,24 +133,24 @@ export class Brokerize {
133
133
  },
134
134
  });
135
135
  }
136
- checkRecoveryPhrase(recoveryPhrase) {
136
+ async checkRecoveryPhrase(recoveryPhrase) {
137
137
  return this._userApi.checkRecoveryPhrase({
138
138
  obtainTokenByRecoveryPhraseParams: { recoveryPhrase },
139
139
  }, {
140
- headers: {
140
+ headers: await withAcceptLanguage(this._cfg, {
141
141
  "x-brkrz-client-id": this._cfg.clientId,
142
142
  "Content-Type": "application/json",
143
- },
143
+ }),
144
144
  });
145
145
  }
146
146
  async obtainTokenByRecoveryPhrase(recoveryPhrase) {
147
147
  const tokResult = await this._userApi.obtainTokenByRecoveryPhrase({
148
148
  obtainTokenByRecoveryPhraseParams: { recoveryPhrase },
149
149
  }, {
150
- headers: {
150
+ headers: await withAcceptLanguage(this._cfg, {
151
151
  "x-brkrz-client-id": this._cfg.clientId,
152
152
  "Content-Type": "application/json",
153
- },
153
+ }),
154
154
  });
155
155
  const updatedAt = Date.now();
156
156
  return {
@@ -169,3 +169,5 @@ export { CheckRecoveryPhrase200Response } from "./swagger/models/CheckRecoveryPh
169
169
  export { SyncHint } from "./swagger/models/SyncHint";
170
170
  export { SyncHintAssumeOrderExecuted } from "./swagger/models/SyncHintAssumeOrderExecuted";
171
171
  export { SyncHintManualReload } from "./swagger/models/SyncHintManualReload";
172
+ export { OrderFormLegalCheckbox } from "./swagger/models/OrderFormLegalCheckbox";
173
+ export { OrderFormLegalCheckboxConstraint } from "./swagger/models/OrderFormLegalCheckboxConstraint";
@@ -48,6 +48,14 @@ export interface GetQuoteParams {
48
48
  * @memberof GetQuoteParams
49
49
  */
50
50
  isin: string;
51
+ /**
52
+ * Whether the user checked the legal checkbox.
53
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
54
+ * current order values (send the selected value even if the user left it at the default).
55
+ * @type {boolean}
56
+ * @memberof GetQuoteParams
57
+ */
58
+ legalCheckboxChecked?: boolean;
51
59
  /**
52
60
  * If a list of sellPositions has been provided in `PrepareTrade`, this must contain the selected position id to sell from
53
61
  * @type {string}
@@ -29,6 +29,9 @@ export function GetQuoteParamsFromJSONTyped(json, ignoreDiscriminator) {
29
29
  : json["cashAccountId"],
30
30
  direction: DirectionFromJSON(json["direction"]),
31
31
  isin: json["isin"],
32
+ legalCheckboxChecked: !exists(json, "legalCheckboxChecked")
33
+ ? undefined
34
+ : json["legalCheckboxChecked"],
32
35
  sellPositionId: !exists(json, "sellPositionId")
33
36
  ? undefined
34
37
  : json["sellPositionId"],
@@ -49,6 +52,7 @@ export function GetQuoteParamsToJSONRecursive(value, ignoreParent = false) {
49
52
  cashAccountId: value.cashAccountId,
50
53
  direction: DirectionToJSON(value.direction),
51
54
  isin: value.isin,
55
+ legalCheckboxChecked: value.legalCheckboxChecked,
52
56
  sellPositionId: value.sellPositionId,
53
57
  size: value.size,
54
58
  sizeUnit: value.sizeUnit,
@@ -77,6 +77,14 @@ export interface OrderCreate {
77
77
  * @memberof OrderCreate
78
78
  */
79
79
  isin: string;
80
+ /**
81
+ * Whether the user checked the legal checkbox.
82
+ * Required if the preparedTrade's `legalCheckbox` has a constraint matching the
83
+ * current order values (send the selected value even if the user left it at the default).
84
+ * @type {boolean}
85
+ * @memberof OrderCreate
86
+ */
87
+ legalCheckboxChecked?: boolean;
80
88
  /**
81
89
  * The limit of an order specifies a maximum (direction buy) or minimum (direction sell) value to execute the
82
90
  * order at.
@@ -46,6 +46,9 @@ export function OrderCreateFromJSONTyped(json, ignoreDiscriminator) {
46
46
  ifDoneLimit: !exists(json, "ifDoneLimit") ? undefined : json["ifDoneLimit"],
47
47
  intent: !exists(json, "intent") ? undefined : json["intent"],
48
48
  isin: json["isin"],
49
+ legalCheckboxChecked: !exists(json, "legalCheckboxChecked")
50
+ ? undefined
51
+ : json["legalCheckboxChecked"],
49
52
  limit: !exists(json, "limit") ? undefined : json["limit"],
50
53
  limitCurrencyIso: !exists(json, "limitCurrencyIso")
51
54
  ? undefined
@@ -94,6 +97,7 @@ export function OrderCreateToJSONRecursive(value, ignoreParent = false) {
94
97
  ifDoneLimit: value.ifDoneLimit,
95
98
  intent: value.intent,
96
99
  isin: value.isin,
100
+ legalCheckboxChecked: value.legalCheckboxChecked,
97
101
  limit: value.limit,
98
102
  limitCurrencyIso: value.limitCurrencyIso,
99
103
  orderExtension: OrderExtensionToJSON(value.orderExtension),
@@ -0,0 +1,45 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { OrderFormLegalCheckboxConstraint } from "./OrderFormLegalCheckboxConstraint";
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface OrderFormLegalCheckbox
16
+ */
17
+ export interface OrderFormLegalCheckbox {
18
+ /**
19
+ * Determines in which cases the legal checkbox must be shown. Iterate over the
20
+ * constraints; if at least one matches the current order values, the checkbox is
21
+ * applicable and must be presented. In that case `legalCheckboxChecked` must be sent
22
+ * with the order (even if the user did not change the default value).
23
+ * @type {Array<OrderFormLegalCheckboxConstraint>}
24
+ * @memberof OrderFormLegalCheckbox
25
+ */
26
+ constraints: Array<OrderFormLegalCheckboxConstraint>;
27
+ /**
28
+ * If `true`, the checkbox must be checked by default.
29
+ * If `false`, the checkbox must *not* be checked by default.
30
+ * @type {boolean}
31
+ * @memberof OrderFormLegalCheckbox
32
+ */
33
+ defaultChecked: boolean;
34
+ /**
35
+ * The text to show for the "legal checkbox". This must be displayed in the OrderForm before
36
+ * the order/getQuote button.
37
+ * @type {string}
38
+ * @memberof OrderFormLegalCheckbox
39
+ */
40
+ text: string;
41
+ }
42
+ export declare function OrderFormLegalCheckboxFromJSON(json: any): OrderFormLegalCheckbox;
43
+ export declare function OrderFormLegalCheckboxFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckbox;
44
+ export declare function OrderFormLegalCheckboxToJSONRecursive(value?: OrderFormLegalCheckbox | null, ignoreParent?: boolean): any;
45
+ export declare function OrderFormLegalCheckboxToJSON(value?: OrderFormLegalCheckbox | null): any;
@@ -0,0 +1,42 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * brokerize
5
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
6
+ *
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ import { OrderFormLegalCheckboxConstraintFromJSON, OrderFormLegalCheckboxConstraintToJSON, } from "./OrderFormLegalCheckboxConstraint.js";
14
+ export function OrderFormLegalCheckboxFromJSON(json) {
15
+ return OrderFormLegalCheckboxFromJSONTyped(json, false);
16
+ }
17
+ export function OrderFormLegalCheckboxFromJSONTyped(json, ignoreDiscriminator) {
18
+ if (json === undefined || json === null) {
19
+ return json;
20
+ }
21
+ return {
22
+ constraints: json["constraints"].map(OrderFormLegalCheckboxConstraintFromJSON),
23
+ defaultChecked: json["defaultChecked"],
24
+ text: json["text"],
25
+ };
26
+ }
27
+ export function OrderFormLegalCheckboxToJSONRecursive(value, ignoreParent = false) {
28
+ if (value === undefined) {
29
+ return undefined;
30
+ }
31
+ if (value === null) {
32
+ return null;
33
+ }
34
+ return {
35
+ constraints: value.constraints.map(OrderFormLegalCheckboxConstraintToJSON),
36
+ defaultChecked: value.defaultChecked,
37
+ text: value.text,
38
+ };
39
+ }
40
+ export function OrderFormLegalCheckboxToJSON(value) {
41
+ return OrderFormLegalCheckboxToJSONRecursive(value, false);
42
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { Direction } from "./Direction";
12
+ import { OrderModel } from "./OrderModel";
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface OrderFormLegalCheckboxConstraint
17
+ */
18
+ export interface OrderFormLegalCheckboxConstraint {
19
+ /**
20
+ * If set, only consider this a match if the selected direction is contained in this list.
21
+ * @type {Array<Direction>}
22
+ * @memberof OrderFormLegalCheckboxConstraint
23
+ */
24
+ directions?: Array<Direction>;
25
+ /**
26
+ * If set, only consider this a match if the selected `Exchange.id` is contained in the list.
27
+ * @type {Array<string>}
28
+ * @memberof OrderFormLegalCheckboxConstraint
29
+ */
30
+ exchangeIds?: Array<string>;
31
+ /**
32
+ * If set, only consider this a match if the selected `orderModel` is contained in the list.
33
+ * If a matching constraint includes `'quote'`, the value must also be supplied to
34
+ * `GetQuote` (via `GetQuoteParams.legalCheckboxChecked`), not only at order creation.
35
+ * @type {Array<OrderModel>}
36
+ * @memberof OrderFormLegalCheckboxConstraint
37
+ */
38
+ orderModels?: Array<OrderModel>;
39
+ }
40
+ export declare function OrderFormLegalCheckboxConstraintFromJSON(json: any): OrderFormLegalCheckboxConstraint;
41
+ export declare function OrderFormLegalCheckboxConstraintFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrderFormLegalCheckboxConstraint;
42
+ export declare function OrderFormLegalCheckboxConstraintToJSONRecursive(value?: OrderFormLegalCheckboxConstraint | null, ignoreParent?: boolean): any;
43
+ export declare function OrderFormLegalCheckboxConstraintToJSON(value?: OrderFormLegalCheckboxConstraint | null): any;
@@ -0,0 +1,52 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * brokerize
5
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
6
+ *
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ import { exists } from "../runtime.js";
14
+ import { DirectionFromJSON, DirectionToJSON, } from "./Direction.js";
15
+ import { OrderModelFromJSON, OrderModelToJSON, } from "./OrderModel.js";
16
+ export function OrderFormLegalCheckboxConstraintFromJSON(json) {
17
+ return OrderFormLegalCheckboxConstraintFromJSONTyped(json, false);
18
+ }
19
+ export function OrderFormLegalCheckboxConstraintFromJSONTyped(json, ignoreDiscriminator) {
20
+ if (json === undefined || json === null) {
21
+ return json;
22
+ }
23
+ return {
24
+ directions: !exists(json, "directions")
25
+ ? undefined
26
+ : json["directions"].map(DirectionFromJSON),
27
+ exchangeIds: !exists(json, "exchangeIds") ? undefined : json["exchangeIds"],
28
+ orderModels: !exists(json, "orderModels")
29
+ ? undefined
30
+ : json["orderModels"].map(OrderModelFromJSON),
31
+ };
32
+ }
33
+ export function OrderFormLegalCheckboxConstraintToJSONRecursive(value, ignoreParent = false) {
34
+ if (value === undefined) {
35
+ return undefined;
36
+ }
37
+ if (value === null) {
38
+ return null;
39
+ }
40
+ return {
41
+ directions: value.directions === undefined
42
+ ? undefined
43
+ : value.directions.map(DirectionToJSON),
44
+ exchangeIds: value.exchangeIds,
45
+ orderModels: value.orderModels === undefined
46
+ ? undefined
47
+ : value.orderModels.map(OrderModelToJSON),
48
+ };
49
+ }
50
+ export function OrderFormLegalCheckboxConstraintToJSON(value) {
51
+ return OrderFormLegalCheckboxConstraintToJSONRecursive(value, false);
52
+ }
@@ -9,6 +9,7 @@
9
9
  * Do not edit the class manually.
10
10
  */
11
11
  import { Exchange } from "./Exchange";
12
+ import { OrderFormLegalCheckbox } from "./OrderFormLegalCheckbox";
12
13
  import { OrderIntentAvailability } from "./OrderIntentAvailability";
13
14
  import { RiskClassInfo } from "./RiskClassInfo";
14
15
  import { Security } from "./Security";
@@ -56,7 +57,7 @@ export interface PreparedTrade {
56
57
  * (hence the flag name). However, in modern usage, `costDetailsLink` may be present instead.
57
58
  *
58
59
  * In that case, clients can render an action such as "Show detailed costs," which then loads the cost
59
- * estimartion and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
60
+ * estimation and either displays the `detailedTable` or navigates to the `costDetailsLink` URL.
60
61
  * @type {boolean}
61
62
  * @memberof PreparedTrade
62
63
  */
@@ -74,6 +75,12 @@ export interface PreparedTrade {
74
75
  * @memberof PreparedTrade
75
76
  */
76
77
  exchanges: Array<Exchange>;
78
+ /**
79
+ *
80
+ * @type {OrderFormLegalCheckbox}
81
+ * @memberof PreparedTrade
82
+ */
83
+ legalCheckbox?: OrderFormLegalCheckbox;
77
84
  /**
78
85
  * If this is true, frontends are not allowed to set an exchange default. Users must select an exchange explicitly.
79
86
  * @type {boolean}
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { exists } from "../runtime.js";
14
14
  import { ExchangeFromJSON, ExchangeToJSON, } from "./Exchange.js";
15
+ import { OrderFormLegalCheckboxFromJSON, OrderFormLegalCheckboxToJSON, } from "./OrderFormLegalCheckbox.js";
15
16
  import { OrderIntentAvailabilityFromJSON, OrderIntentAvailabilityToJSON, } from "./OrderIntentAvailability.js";
16
17
  import { RiskClassInfoFromJSON, RiskClassInfoToJSON, } from "./RiskClassInfo.js";
17
18
  import { SecurityFromJSON, SecurityToJSON, } from "./Security.js";
@@ -39,6 +40,9 @@ export function PreparedTradeFromJSONTyped(json, ignoreDiscriminator) {
39
40
  : json["costEstimationIsOnlyDetailedTable"],
40
41
  costEstimationMustBeShown: json["costEstimationMustBeShown"],
41
42
  exchanges: json["exchanges"].map(ExchangeFromJSON),
43
+ legalCheckbox: !exists(json, "legalCheckbox")
44
+ ? undefined
45
+ : OrderFormLegalCheckboxFromJSON(json["legalCheckbox"]),
42
46
  noExchangeDefault: !exists(json, "noExchangeDefault")
43
47
  ? undefined
44
48
  : json["noExchangeDefault"],
@@ -85,6 +89,7 @@ export function PreparedTradeToJSONRecursive(value, ignoreParent = false) {
85
89
  costEstimationIsOnlyDetailedTable: value.costEstimationIsOnlyDetailedTable,
86
90
  costEstimationMustBeShown: value.costEstimationMustBeShown,
87
91
  exchanges: value.exchanges.map(ExchangeToJSON),
92
+ legalCheckbox: OrderFormLegalCheckboxToJSON(value.legalCheckbox),
88
93
  noExchangeDefault: value.noExchangeDefault,
89
94
  riskClassInfo: RiskClassInfoToJSON(value.riskClassInfo),
90
95
  security: SecurityToJSON(value.security),
@@ -169,6 +169,8 @@ export * from "./OrderCostEstimation";
169
169
  export * from "./OrderCreate";
170
170
  export * from "./OrderExecution";
171
171
  export * from "./OrderExtension";
172
+ export * from "./OrderFormLegalCheckbox";
173
+ export * from "./OrderFormLegalCheckboxConstraint";
172
174
  export * from "./OrderIntent";
173
175
  export * from "./OrderIntentAvailability";
174
176
  export * from "./OrderModel";
@@ -171,6 +171,8 @@ export * from "./OrderCostEstimation.js";
171
171
  export * from "./OrderCreate.js";
172
172
  export * from "./OrderExecution.js";
173
173
  export * from "./OrderExtension.js";
174
+ export * from "./OrderFormLegalCheckbox.js";
175
+ export * from "./OrderFormLegalCheckboxConstraint.js";
174
176
  export * from "./OrderIntent.js";
175
177
  export * from "./OrderIntentAvailability.js";
176
178
  export * from "./OrderModel.js";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.8"
8
+ "packageVersion": "7.58.11"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brokerize/client",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Client for the brokerize.com API",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/brokerize/client-js#readme",
@@ -61,15 +61,15 @@
61
61
  "package.json": "sort-package-json"
62
62
  },
63
63
  "devDependencies": {
64
- "@microsoft/api-extractor": "7.58.8",
65
- "@openapitools/openapi-generator-cli": "2.38.0",
66
- "@types/node": "24.12.3",
67
- "@typescript-eslint/eslint-plugin": "8.61.0",
68
- "eslint": "10.4.1",
64
+ "@microsoft/api-extractor": "7.58.11",
65
+ "@openapitools/openapi-generator-cli": "2.39.1",
66
+ "@types/node": "24.13.3",
67
+ "@typescript-eslint/eslint-plugin": "8.64.0",
68
+ "eslint": "10.7.0",
69
69
  "eslint-config-prettier": "10.1.8",
70
70
  "husky": "9.1.7",
71
- "lint-staged": "17.0.7",
72
- "prettier": "3.8.4",
71
+ "lint-staged": "17.0.8",
72
+ "prettier": "3.9.5",
73
73
  "sort-package-json": "4.0.0",
74
74
  "typescript": "6.0.3"
75
75
  },