@brokerize/client 1.3.9 → 1.3.10
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/authorizedApiContext.d.ts +20 -21
- package/dist/authorizedApiContext.js +36 -41
- package/dist/client.d.ts +689 -386
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/swagger/apis/DecoupledOperationsApi.d.ts +35 -0
- package/dist/swagger/apis/DecoupledOperationsApi.js +86 -0
- package/dist/swagger/apis/{ChangeOrderApi.d.ts → OrderApi.d.ts} +35 -2
- package/dist/swagger/apis/{ChangeOrderApi.js → OrderApi.js} +117 -2
- package/dist/swagger/apis/{DefaultApi.d.ts → PortfolioApi.d.ts} +2 -160
- package/dist/swagger/apis/{DefaultApi.js → PortfolioApi.js} +2 -568
- package/dist/swagger/apis/SessionApi.d.ts +146 -0
- package/dist/swagger/apis/SessionApi.js +474 -0
- package/dist/swagger/apis/UserApi.d.ts +89 -1
- package/dist/swagger/apis/UserApi.js +309 -1
- package/dist/swagger/apis/WebsocketApi.d.ts +24 -0
- package/dist/swagger/apis/WebsocketApi.js +38 -0
- package/dist/swagger/apis/index.d.ts +5 -4
- package/dist/swagger/apis/index.js +5 -4
- package/dist/swagger/models/CheckRecoveryPhrase200Response.d.ts +27 -0
- package/dist/swagger/models/CheckRecoveryPhrase200Response.js +37 -0
- package/dist/swagger/models/CreateRecoveryPhraseParams.d.ts +28 -0
- package/dist/swagger/models/CreateRecoveryPhraseParams.js +37 -0
- package/dist/swagger/models/CreateRecoveryPhraseResult.d.ts +27 -0
- package/dist/swagger/models/CreateRecoveryPhraseResult.js +37 -0
- package/dist/swagger/models/GetRecoveryPhrasesResponse.d.ts +28 -0
- package/dist/swagger/models/GetRecoveryPhrasesResponse.js +38 -0
- package/dist/swagger/models/ObtainTokenByRecoveryPhraseParams.d.ts +27 -0
- package/dist/swagger/models/ObtainTokenByRecoveryPhraseParams.js +37 -0
- package/dist/swagger/models/RecoveryPhraseItem.d.ts +51 -0
- package/dist/swagger/models/RecoveryPhraseItem.js +45 -0
- package/dist/swagger/models/index.d.ts +6 -0
- package/dist/swagger/models/index.js +6 -0
- package/package.json +1 -1
- package/dist/swagger/apis/BrokerLoginApi.d.ts +0 -59
- package/dist/swagger/apis/BrokerLoginApi.js +0 -169
- package/dist/swagger/apis/CancelOrderApi.d.ts +0 -41
- package/dist/swagger/apis/CancelOrderApi.js +0 -101
|
@@ -9,10 +9,26 @@
|
|
|
9
9
|
* Do not edit the class manually.
|
|
10
10
|
*/
|
|
11
11
|
import * as runtime from "../runtime";
|
|
12
|
-
import { AccessTokenResult, CreateAccessTokenParams, GetAccessTokensResponse, GetAcessTokenAvailablePermissions200Response } from "../models";
|
|
12
|
+
import { AccessTokenResult, CheckRecoveryPhrase200Response, CreateAccessTokenParams, CreateGuestUserResponse, CreateRecoveryPhraseParams, CreateRecoveryPhraseResult, GetAccessTokensResponse, GetAcessTokenAvailablePermissions200Response, GetRecoveryPhrasesResponse, GetUserResponse, ObtainTokenByRecoveryPhraseParams, TokenResponse } from "../models";
|
|
13
|
+
export interface CheckRecoveryPhraseRequest {
|
|
14
|
+
obtainTokenByRecoveryPhraseParams: ObtainTokenByRecoveryPhraseParams;
|
|
15
|
+
}
|
|
13
16
|
export interface CreateAccessTokenRequest {
|
|
14
17
|
createAccessTokenParams: CreateAccessTokenParams;
|
|
15
18
|
}
|
|
19
|
+
export interface CreateRecoveryPhraseRequest {
|
|
20
|
+
createRecoveryPhraseParams: CreateRecoveryPhraseParams;
|
|
21
|
+
}
|
|
22
|
+
export interface DeleteRecoveryPhraseRequest {
|
|
23
|
+
recoveryPhraseId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ObtainTokenRequest {
|
|
26
|
+
grantType: string;
|
|
27
|
+
refreshToken: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ObtainTokenByRecoveryPhraseRequest {
|
|
30
|
+
obtainTokenByRecoveryPhraseParams: ObtainTokenByRecoveryPhraseParams;
|
|
31
|
+
}
|
|
16
32
|
export interface RevokeAccessTokenRequest {
|
|
17
33
|
accessTokenId: string;
|
|
18
34
|
}
|
|
@@ -20,6 +36,14 @@ export interface RevokeAccessTokenRequest {
|
|
|
20
36
|
*
|
|
21
37
|
*/
|
|
22
38
|
export declare class UserApi extends runtime.BaseAPI {
|
|
39
|
+
/**
|
|
40
|
+
* Check if the RecoveryPhrase is still valid without obtaining a new token set. This can be used in frontends when users are asked if they still have their RecoveryPhrase.
|
|
41
|
+
*/
|
|
42
|
+
checkRecoveryPhraseRaw(requestParameters: CheckRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<CheckRecoveryPhrase200Response>>;
|
|
43
|
+
/**
|
|
44
|
+
* Check if the RecoveryPhrase is still valid without obtaining a new token set. This can be used in frontends when users are asked if they still have their RecoveryPhrase.
|
|
45
|
+
*/
|
|
46
|
+
checkRecoveryPhrase(requestParameters: CheckRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<CheckRecoveryPhrase200Response>;
|
|
23
47
|
/**
|
|
24
48
|
* Create a token for the current user. The token can be used to access resources on behalf of the user.
|
|
25
49
|
*/
|
|
@@ -28,6 +52,38 @@ export declare class UserApi extends runtime.BaseAPI {
|
|
|
28
52
|
* Create a token for the current user. The token can be used to access resources on behalf of the user.
|
|
29
53
|
*/
|
|
30
54
|
createAccessToken(requestParameters: CreateAccessTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<AccessTokenResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a guest user and return a token which can be used to access resources. The lifetime of the generated temporary user as well as the returned `access_token` depend on the client configuration. It is usually around 24 hours. For some clients, tokens can be expired earlier based on inactivity. If the client has configured a longer lifetime for their guest users, a `refresh_token` is included in the response. This token can be used to renew the `access_token` after it has expired. The `refresh_token` can be used to obtain a new `access_token` after the original token has expired using the `/user/token` endpoint.
|
|
57
|
+
*/
|
|
58
|
+
createGuestUserRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<CreateGuestUserResponse>>;
|
|
59
|
+
/**
|
|
60
|
+
* Create a guest user and return a token which can be used to access resources. The lifetime of the generated temporary user as well as the returned `access_token` depend on the client configuration. It is usually around 24 hours. For some clients, tokens can be expired earlier based on inactivity. If the client has configured a longer lifetime for their guest users, a `refresh_token` is included in the response. This token can be used to renew the `access_token` after it has expired. The `refresh_token` can be used to obtain a new `access_token` after the original token has expired using the `/user/token` endpoint.
|
|
61
|
+
*/
|
|
62
|
+
createGuestUser(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<CreateGuestUserResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Create a RecoveryPhrase for the current guest user. The brokerize backend uses RecoveryPhrases instead of email + password registration or similar approaches, which can never be guaranteed to be anonymous. Users can simply generate a RecoveryPhrase and save it in a password manager, memorize it or write it down in a safe location. The BIP39 word list known from Bitcoins is used to encode a cryptographically safe random token and allows access to the account later (see endpoint `ObtainTokenFromRecoveryPhrase`).
|
|
65
|
+
*/
|
|
66
|
+
createRecoveryPhraseRaw(requestParameters: CreateRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<CreateRecoveryPhraseResult>>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a RecoveryPhrase for the current guest user. The brokerize backend uses RecoveryPhrases instead of email + password registration or similar approaches, which can never be guaranteed to be anonymous. Users can simply generate a RecoveryPhrase and save it in a password manager, memorize it or write it down in a safe location. The BIP39 word list known from Bitcoins is used to encode a cryptographically safe random token and allows access to the account later (see endpoint `ObtainTokenFromRecoveryPhrase`).
|
|
69
|
+
*/
|
|
70
|
+
createRecoveryPhrase(requestParameters: CreateRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<CreateRecoveryPhraseResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Delete the current user (only allowed if it is a guest account). Also logs out all active broker sessions attached to the user.
|
|
73
|
+
*/
|
|
74
|
+
deleteGuestUserRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>;
|
|
75
|
+
/**
|
|
76
|
+
* Delete the current user (only allowed if it is a guest account). Also logs out all active broker sessions attached to the user.
|
|
77
|
+
*/
|
|
78
|
+
deleteGuestUser(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Delete the RecoveryPhrase from the account.
|
|
81
|
+
*/
|
|
82
|
+
deleteRecoveryPhraseRaw(requestParameters: DeleteRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>;
|
|
83
|
+
/**
|
|
84
|
+
* Delete the RecoveryPhrase from the account.
|
|
85
|
+
*/
|
|
86
|
+
deleteRecoveryPhrase(requestParameters: DeleteRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void>;
|
|
31
87
|
/**
|
|
32
88
|
*/
|
|
33
89
|
getAccessTokensRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<GetAccessTokensResponse>>;
|
|
@@ -42,6 +98,38 @@ export declare class UserApi extends runtime.BaseAPI {
|
|
|
42
98
|
* Figure out which permissions are available to select from for a new access token.
|
|
43
99
|
*/
|
|
44
100
|
getAcessTokenAvailablePermissions(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetAcessTokenAvailablePermissions200Response>;
|
|
101
|
+
/**
|
|
102
|
+
* Lists all the recoveryPhrases metadata the user has in their account.
|
|
103
|
+
*/
|
|
104
|
+
getRecoveryPhrasesRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<GetRecoveryPhrasesResponse>>;
|
|
105
|
+
/**
|
|
106
|
+
* Lists all the recoveryPhrases metadata the user has in their account.
|
|
107
|
+
*/
|
|
108
|
+
getRecoveryPhrases(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetRecoveryPhrasesResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* Checks the provided authentication and returns the logged-in user.
|
|
111
|
+
*/
|
|
112
|
+
getUserRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<GetUserResponse>>;
|
|
113
|
+
/**
|
|
114
|
+
* Checks the provided authentication and returns the logged-in user.
|
|
115
|
+
*/
|
|
116
|
+
getUser(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetUserResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
|
|
119
|
+
*/
|
|
120
|
+
obtainTokenRaw(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<TokenResponse>>;
|
|
121
|
+
/**
|
|
122
|
+
* Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
|
|
123
|
+
*/
|
|
124
|
+
obtainToken(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<TokenResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Obtain a new access and refresh token set by a RecoveryPhrase. The new set also contains a refresh_token etc, so it can then be used just like the tokens obtained from the `ObtainToken` endpoint. This also creates a new `trading_session`, as RecoveryPhrases never allow access to an existing trading_session.
|
|
127
|
+
*/
|
|
128
|
+
obtainTokenByRecoveryPhraseRaw(requestParameters: ObtainTokenByRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<TokenResponse>>;
|
|
129
|
+
/**
|
|
130
|
+
* Obtain a new access and refresh token set by a RecoveryPhrase. The new set also contains a refresh_token etc, so it can then be used just like the tokens obtained from the `ObtainToken` endpoint. This also creates a new `trading_session`, as RecoveryPhrases never allow access to an existing trading_session.
|
|
131
|
+
*/
|
|
132
|
+
obtainTokenByRecoveryPhrase(requestParameters: ObtainTokenByRecoveryPhraseRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<TokenResponse>;
|
|
45
133
|
/**
|
|
46
134
|
*/
|
|
47
135
|
revokeAccessTokenRaw(requestParameters: RevokeAccessTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>;
|
|
@@ -11,11 +11,42 @@
|
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
13
|
import * as runtime from "../runtime";
|
|
14
|
-
import { AccessTokenResultFromJSON, CreateAccessTokenParamsToJSON, GetAccessTokensResponseFromJSON, GetAcessTokenAvailablePermissions200ResponseFromJSON, } from "../models";
|
|
14
|
+
import { AccessTokenResultFromJSON, CheckRecoveryPhrase200ResponseFromJSON, CreateAccessTokenParamsToJSON, CreateGuestUserResponseFromJSON, CreateRecoveryPhraseParamsToJSON, CreateRecoveryPhraseResultFromJSON, GetAccessTokensResponseFromJSON, GetAcessTokenAvailablePermissions200ResponseFromJSON, GetRecoveryPhrasesResponseFromJSON, GetUserResponseFromJSON, ObtainTokenByRecoveryPhraseParamsToJSON, TokenResponseFromJSON, } from "../models";
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export class UserApi extends runtime.BaseAPI {
|
|
19
|
+
/**
|
|
20
|
+
* Check if the RecoveryPhrase is still valid without obtaining a new token set. This can be used in frontends when users are asked if they still have their RecoveryPhrase.
|
|
21
|
+
*/
|
|
22
|
+
async checkRecoveryPhraseRaw(requestParameters, initOverrides) {
|
|
23
|
+
if (requestParameters.obtainTokenByRecoveryPhraseParams === null ||
|
|
24
|
+
requestParameters.obtainTokenByRecoveryPhraseParams === undefined) {
|
|
25
|
+
throw new runtime.RequiredError("obtainTokenByRecoveryPhraseParams", "Required parameter requestParameters.obtainTokenByRecoveryPhraseParams was null or undefined when calling checkRecoveryPhrase.");
|
|
26
|
+
}
|
|
27
|
+
const queryParameters = {};
|
|
28
|
+
const headerParameters = {};
|
|
29
|
+
headerParameters["Content-Type"] = "application/json";
|
|
30
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
31
|
+
headerParameters["x-brkrz-client-id"] =
|
|
32
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
33
|
+
}
|
|
34
|
+
const response = await this.request({
|
|
35
|
+
path: `/user/recoveryPhrases/check`,
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: headerParameters,
|
|
38
|
+
query: queryParameters,
|
|
39
|
+
body: ObtainTokenByRecoveryPhraseParamsToJSON(requestParameters.obtainTokenByRecoveryPhraseParams),
|
|
40
|
+
}, initOverrides);
|
|
41
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CheckRecoveryPhrase200ResponseFromJSON(jsonValue));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if the RecoveryPhrase is still valid without obtaining a new token set. This can be used in frontends when users are asked if they still have their RecoveryPhrase.
|
|
45
|
+
*/
|
|
46
|
+
async checkRecoveryPhrase(requestParameters, initOverrides) {
|
|
47
|
+
const response = await this.checkRecoveryPhraseRaw(requestParameters, initOverrides);
|
|
48
|
+
return await response.value();
|
|
49
|
+
}
|
|
19
50
|
/**
|
|
20
51
|
* Create a token for the current user. The token can be used to access resources on behalf of the user.
|
|
21
52
|
*/
|
|
@@ -54,6 +85,135 @@ export class UserApi extends runtime.BaseAPI {
|
|
|
54
85
|
const response = await this.createAccessTokenRaw(requestParameters, initOverrides);
|
|
55
86
|
return await response.value();
|
|
56
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a guest user and return a token which can be used to access resources. The lifetime of the generated temporary user as well as the returned `access_token` depend on the client configuration. It is usually around 24 hours. For some clients, tokens can be expired earlier based on inactivity. If the client has configured a longer lifetime for their guest users, a `refresh_token` is included in the response. This token can be used to renew the `access_token` after it has expired. The `refresh_token` can be used to obtain a new `access_token` after the original token has expired using the `/user/token` endpoint.
|
|
90
|
+
*/
|
|
91
|
+
async createGuestUserRaw(initOverrides) {
|
|
92
|
+
const queryParameters = {};
|
|
93
|
+
const headerParameters = {};
|
|
94
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
95
|
+
headerParameters["x-brkrz-client-id"] =
|
|
96
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
97
|
+
}
|
|
98
|
+
const response = await this.request({
|
|
99
|
+
path: `/user/guest`,
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: headerParameters,
|
|
102
|
+
query: queryParameters,
|
|
103
|
+
}, initOverrides);
|
|
104
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CreateGuestUserResponseFromJSON(jsonValue));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a guest user and return a token which can be used to access resources. The lifetime of the generated temporary user as well as the returned `access_token` depend on the client configuration. It is usually around 24 hours. For some clients, tokens can be expired earlier based on inactivity. If the client has configured a longer lifetime for their guest users, a `refresh_token` is included in the response. This token can be used to renew the `access_token` after it has expired. The `refresh_token` can be used to obtain a new `access_token` after the original token has expired using the `/user/token` endpoint.
|
|
108
|
+
*/
|
|
109
|
+
async createGuestUser(initOverrides) {
|
|
110
|
+
const response = await this.createGuestUserRaw(initOverrides);
|
|
111
|
+
return await response.value();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Create a RecoveryPhrase for the current guest user. The brokerize backend uses RecoveryPhrases instead of email + password registration or similar approaches, which can never be guaranteed to be anonymous. Users can simply generate a RecoveryPhrase and save it in a password manager, memorize it or write it down in a safe location. The BIP39 word list known from Bitcoins is used to encode a cryptographically safe random token and allows access to the account later (see endpoint `ObtainTokenFromRecoveryPhrase`).
|
|
115
|
+
*/
|
|
116
|
+
async createRecoveryPhraseRaw(requestParameters, initOverrides) {
|
|
117
|
+
if (requestParameters.createRecoveryPhraseParams === null ||
|
|
118
|
+
requestParameters.createRecoveryPhraseParams === undefined) {
|
|
119
|
+
throw new runtime.RequiredError("createRecoveryPhraseParams", "Required parameter requestParameters.createRecoveryPhraseParams was null or undefined when calling createRecoveryPhrase.");
|
|
120
|
+
}
|
|
121
|
+
const queryParameters = {};
|
|
122
|
+
const headerParameters = {};
|
|
123
|
+
headerParameters["Content-Type"] = "application/json";
|
|
124
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
125
|
+
headerParameters["x-brkrz-client-id"] =
|
|
126
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
127
|
+
}
|
|
128
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
129
|
+
const token = this.configuration.accessToken;
|
|
130
|
+
const tokenString = await token("idToken", []);
|
|
131
|
+
if (tokenString) {
|
|
132
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const response = await this.request({
|
|
136
|
+
path: `/user/recoveryPhrases`,
|
|
137
|
+
method: "POST",
|
|
138
|
+
headers: headerParameters,
|
|
139
|
+
query: queryParameters,
|
|
140
|
+
body: CreateRecoveryPhraseParamsToJSON(requestParameters.createRecoveryPhraseParams),
|
|
141
|
+
}, initOverrides);
|
|
142
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CreateRecoveryPhraseResultFromJSON(jsonValue));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create a RecoveryPhrase for the current guest user. The brokerize backend uses RecoveryPhrases instead of email + password registration or similar approaches, which can never be guaranteed to be anonymous. Users can simply generate a RecoveryPhrase and save it in a password manager, memorize it or write it down in a safe location. The BIP39 word list known from Bitcoins is used to encode a cryptographically safe random token and allows access to the account later (see endpoint `ObtainTokenFromRecoveryPhrase`).
|
|
146
|
+
*/
|
|
147
|
+
async createRecoveryPhrase(requestParameters, initOverrides) {
|
|
148
|
+
const response = await this.createRecoveryPhraseRaw(requestParameters, initOverrides);
|
|
149
|
+
return await response.value();
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Delete the current user (only allowed if it is a guest account). Also logs out all active broker sessions attached to the user.
|
|
153
|
+
*/
|
|
154
|
+
async deleteGuestUserRaw(initOverrides) {
|
|
155
|
+
const queryParameters = {};
|
|
156
|
+
const headerParameters = {};
|
|
157
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
158
|
+
headerParameters["x-brkrz-client-id"] =
|
|
159
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
160
|
+
}
|
|
161
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
162
|
+
const token = this.configuration.accessToken;
|
|
163
|
+
const tokenString = await token("idToken", []);
|
|
164
|
+
if (tokenString) {
|
|
165
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const response = await this.request({
|
|
169
|
+
path: `/user`,
|
|
170
|
+
method: "DELETE",
|
|
171
|
+
headers: headerParameters,
|
|
172
|
+
query: queryParameters,
|
|
173
|
+
}, initOverrides);
|
|
174
|
+
return new runtime.VoidApiResponse(response);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Delete the current user (only allowed if it is a guest account). Also logs out all active broker sessions attached to the user.
|
|
178
|
+
*/
|
|
179
|
+
async deleteGuestUser(initOverrides) {
|
|
180
|
+
await this.deleteGuestUserRaw(initOverrides);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Delete the RecoveryPhrase from the account.
|
|
184
|
+
*/
|
|
185
|
+
async deleteRecoveryPhraseRaw(requestParameters, initOverrides) {
|
|
186
|
+
if (requestParameters.recoveryPhraseId === null ||
|
|
187
|
+
requestParameters.recoveryPhraseId === undefined) {
|
|
188
|
+
throw new runtime.RequiredError("recoveryPhraseId", "Required parameter requestParameters.recoveryPhraseId was null or undefined when calling deleteRecoveryPhrase.");
|
|
189
|
+
}
|
|
190
|
+
const queryParameters = {};
|
|
191
|
+
const headerParameters = {};
|
|
192
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
193
|
+
headerParameters["x-brkrz-client-id"] =
|
|
194
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
195
|
+
}
|
|
196
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
197
|
+
const token = this.configuration.accessToken;
|
|
198
|
+
const tokenString = await token("idToken", []);
|
|
199
|
+
if (tokenString) {
|
|
200
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const response = await this.request({
|
|
204
|
+
path: `/user/recoveryPhrases/{recoveryPhraseId}`.replace(`{${"recoveryPhraseId"}}`, encodeURIComponent(String(requestParameters.recoveryPhraseId))),
|
|
205
|
+
method: "DELETE",
|
|
206
|
+
headers: headerParameters,
|
|
207
|
+
query: queryParameters,
|
|
208
|
+
}, initOverrides);
|
|
209
|
+
return new runtime.VoidApiResponse(response);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Delete the RecoveryPhrase from the account.
|
|
213
|
+
*/
|
|
214
|
+
async deleteRecoveryPhrase(requestParameters, initOverrides) {
|
|
215
|
+
await this.deleteRecoveryPhraseRaw(requestParameters, initOverrides);
|
|
216
|
+
}
|
|
57
217
|
/**
|
|
58
218
|
*/
|
|
59
219
|
async getAccessTokensRaw(initOverrides) {
|
|
@@ -116,6 +276,154 @@ export class UserApi extends runtime.BaseAPI {
|
|
|
116
276
|
const response = await this.getAcessTokenAvailablePermissionsRaw(initOverrides);
|
|
117
277
|
return await response.value();
|
|
118
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Lists all the recoveryPhrases metadata the user has in their account.
|
|
281
|
+
*/
|
|
282
|
+
async getRecoveryPhrasesRaw(initOverrides) {
|
|
283
|
+
const queryParameters = {};
|
|
284
|
+
const headerParameters = {};
|
|
285
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
286
|
+
headerParameters["x-brkrz-client-id"] =
|
|
287
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
288
|
+
}
|
|
289
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
290
|
+
const token = this.configuration.accessToken;
|
|
291
|
+
const tokenString = await token("idToken", []);
|
|
292
|
+
if (tokenString) {
|
|
293
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const response = await this.request({
|
|
297
|
+
path: `/user/recoveryPhrases`,
|
|
298
|
+
method: "GET",
|
|
299
|
+
headers: headerParameters,
|
|
300
|
+
query: queryParameters,
|
|
301
|
+
}, initOverrides);
|
|
302
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => GetRecoveryPhrasesResponseFromJSON(jsonValue));
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Lists all the recoveryPhrases metadata the user has in their account.
|
|
306
|
+
*/
|
|
307
|
+
async getRecoveryPhrases(initOverrides) {
|
|
308
|
+
const response = await this.getRecoveryPhrasesRaw(initOverrides);
|
|
309
|
+
return await response.value();
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Checks the provided authentication and returns the logged-in user.
|
|
313
|
+
*/
|
|
314
|
+
async getUserRaw(initOverrides) {
|
|
315
|
+
const queryParameters = {};
|
|
316
|
+
const headerParameters = {};
|
|
317
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
318
|
+
headerParameters["x-brkrz-client-id"] =
|
|
319
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
320
|
+
}
|
|
321
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
322
|
+
const token = this.configuration.accessToken;
|
|
323
|
+
const tokenString = await token("idToken", []);
|
|
324
|
+
if (tokenString) {
|
|
325
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const response = await this.request({
|
|
329
|
+
path: `/user`,
|
|
330
|
+
method: "GET",
|
|
331
|
+
headers: headerParameters,
|
|
332
|
+
query: queryParameters,
|
|
333
|
+
}, initOverrides);
|
|
334
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => GetUserResponseFromJSON(jsonValue));
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Checks the provided authentication and returns the logged-in user.
|
|
338
|
+
*/
|
|
339
|
+
async getUser(initOverrides) {
|
|
340
|
+
const response = await this.getUserRaw(initOverrides);
|
|
341
|
+
return await response.value();
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
|
|
345
|
+
*/
|
|
346
|
+
async obtainTokenRaw(requestParameters, initOverrides) {
|
|
347
|
+
if (requestParameters.grantType === null ||
|
|
348
|
+
requestParameters.grantType === undefined) {
|
|
349
|
+
throw new runtime.RequiredError("grantType", "Required parameter requestParameters.grantType was null or undefined when calling obtainToken.");
|
|
350
|
+
}
|
|
351
|
+
if (requestParameters.refreshToken === null ||
|
|
352
|
+
requestParameters.refreshToken === undefined) {
|
|
353
|
+
throw new runtime.RequiredError("refreshToken", "Required parameter requestParameters.refreshToken was null or undefined when calling obtainToken.");
|
|
354
|
+
}
|
|
355
|
+
const queryParameters = {};
|
|
356
|
+
const headerParameters = {};
|
|
357
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
358
|
+
headerParameters["x-brkrz-client-id"] =
|
|
359
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
360
|
+
}
|
|
361
|
+
const consumes = [
|
|
362
|
+
{ contentType: "application/x-www-form-urlencoded" },
|
|
363
|
+
];
|
|
364
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
365
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
366
|
+
let formParams;
|
|
367
|
+
let useForm = false;
|
|
368
|
+
if (useForm) {
|
|
369
|
+
formParams = new FormData();
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
throw new Error("URLSearchParams support has been dopped due to compatibility problems in mobile apps.");
|
|
373
|
+
}
|
|
374
|
+
if (requestParameters.grantType !== undefined) {
|
|
375
|
+
formParams.append("grant_type", requestParameters.grantType);
|
|
376
|
+
}
|
|
377
|
+
if (requestParameters.refreshToken !== undefined) {
|
|
378
|
+
formParams.append("refresh_token", requestParameters.refreshToken);
|
|
379
|
+
}
|
|
380
|
+
const response = await this.request({
|
|
381
|
+
path: `/user/token`,
|
|
382
|
+
method: "POST",
|
|
383
|
+
headers: headerParameters,
|
|
384
|
+
query: queryParameters,
|
|
385
|
+
body: formParams,
|
|
386
|
+
}, initOverrides);
|
|
387
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TokenResponseFromJSON(jsonValue));
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
|
|
391
|
+
*/
|
|
392
|
+
async obtainToken(requestParameters, initOverrides) {
|
|
393
|
+
const response = await this.obtainTokenRaw(requestParameters, initOverrides);
|
|
394
|
+
return await response.value();
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Obtain a new access and refresh token set by a RecoveryPhrase. The new set also contains a refresh_token etc, so it can then be used just like the tokens obtained from the `ObtainToken` endpoint. This also creates a new `trading_session`, as RecoveryPhrases never allow access to an existing trading_session.
|
|
398
|
+
*/
|
|
399
|
+
async obtainTokenByRecoveryPhraseRaw(requestParameters, initOverrides) {
|
|
400
|
+
if (requestParameters.obtainTokenByRecoveryPhraseParams === null ||
|
|
401
|
+
requestParameters.obtainTokenByRecoveryPhraseParams === undefined) {
|
|
402
|
+
throw new runtime.RequiredError("obtainTokenByRecoveryPhraseParams", "Required parameter requestParameters.obtainTokenByRecoveryPhraseParams was null or undefined when calling obtainTokenByRecoveryPhrase.");
|
|
403
|
+
}
|
|
404
|
+
const queryParameters = {};
|
|
405
|
+
const headerParameters = {};
|
|
406
|
+
headerParameters["Content-Type"] = "application/json";
|
|
407
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
408
|
+
headerParameters["x-brkrz-client-id"] =
|
|
409
|
+
this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
|
|
410
|
+
}
|
|
411
|
+
const response = await this.request({
|
|
412
|
+
path: `/user/recoveryPhrases/token`,
|
|
413
|
+
method: "POST",
|
|
414
|
+
headers: headerParameters,
|
|
415
|
+
query: queryParameters,
|
|
416
|
+
body: ObtainTokenByRecoveryPhraseParamsToJSON(requestParameters.obtainTokenByRecoveryPhraseParams),
|
|
417
|
+
}, initOverrides);
|
|
418
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => TokenResponseFromJSON(jsonValue));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Obtain a new access and refresh token set by a RecoveryPhrase. The new set also contains a refresh_token etc, so it can then be used just like the tokens obtained from the `ObtainToken` endpoint. This also creates a new `trading_session`, as RecoveryPhrases never allow access to an existing trading_session.
|
|
422
|
+
*/
|
|
423
|
+
async obtainTokenByRecoveryPhrase(requestParameters, initOverrides) {
|
|
424
|
+
const response = await this.obtainTokenByRecoveryPhraseRaw(requestParameters, initOverrides);
|
|
425
|
+
return await response.value();
|
|
426
|
+
}
|
|
119
427
|
/**
|
|
120
428
|
*/
|
|
121
429
|
async revokeAccessTokenRaw(requestParameters, initOverrides) {
|
|
@@ -0,0 +1,24 @@
|
|
|
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 * as runtime from "../runtime";
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare class WebsocketApi extends runtime.BaseAPI {
|
|
16
|
+
/**
|
|
17
|
+
* Most operations at brokerize have asynchronous effects. For example, consider the flow of an order: when the user creates an order, it will not immediately appear in order list endpoints, because usually brokers take a few seconds until they are retrievable in those lists. Also, after a while, the order may be executed or cancelled asynchronously by the stock exchange. A common solution for frontends would be to reload the order list regularly. However data is then either delayed or there will be many more requests than needed. The brokerize websocket endpoint allows getting updates via web sockets. Generally speaking, clients can subscribe by assigning a subscription id and will then receive updates on that subscription. In this documentation, ⬆️ denotes messages from the client to the server, whereas messages from server to client are marked with ⬇️. ## authentication When using cookies for authorization, the WebSocket connection is authenticated with the HTTP upgrade request. If token headers are used, the _first_ message from client to server must be: ``` ⬆️ { \"cmd\": \"authorize\", \"idToken\": <string> } ``` In all cases, clients must wait for the welcome message before sending other messages: ``` ⬇️ { \"cmd\": \"authenticated\" } ``` ## ping After 1 minute of inactivity of a client, the WebSocket connection will be considered stale and will automatically terminated. To prevent this, a ping message can be sent: ``` ⬆️ {\"cmd\": \"ping\"} ``` The server also sends this message regularly. If no message has been received on a WebSocket connection for more than 1 minute, it should be terminated by the client. ``` ⬇️ {\"cmd\": \"ping\"} ``` ## subscriptions Subscriptions can be used to get invalidate events or updates for selected resources. ### invalidate subscriptions Invalidation events can be used for the frontend to know when reload requests via the HTTP endpoints are appropriate. Currently only invalidate events can be subscribed, the actual data must then be reloaded using the HTTP endpoints. To set up a subscription for an invalidate event, use: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"invalidate\", \"subscriptionId\": 1, \"entity: \"brokersessions\" /_* \"positions\" | \"orders\" *_/, \"portfolioId\": 42 /_* required for \"positions\" or \"orders\" *_/ } ``` If the subscription failed to be set up on the server, an error will be sent for the subscription. This also automatically ends the subscription on the server side: ``` ⬇️ { \"subscriptionId\": 1, \"error\": { \"message\": \"Could not set up invalidation event due to...\" } } ``` If an invalid `subscriptionId` is provided (or the subscription id is already in use by the connection), an error like this will be sent: ``` ⬇️ { \"error\": { \"message\": \"Could not add subscription due to invalid subscriptionId\" } } ``` ⚠️ _the connection will then be terminated immediately_. If the subscription is sucessfuly set up, whenever an invalidation happens, the server will send a message like this: ``` ⬇️ { \"cmd\": \"invalidate\", \"subscriptionId\": 1 } ``` When that invalidation event is received, the client should reload the data using the corresponding endpoints. Clients can end their subscription with the `unsubscribe` command: ``` ⬆️ { \"cmd\": \"unsubscribe\", \"subscriptionId\": 1 } ``` ### subscribe to the state of a decoupled operation For decoupled operations (e.g. authorizing a session TAN using a second factor device), the state of the operation can be subscribed: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"decoupledOperationStatus\", \"subscriptionId\": 1, \"sessionId\": string, \"decoupledOperationId\": string } ``` Error handling as well as unsubscribing works as described for invalidate subscriptions. Example message from the server for updating the state: ``` ⬇️ { \"cmd\": \"updateDecoupledOperationStatus\", \"subscriptionId\": number, \"state\": <DecoupledOperationStatus> } ```
|
|
18
|
+
*/
|
|
19
|
+
websocketRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>;
|
|
20
|
+
/**
|
|
21
|
+
* Most operations at brokerize have asynchronous effects. For example, consider the flow of an order: when the user creates an order, it will not immediately appear in order list endpoints, because usually brokers take a few seconds until they are retrievable in those lists. Also, after a while, the order may be executed or cancelled asynchronously by the stock exchange. A common solution for frontends would be to reload the order list regularly. However data is then either delayed or there will be many more requests than needed. The brokerize websocket endpoint allows getting updates via web sockets. Generally speaking, clients can subscribe by assigning a subscription id and will then receive updates on that subscription. In this documentation, ⬆️ denotes messages from the client to the server, whereas messages from server to client are marked with ⬇️. ## authentication When using cookies for authorization, the WebSocket connection is authenticated with the HTTP upgrade request. If token headers are used, the _first_ message from client to server must be: ``` ⬆️ { \"cmd\": \"authorize\", \"idToken\": <string> } ``` In all cases, clients must wait for the welcome message before sending other messages: ``` ⬇️ { \"cmd\": \"authenticated\" } ``` ## ping After 1 minute of inactivity of a client, the WebSocket connection will be considered stale and will automatically terminated. To prevent this, a ping message can be sent: ``` ⬆️ {\"cmd\": \"ping\"} ``` The server also sends this message regularly. If no message has been received on a WebSocket connection for more than 1 minute, it should be terminated by the client. ``` ⬇️ {\"cmd\": \"ping\"} ``` ## subscriptions Subscriptions can be used to get invalidate events or updates for selected resources. ### invalidate subscriptions Invalidation events can be used for the frontend to know when reload requests via the HTTP endpoints are appropriate. Currently only invalidate events can be subscribed, the actual data must then be reloaded using the HTTP endpoints. To set up a subscription for an invalidate event, use: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"invalidate\", \"subscriptionId\": 1, \"entity: \"brokersessions\" /_* \"positions\" | \"orders\" *_/, \"portfolioId\": 42 /_* required for \"positions\" or \"orders\" *_/ } ``` If the subscription failed to be set up on the server, an error will be sent for the subscription. This also automatically ends the subscription on the server side: ``` ⬇️ { \"subscriptionId\": 1, \"error\": { \"message\": \"Could not set up invalidation event due to...\" } } ``` If an invalid `subscriptionId` is provided (or the subscription id is already in use by the connection), an error like this will be sent: ``` ⬇️ { \"error\": { \"message\": \"Could not add subscription due to invalid subscriptionId\" } } ``` ⚠️ _the connection will then be terminated immediately_. If the subscription is sucessfuly set up, whenever an invalidation happens, the server will send a message like this: ``` ⬇️ { \"cmd\": \"invalidate\", \"subscriptionId\": 1 } ``` When that invalidation event is received, the client should reload the data using the corresponding endpoints. Clients can end their subscription with the `unsubscribe` command: ``` ⬆️ { \"cmd\": \"unsubscribe\", \"subscriptionId\": 1 } ``` ### subscribe to the state of a decoupled operation For decoupled operations (e.g. authorizing a session TAN using a second factor device), the state of the operation can be subscribed: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"decoupledOperationStatus\", \"subscriptionId\": 1, \"sessionId\": string, \"decoupledOperationId\": string } ``` Error handling as well as unsubscribing works as described for invalidate subscriptions. Example message from the server for updating the state: ``` ⬇️ { \"cmd\": \"updateDecoupledOperationStatus\", \"subscriptionId\": number, \"state\": <DecoupledOperationStatus> } ```
|
|
22
|
+
*/
|
|
23
|
+
websocket(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 * as runtime from "../runtime";
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export class WebsocketApi extends runtime.BaseAPI {
|
|
18
|
+
/**
|
|
19
|
+
* Most operations at brokerize have asynchronous effects. For example, consider the flow of an order: when the user creates an order, it will not immediately appear in order list endpoints, because usually brokers take a few seconds until they are retrievable in those lists. Also, after a while, the order may be executed or cancelled asynchronously by the stock exchange. A common solution for frontends would be to reload the order list regularly. However data is then either delayed or there will be many more requests than needed. The brokerize websocket endpoint allows getting updates via web sockets. Generally speaking, clients can subscribe by assigning a subscription id and will then receive updates on that subscription. In this documentation, ⬆️ denotes messages from the client to the server, whereas messages from server to client are marked with ⬇️. ## authentication When using cookies for authorization, the WebSocket connection is authenticated with the HTTP upgrade request. If token headers are used, the _first_ message from client to server must be: ``` ⬆️ { \"cmd\": \"authorize\", \"idToken\": <string> } ``` In all cases, clients must wait for the welcome message before sending other messages: ``` ⬇️ { \"cmd\": \"authenticated\" } ``` ## ping After 1 minute of inactivity of a client, the WebSocket connection will be considered stale and will automatically terminated. To prevent this, a ping message can be sent: ``` ⬆️ {\"cmd\": \"ping\"} ``` The server also sends this message regularly. If no message has been received on a WebSocket connection for more than 1 minute, it should be terminated by the client. ``` ⬇️ {\"cmd\": \"ping\"} ``` ## subscriptions Subscriptions can be used to get invalidate events or updates for selected resources. ### invalidate subscriptions Invalidation events can be used for the frontend to know when reload requests via the HTTP endpoints are appropriate. Currently only invalidate events can be subscribed, the actual data must then be reloaded using the HTTP endpoints. To set up a subscription for an invalidate event, use: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"invalidate\", \"subscriptionId\": 1, \"entity: \"brokersessions\" /_* \"positions\" | \"orders\" *_/, \"portfolioId\": 42 /_* required for \"positions\" or \"orders\" *_/ } ``` If the subscription failed to be set up on the server, an error will be sent for the subscription. This also automatically ends the subscription on the server side: ``` ⬇️ { \"subscriptionId\": 1, \"error\": { \"message\": \"Could not set up invalidation event due to...\" } } ``` If an invalid `subscriptionId` is provided (or the subscription id is already in use by the connection), an error like this will be sent: ``` ⬇️ { \"error\": { \"message\": \"Could not add subscription due to invalid subscriptionId\" } } ``` ⚠️ _the connection will then be terminated immediately_. If the subscription is sucessfuly set up, whenever an invalidation happens, the server will send a message like this: ``` ⬇️ { \"cmd\": \"invalidate\", \"subscriptionId\": 1 } ``` When that invalidation event is received, the client should reload the data using the corresponding endpoints. Clients can end their subscription with the `unsubscribe` command: ``` ⬆️ { \"cmd\": \"unsubscribe\", \"subscriptionId\": 1 } ``` ### subscribe to the state of a decoupled operation For decoupled operations (e.g. authorizing a session TAN using a second factor device), the state of the operation can be subscribed: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"decoupledOperationStatus\", \"subscriptionId\": 1, \"sessionId\": string, \"decoupledOperationId\": string } ``` Error handling as well as unsubscribing works as described for invalidate subscriptions. Example message from the server for updating the state: ``` ⬇️ { \"cmd\": \"updateDecoupledOperationStatus\", \"subscriptionId\": number, \"state\": <DecoupledOperationStatus> } ```
|
|
20
|
+
*/
|
|
21
|
+
async websocketRaw(initOverrides) {
|
|
22
|
+
const queryParameters = {};
|
|
23
|
+
const headerParameters = {};
|
|
24
|
+
const response = await this.request({
|
|
25
|
+
path: `/websocket`,
|
|
26
|
+
method: "GET",
|
|
27
|
+
headers: headerParameters,
|
|
28
|
+
query: queryParameters,
|
|
29
|
+
}, initOverrides);
|
|
30
|
+
return new runtime.VoidApiResponse(response);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Most operations at brokerize have asynchronous effects. For example, consider the flow of an order: when the user creates an order, it will not immediately appear in order list endpoints, because usually brokers take a few seconds until they are retrievable in those lists. Also, after a while, the order may be executed or cancelled asynchronously by the stock exchange. A common solution for frontends would be to reload the order list regularly. However data is then either delayed or there will be many more requests than needed. The brokerize websocket endpoint allows getting updates via web sockets. Generally speaking, clients can subscribe by assigning a subscription id and will then receive updates on that subscription. In this documentation, ⬆️ denotes messages from the client to the server, whereas messages from server to client are marked with ⬇️. ## authentication When using cookies for authorization, the WebSocket connection is authenticated with the HTTP upgrade request. If token headers are used, the _first_ message from client to server must be: ``` ⬆️ { \"cmd\": \"authorize\", \"idToken\": <string> } ``` In all cases, clients must wait for the welcome message before sending other messages: ``` ⬇️ { \"cmd\": \"authenticated\" } ``` ## ping After 1 minute of inactivity of a client, the WebSocket connection will be considered stale and will automatically terminated. To prevent this, a ping message can be sent: ``` ⬆️ {\"cmd\": \"ping\"} ``` The server also sends this message regularly. If no message has been received on a WebSocket connection for more than 1 minute, it should be terminated by the client. ``` ⬇️ {\"cmd\": \"ping\"} ``` ## subscriptions Subscriptions can be used to get invalidate events or updates for selected resources. ### invalidate subscriptions Invalidation events can be used for the frontend to know when reload requests via the HTTP endpoints are appropriate. Currently only invalidate events can be subscribed, the actual data must then be reloaded using the HTTP endpoints. To set up a subscription for an invalidate event, use: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"invalidate\", \"subscriptionId\": 1, \"entity: \"brokersessions\" /_* \"positions\" | \"orders\" *_/, \"portfolioId\": 42 /_* required for \"positions\" or \"orders\" *_/ } ``` If the subscription failed to be set up on the server, an error will be sent for the subscription. This also automatically ends the subscription on the server side: ``` ⬇️ { \"subscriptionId\": 1, \"error\": { \"message\": \"Could not set up invalidation event due to...\" } } ``` If an invalid `subscriptionId` is provided (or the subscription id is already in use by the connection), an error like this will be sent: ``` ⬇️ { \"error\": { \"message\": \"Could not add subscription due to invalid subscriptionId\" } } ``` ⚠️ _the connection will then be terminated immediately_. If the subscription is sucessfuly set up, whenever an invalidation happens, the server will send a message like this: ``` ⬇️ { \"cmd\": \"invalidate\", \"subscriptionId\": 1 } ``` When that invalidation event is received, the client should reload the data using the corresponding endpoints. Clients can end their subscription with the `unsubscribe` command: ``` ⬆️ { \"cmd\": \"unsubscribe\", \"subscriptionId\": 1 } ``` ### subscribe to the state of a decoupled operation For decoupled operations (e.g. authorizing a session TAN using a second factor device), the state of the operation can be subscribed: ``` ⬆️ { \"cmd\": \"subscribe\", \"type\": \"decoupledOperationStatus\", \"subscriptionId\": 1, \"sessionId\": string, \"decoupledOperationId\": string } ``` Error handling as well as unsubscribing works as described for invalidate subscriptions. Example message from the server for updating the state: ``` ⬇️ { \"cmd\": \"updateDecoupledOperationStatus\", \"subscriptionId\": number, \"state\": <DecoupledOperationStatus> } ```
|
|
34
|
+
*/
|
|
35
|
+
async websocket(initOverrides) {
|
|
36
|
+
await this.websocketRaw(initOverrides);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from "./AdminApi";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./CancelOrderApi";
|
|
4
|
-
export * from "./ChangeOrderApi";
|
|
5
|
-
export * from "./DefaultApi";
|
|
2
|
+
export * from "./DecoupledOperationsApi";
|
|
6
3
|
export * from "./DemobrokerApi";
|
|
7
4
|
export * from "./ExportApi";
|
|
8
5
|
export * from "./MetaApi";
|
|
6
|
+
export * from "./OrderApi";
|
|
7
|
+
export * from "./PortfolioApi";
|
|
9
8
|
export * from "./SecuritiesApi";
|
|
9
|
+
export * from "./SessionApi";
|
|
10
10
|
export * from "./TradeApi";
|
|
11
11
|
export * from "./TradeDraftApi";
|
|
12
12
|
export * from "./UserApi";
|
|
13
|
+
export * from "./WebsocketApi";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export * from "./AdminApi";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./CancelOrderApi";
|
|
6
|
-
export * from "./ChangeOrderApi";
|
|
7
|
-
export * from "./DefaultApi";
|
|
4
|
+
export * from "./DecoupledOperationsApi";
|
|
8
5
|
export * from "./DemobrokerApi";
|
|
9
6
|
export * from "./ExportApi";
|
|
10
7
|
export * from "./MetaApi";
|
|
8
|
+
export * from "./OrderApi";
|
|
9
|
+
export * from "./PortfolioApi";
|
|
11
10
|
export * from "./SecuritiesApi";
|
|
11
|
+
export * from "./SessionApi";
|
|
12
12
|
export * from "./TradeApi";
|
|
13
13
|
export * from "./TradeDraftApi";
|
|
14
14
|
export * from "./UserApi";
|
|
15
|
+
export * from "./WebsocketApi";
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @interface CheckRecoveryPhrase200Response
|
|
15
|
+
*/
|
|
16
|
+
export interface CheckRecoveryPhrase200Response {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @type {Date}
|
|
20
|
+
* @memberof CheckRecoveryPhrase200Response
|
|
21
|
+
*/
|
|
22
|
+
expiresAt: Date;
|
|
23
|
+
}
|
|
24
|
+
export declare function CheckRecoveryPhrase200ResponseFromJSON(json: any): CheckRecoveryPhrase200Response;
|
|
25
|
+
export declare function CheckRecoveryPhrase200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CheckRecoveryPhrase200Response;
|
|
26
|
+
export declare function CheckRecoveryPhrase200ResponseToJSONRecursive(value?: CheckRecoveryPhrase200Response | null, ignoreParent?: boolean): any;
|
|
27
|
+
export declare function CheckRecoveryPhrase200ResponseToJSON(value?: CheckRecoveryPhrase200Response | null): any;
|