@breign/client 1.0.199 → 1.0.200

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.
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { ApplicationAuthorizationRequestUio, ApplicationAuthorizationResponseUio, ApplicationTokenRequestUio, ApplicationTokenResponseUio, AuthCodeConfirmRequestUio, AuthCodeConfirmResponseUio, AuthCodeRequestUio, AuthCodeResponseUio, GetJwks200ResponseUio } from '../models/index';
13
+ import type { ApplicationAuthorizationRequestUio, ApplicationAuthorizationResponseUio, ApplicationTokenRequestUio, ApplicationTokenResponseUio, ApplicationTokenRevocationRequestUio, AuthCodeConfirmRequestUio, AuthCodeConfirmResponseUio, AuthCodeRequestUio, AuthCodeResponseUio, GetJwks200ResponseUio } from '../models/index';
14
14
  export interface AuthorizeApplicationRequest {
15
15
  responseType: AuthorizeApplicationResponseTypeEnum;
16
16
  clientId: string;
@@ -37,6 +37,9 @@ export interface OauthCallbackRequest {
37
37
  code?: string;
38
38
  state?: string;
39
39
  }
40
+ export interface RevokeApplicationTokenRequest {
41
+ applicationTokenRevocationRequestUio: ApplicationTokenRevocationRequestUio;
42
+ }
40
43
  export interface ToolOauthCallbackRequest {
41
44
  toolId: string;
42
45
  code?: string;
@@ -77,13 +80,13 @@ export declare class AuthApi extends runtime.BaseAPI {
77
80
  */
78
81
  createApplicationAuthorization(applicationAuthorizationRequestUio: ApplicationAuthorizationRequestUio, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationAuthorizationResponseUio>;
79
82
  /**
80
- * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. Errors follow RFC 6749 section 5.2.
81
- * Exchange an application authorization code
83
+ * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. With `token_format=jwt`, returns an access token and a refresh token instead of an API key; `grant_type=refresh_token` then renews them. Errors follow RFC 6749 section 5.2.
84
+ * Exchange an application authorization code, or refresh its tokens
82
85
  */
83
86
  exchangeApplicationAuthorizationCodeRaw(requestParameters: ExchangeApplicationAuthorizationCodeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationTokenResponseUio>>;
84
87
  /**
85
- * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. Errors follow RFC 6749 section 5.2.
86
- * Exchange an application authorization code
88
+ * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. With `token_format=jwt`, returns an access token and a refresh token instead of an API key; `grant_type=refresh_token` then renews them. Errors follow RFC 6749 section 5.2.
89
+ * Exchange an application authorization code, or refresh its tokens
87
90
  */
88
91
  exchangeApplicationAuthorizationCode(applicationTokenRequestUio: ApplicationTokenRequestUio, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationTokenResponseUio>;
89
92
  /**
@@ -116,6 +119,16 @@ export declare class AuthApi extends runtime.BaseAPI {
116
119
  * OAuth callback
117
120
  */
118
121
  oauthCallback(code?: string, state?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
122
+ /**
123
+ * Closes the session of a refresh token returned with `token_format=jwt` (RFC 7009), on logout from the application. Answers 200 whether the token existed or not. Access tokens already issued stay valid until they expire (1 h at most).
124
+ * Revoke an application refresh token
125
+ */
126
+ revokeApplicationTokenRaw(requestParameters: RevokeApplicationTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
127
+ /**
128
+ * Closes the session of a refresh token returned with `token_format=jwt` (RFC 7009), on logout from the application. Answers 200 whether the token existed or not. Access tokens already issued stay valid until they expire (1 h at most).
129
+ * Revoke an application refresh token
130
+ */
131
+ revokeApplicationToken(applicationTokenRevocationRequestUio: ApplicationTokenRevocationRequestUio, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
119
132
  /**
120
133
  * Handles OAuth provider callback for a specific tool
121
134
  * Tool OAuth callback
@@ -177,8 +177,8 @@ class AuthApi extends runtime.BaseAPI {
177
177
  return await response.value();
178
178
  }
179
179
  /**
180
- * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. Errors follow RFC 6749 section 5.2.
181
- * Exchange an application authorization code
180
+ * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. With `token_format=jwt`, returns an access token and a refresh token instead of an API key; `grant_type=refresh_token` then renews them. Errors follow RFC 6749 section 5.2.
181
+ * Exchange an application authorization code, or refresh its tokens
182
182
  */
183
183
  async exchangeApplicationAuthorizationCodeRaw(requestParameters, initOverrides) {
184
184
  if (requestParameters['applicationTokenRequestUio'] == null) {
@@ -197,8 +197,8 @@ class AuthApi extends runtime.BaseAPI {
197
197
  return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ApplicationTokenResponseUioFromJSON)(jsonValue));
198
198
  }
199
199
  /**
200
- * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. Errors follow RFC 6749 section 5.2.
201
- * Exchange an application authorization code
200
+ * Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. With `token_format=jwt`, returns an access token and a refresh token instead of an API key; `grant_type=refresh_token` then renews them. Errors follow RFC 6749 section 5.2.
201
+ * Exchange an application authorization code, or refresh its tokens
202
202
  */
203
203
  async exchangeApplicationAuthorizationCode(applicationTokenRequestUio, initOverrides) {
204
204
  const response = await this.exchangeApplicationAuthorizationCodeRaw({ applicationTokenRequestUio: applicationTokenRequestUio }, initOverrides);
@@ -286,6 +286,33 @@ class AuthApi extends runtime.BaseAPI {
286
286
  async oauthCallback(code, state, initOverrides) {
287
287
  await this.oauthCallbackRaw({ code: code, state: state }, initOverrides);
288
288
  }
289
+ /**
290
+ * Closes the session of a refresh token returned with `token_format=jwt` (RFC 7009), on logout from the application. Answers 200 whether the token existed or not. Access tokens already issued stay valid until they expire (1 h at most).
291
+ * Revoke an application refresh token
292
+ */
293
+ async revokeApplicationTokenRaw(requestParameters, initOverrides) {
294
+ if (requestParameters['applicationTokenRevocationRequestUio'] == null) {
295
+ throw new runtime.RequiredError('applicationTokenRevocationRequestUio', 'Required parameter "applicationTokenRevocationRequestUio" was null or undefined when calling revokeApplicationToken().');
296
+ }
297
+ const queryParameters = {};
298
+ const headerParameters = {};
299
+ headerParameters['Content-Type'] = 'application/json';
300
+ const response = await this.request({
301
+ path: `/auth/revoke`,
302
+ method: 'POST',
303
+ headers: headerParameters,
304
+ query: queryParameters,
305
+ body: (0, index_1.ApplicationTokenRevocationRequestUioToJSON)(requestParameters['applicationTokenRevocationRequestUio']),
306
+ }, initOverrides);
307
+ return new runtime.VoidApiResponse(response);
308
+ }
309
+ /**
310
+ * Closes the session of a refresh token returned with `token_format=jwt` (RFC 7009), on logout from the application. Answers 200 whether the token existed or not. Access tokens already issued stay valid until they expire (1 h at most).
311
+ * Revoke an application refresh token
312
+ */
313
+ async revokeApplicationToken(applicationTokenRevocationRequestUio, initOverrides) {
314
+ await this.revokeApplicationTokenRaw({ applicationTokenRevocationRequestUio: applicationTokenRevocationRequestUio }, initOverrides);
315
+ }
289
316
  /**
290
317
  * Handles OAuth provider callback for a specific tool
291
318
  * Tool OAuth callback
@@ -0,0 +1,26 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * `api_key` (default) creates an API key of the user. `jwt` returns a 1 h access token and a rotating 30-day refresh token instead, without creating an API key.
14
+ *
15
+ * @export
16
+ */
17
+ export declare const ApplicationTokenFormatUio: {
18
+ readonly ApiKey: "api_key";
19
+ readonly Jwt: "jwt";
20
+ };
21
+ export type ApplicationTokenFormatUio = typeof ApplicationTokenFormatUio[keyof typeof ApplicationTokenFormatUio];
22
+ export declare function instanceOfApplicationTokenFormatUio(value: any): boolean;
23
+ export declare function ApplicationTokenFormatUioFromJSON(json: any): ApplicationTokenFormatUio;
24
+ export declare function ApplicationTokenFormatUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApplicationTokenFormatUio;
25
+ export declare function ApplicationTokenFormatUioToJSON(value?: ApplicationTokenFormatUio | null): any;
26
+ export declare function ApplicationTokenFormatUioToJSONTyped(value: any, ignoreDiscriminator: boolean): ApplicationTokenFormatUio;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ApplicationTokenFormatUio = void 0;
17
+ exports.instanceOfApplicationTokenFormatUio = instanceOfApplicationTokenFormatUio;
18
+ exports.ApplicationTokenFormatUioFromJSON = ApplicationTokenFormatUioFromJSON;
19
+ exports.ApplicationTokenFormatUioFromJSONTyped = ApplicationTokenFormatUioFromJSONTyped;
20
+ exports.ApplicationTokenFormatUioToJSON = ApplicationTokenFormatUioToJSON;
21
+ exports.ApplicationTokenFormatUioToJSONTyped = ApplicationTokenFormatUioToJSONTyped;
22
+ /**
23
+ * `api_key` (default) creates an API key of the user. `jwt` returns a 1 h access token and a rotating 30-day refresh token instead, without creating an API key.
24
+ *
25
+ * @export
26
+ */
27
+ exports.ApplicationTokenFormatUio = {
28
+ ApiKey: 'api_key',
29
+ Jwt: 'jwt'
30
+ };
31
+ function instanceOfApplicationTokenFormatUio(value) {
32
+ for (const key in exports.ApplicationTokenFormatUio) {
33
+ if (Object.prototype.hasOwnProperty.call(exports.ApplicationTokenFormatUio, key)) {
34
+ if (exports.ApplicationTokenFormatUio[key] === value) {
35
+ return true;
36
+ }
37
+ }
38
+ }
39
+ return false;
40
+ }
41
+ function ApplicationTokenFormatUioFromJSON(json) {
42
+ return ApplicationTokenFormatUioFromJSONTyped(json, false);
43
+ }
44
+ function ApplicationTokenFormatUioFromJSONTyped(json, ignoreDiscriminator) {
45
+ return json;
46
+ }
47
+ function ApplicationTokenFormatUioToJSON(value) {
48
+ return value;
49
+ }
50
+ function ApplicationTokenFormatUioToJSONTyped(value, ignoreDiscriminator) {
51
+ return value;
52
+ }
@@ -9,7 +9,9 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { ApplicationTokenFormatUio } from './ApplicationTokenFormatUio';
12
13
  /**
14
+ * `authorization_code` exchanges the code (with `code`, `code_verifier` and `redirect_uri`); `refresh_token` renews the tokens of a session opened with `token_format=jwt`.
13
15
  *
14
16
  * @export
15
17
  * @interface ApplicationTokenRequestUio
@@ -26,31 +28,44 @@ export interface ApplicationTokenRequestUio {
26
28
  * @type {string}
27
29
  * @memberof ApplicationTokenRequestUio
28
30
  */
29
- code: string;
31
+ code?: string;
30
32
  /**
31
33
  *
32
34
  * @type {string}
33
35
  * @memberof ApplicationTokenRequestUio
34
36
  */
35
- codeVerifier: string;
37
+ codeVerifier?: string;
36
38
  /**
37
39
  *
38
40
  * @type {string}
39
41
  * @memberof ApplicationTokenRequestUio
40
42
  */
41
- redirectUri: string;
43
+ redirectUri?: string;
44
+ /**
45
+ * Required with `grant_type=refresh_token`.
46
+ * @type {string}
47
+ * @memberof ApplicationTokenRequestUio
48
+ */
49
+ refreshToken?: string;
42
50
  /**
43
51
  *
44
52
  * @type {string}
45
53
  * @memberof ApplicationTokenRequestUio
46
54
  */
47
55
  clientId: string;
56
+ /**
57
+ *
58
+ * @type {ApplicationTokenFormatUio}
59
+ * @memberof ApplicationTokenRequestUio
60
+ */
61
+ tokenFormat?: ApplicationTokenFormatUio;
48
62
  }
49
63
  /**
50
64
  * @export
51
65
  */
52
66
  export declare const ApplicationTokenRequestUioGrantTypeEnum: {
53
67
  readonly AuthorizationCode: "authorization_code";
68
+ readonly RefreshToken: "refresh_token";
54
69
  };
55
70
  export type ApplicationTokenRequestUioGrantTypeEnum = typeof ApplicationTokenRequestUioGrantTypeEnum[keyof typeof ApplicationTokenRequestUioGrantTypeEnum];
56
71
  /**
@@ -19,11 +19,13 @@ exports.ApplicationTokenRequestUioFromJSON = ApplicationTokenRequestUioFromJSON;
19
19
  exports.ApplicationTokenRequestUioFromJSONTyped = ApplicationTokenRequestUioFromJSONTyped;
20
20
  exports.ApplicationTokenRequestUioToJSON = ApplicationTokenRequestUioToJSON;
21
21
  exports.ApplicationTokenRequestUioToJSONTyped = ApplicationTokenRequestUioToJSONTyped;
22
+ const ApplicationTokenFormatUio_1 = require("./ApplicationTokenFormatUio");
22
23
  /**
23
24
  * @export
24
25
  */
25
26
  exports.ApplicationTokenRequestUioGrantTypeEnum = {
26
- AuthorizationCode: 'authorization_code'
27
+ AuthorizationCode: 'authorization_code',
28
+ RefreshToken: 'refresh_token'
27
29
  };
28
30
  /**
29
31
  * Check if a given object implements the ApplicationTokenRequestUio interface.
@@ -31,12 +33,6 @@ exports.ApplicationTokenRequestUioGrantTypeEnum = {
31
33
  function instanceOfApplicationTokenRequestUio(value) {
32
34
  if (!('grantType' in value) || value['grantType'] === undefined)
33
35
  return false;
34
- if (!('code' in value) || value['code'] === undefined)
35
- return false;
36
- if (!('codeVerifier' in value) || value['codeVerifier'] === undefined)
37
- return false;
38
- if (!('redirectUri' in value) || value['redirectUri'] === undefined)
39
- return false;
40
36
  if (!('clientId' in value) || value['clientId'] === undefined)
41
37
  return false;
42
38
  return true;
@@ -50,10 +46,12 @@ function ApplicationTokenRequestUioFromJSONTyped(json, ignoreDiscriminator) {
50
46
  }
51
47
  return {
52
48
  'grantType': json['grant_type'],
53
- 'code': json['code'],
54
- 'codeVerifier': json['code_verifier'],
55
- 'redirectUri': json['redirect_uri'],
49
+ 'code': json['code'] == null ? undefined : json['code'],
50
+ 'codeVerifier': json['code_verifier'] == null ? undefined : json['code_verifier'],
51
+ 'redirectUri': json['redirect_uri'] == null ? undefined : json['redirect_uri'],
52
+ 'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
56
53
  'clientId': json['client_id'],
54
+ 'tokenFormat': json['token_format'] == null ? undefined : (0, ApplicationTokenFormatUio_1.ApplicationTokenFormatUioFromJSON)(json['token_format']),
57
55
  };
58
56
  }
59
57
  function ApplicationTokenRequestUioToJSON(json) {
@@ -68,6 +66,8 @@ function ApplicationTokenRequestUioToJSONTyped(value, ignoreDiscriminator = fals
68
66
  'code': value['code'],
69
67
  'code_verifier': value['codeVerifier'],
70
68
  'redirect_uri': value['redirectUri'],
69
+ 'refresh_token': value['refreshToken'],
71
70
  'client_id': value['clientId'],
71
+ 'token_format': (0, ApplicationTokenFormatUio_1.ApplicationTokenFormatUioToJSON)(value['tokenFormat']),
72
72
  };
73
73
  }
@@ -10,13 +10,15 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  /**
13
+ * An API key (`token_type: api_key`), or with `token_format=jwt` an access token and a refresh token (`token_type: Bearer`). Each refresh returns a new refresh token; the previous one stops working, and presenting it again closes the session.
13
14
  *
14
15
  * @export
15
16
  * @interface ApplicationTokenResponseUio
16
17
  */
17
18
  export interface ApplicationTokenResponseUio {
18
19
  /**
19
- * API key, to send in the `x-api-key` header.
20
+ * API key, to send in the `x-api-key` header; or access token, to send as `Authorization: Bearer`.
21
+ *
20
22
  * @type {string}
21
23
  * @memberof ApplicationTokenResponseUio
22
24
  */
@@ -28,29 +30,48 @@ export interface ApplicationTokenResponseUio {
28
30
  */
29
31
  tokenType: ApplicationTokenResponseUioTokenTypeEnum;
30
32
  /**
31
- *
33
+ * Only for an API key.
32
34
  * @type {string}
33
35
  * @memberof ApplicationTokenResponseUio
34
36
  */
35
- keyId: string;
37
+ keyId?: string;
36
38
  /**
37
- *
39
+ * Only for an API key.
38
40
  * @type {string}
39
41
  * @memberof ApplicationTokenResponseUio
40
42
  */
41
- keyName: string;
43
+ keyName?: string;
44
+ /**
45
+ * Lifetime of the access token in seconds. Only with `token_format=jwt`.
46
+ * @type {number}
47
+ * @memberof ApplicationTokenResponseUio
48
+ */
49
+ expiresIn?: number;
50
+ /**
51
+ * Only with `token_format=jwt`.
52
+ * @type {string}
53
+ * @memberof ApplicationTokenResponseUio
54
+ */
55
+ refreshToken?: string;
42
56
  /**
43
57
  *
44
58
  * @type {string}
45
59
  * @memberof ApplicationTokenResponseUio
46
60
  */
47
61
  email?: string | null;
62
+ /**
63
+ *
64
+ * @type {string}
65
+ * @memberof ApplicationTokenResponseUio
66
+ */
67
+ userId?: string;
48
68
  }
49
69
  /**
50
70
  * @export
51
71
  */
52
72
  export declare const ApplicationTokenResponseUioTokenTypeEnum: {
53
73
  readonly ApiKey: "api_key";
74
+ readonly Bearer: "Bearer";
54
75
  };
55
76
  export type ApplicationTokenResponseUioTokenTypeEnum = typeof ApplicationTokenResponseUioTokenTypeEnum[keyof typeof ApplicationTokenResponseUioTokenTypeEnum];
56
77
  /**
@@ -23,7 +23,8 @@ exports.ApplicationTokenResponseUioToJSONTyped = ApplicationTokenResponseUioToJS
23
23
  * @export
24
24
  */
25
25
  exports.ApplicationTokenResponseUioTokenTypeEnum = {
26
- ApiKey: 'api_key'
26
+ ApiKey: 'api_key',
27
+ Bearer: 'Bearer'
27
28
  };
28
29
  /**
29
30
  * Check if a given object implements the ApplicationTokenResponseUio interface.
@@ -33,10 +34,6 @@ function instanceOfApplicationTokenResponseUio(value) {
33
34
  return false;
34
35
  if (!('tokenType' in value) || value['tokenType'] === undefined)
35
36
  return false;
36
- if (!('keyId' in value) || value['keyId'] === undefined)
37
- return false;
38
- if (!('keyName' in value) || value['keyName'] === undefined)
39
- return false;
40
37
  return true;
41
38
  }
42
39
  function ApplicationTokenResponseUioFromJSON(json) {
@@ -49,9 +46,12 @@ function ApplicationTokenResponseUioFromJSONTyped(json, ignoreDiscriminator) {
49
46
  return {
50
47
  'accessToken': json['access_token'],
51
48
  'tokenType': json['token_type'],
52
- 'keyId': json['key_id'],
53
- 'keyName': json['key_name'],
49
+ 'keyId': json['key_id'] == null ? undefined : json['key_id'],
50
+ 'keyName': json['key_name'] == null ? undefined : json['key_name'],
51
+ 'expiresIn': json['expires_in'] == null ? undefined : json['expires_in'],
52
+ 'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
54
53
  'email': json['email'] == null ? undefined : json['email'],
54
+ 'userId': json['user_id'] == null ? undefined : json['user_id'],
55
55
  };
56
56
  }
57
57
  function ApplicationTokenResponseUioToJSON(json) {
@@ -66,6 +66,9 @@ function ApplicationTokenResponseUioToJSONTyped(value, ignoreDiscriminator = fal
66
66
  'token_type': value['tokenType'],
67
67
  'key_id': value['keyId'],
68
68
  'key_name': value['keyName'],
69
+ 'expires_in': value['expiresIn'],
70
+ 'refresh_token': value['refreshToken'],
69
71
  'email': value['email'],
72
+ 'user_id': value['userId'],
70
73
  };
71
74
  }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface ApplicationTokenRevocationRequestUio
16
+ */
17
+ export interface ApplicationTokenRevocationRequestUio {
18
+ /**
19
+ * The refresh token to revoke.
20
+ * @type {string}
21
+ * @memberof ApplicationTokenRevocationRequestUio
22
+ */
23
+ token: string;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof ApplicationTokenRevocationRequestUio
28
+ */
29
+ clientId: string;
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof ApplicationTokenRevocationRequestUio
34
+ */
35
+ tokenTypeHint?: string;
36
+ }
37
+ /**
38
+ * Check if a given object implements the ApplicationTokenRevocationRequestUio interface.
39
+ */
40
+ export declare function instanceOfApplicationTokenRevocationRequestUio(value: object): value is ApplicationTokenRevocationRequestUio;
41
+ export declare function ApplicationTokenRevocationRequestUioFromJSON(json: any): ApplicationTokenRevocationRequestUio;
42
+ export declare function ApplicationTokenRevocationRequestUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApplicationTokenRevocationRequestUio;
43
+ export declare function ApplicationTokenRevocationRequestUioToJSON(json: any): ApplicationTokenRevocationRequestUio;
44
+ export declare function ApplicationTokenRevocationRequestUioToJSONTyped(value?: ApplicationTokenRevocationRequestUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfApplicationTokenRevocationRequestUio = instanceOfApplicationTokenRevocationRequestUio;
17
+ exports.ApplicationTokenRevocationRequestUioFromJSON = ApplicationTokenRevocationRequestUioFromJSON;
18
+ exports.ApplicationTokenRevocationRequestUioFromJSONTyped = ApplicationTokenRevocationRequestUioFromJSONTyped;
19
+ exports.ApplicationTokenRevocationRequestUioToJSON = ApplicationTokenRevocationRequestUioToJSON;
20
+ exports.ApplicationTokenRevocationRequestUioToJSONTyped = ApplicationTokenRevocationRequestUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the ApplicationTokenRevocationRequestUio interface.
23
+ */
24
+ function instanceOfApplicationTokenRevocationRequestUio(value) {
25
+ if (!('token' in value) || value['token'] === undefined)
26
+ return false;
27
+ if (!('clientId' in value) || value['clientId'] === undefined)
28
+ return false;
29
+ return true;
30
+ }
31
+ function ApplicationTokenRevocationRequestUioFromJSON(json) {
32
+ return ApplicationTokenRevocationRequestUioFromJSONTyped(json, false);
33
+ }
34
+ function ApplicationTokenRevocationRequestUioFromJSONTyped(json, ignoreDiscriminator) {
35
+ if (json == null) {
36
+ return json;
37
+ }
38
+ return {
39
+ 'token': json['token'],
40
+ 'clientId': json['client_id'],
41
+ 'tokenTypeHint': json['token_type_hint'] == null ? undefined : json['token_type_hint'],
42
+ };
43
+ }
44
+ function ApplicationTokenRevocationRequestUioToJSON(json) {
45
+ return ApplicationTokenRevocationRequestUioToJSONTyped(json, false);
46
+ }
47
+ function ApplicationTokenRevocationRequestUioToJSONTyped(value, ignoreDiscriminator = false) {
48
+ if (value == null) {
49
+ return value;
50
+ }
51
+ return {
52
+ 'token': value['token'],
53
+ 'client_id': value['clientId'],
54
+ 'token_type_hint': value['tokenTypeHint'],
55
+ };
56
+ }
@@ -179,8 +179,10 @@ export * from './ApplicationAuthorizationErrorUio';
179
179
  export * from './ApplicationAuthorizationRequestUio';
180
180
  export * from './ApplicationAuthorizationResponseUio';
181
181
  export * from './ApplicationTokenErrorUio';
182
+ export * from './ApplicationTokenFormatUio';
182
183
  export * from './ApplicationTokenRequestUio';
183
184
  export * from './ApplicationTokenResponseUio';
185
+ export * from './ApplicationTokenRevocationRequestUio';
184
186
  export * from './AttachmentCreateRequestUio';
185
187
  export * from './AttachmentCreateResponseUio';
186
188
  export * from './AttachmentDetailsResponseUio';
@@ -197,8 +197,10 @@ __exportStar(require("./ApplicationAuthorizationErrorUio"), exports);
197
197
  __exportStar(require("./ApplicationAuthorizationRequestUio"), exports);
198
198
  __exportStar(require("./ApplicationAuthorizationResponseUio"), exports);
199
199
  __exportStar(require("./ApplicationTokenErrorUio"), exports);
200
+ __exportStar(require("./ApplicationTokenFormatUio"), exports);
200
201
  __exportStar(require("./ApplicationTokenRequestUio"), exports);
201
202
  __exportStar(require("./ApplicationTokenResponseUio"), exports);
203
+ __exportStar(require("./ApplicationTokenRevocationRequestUio"), exports);
202
204
  __exportStar(require("./AttachmentCreateRequestUio"), exports);
203
205
  __exportStar(require("./AttachmentCreateResponseUio"), exports);
204
206
  __exportStar(require("./AttachmentDetailsResponseUio"), exports);
package/dist/openapi.json CHANGED
@@ -5219,7 +5219,7 @@
5219
5219
  },
5220
5220
  "/auth/token" : {
5221
5221
  "post" : {
5222
- "description" : "Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. Errors follow RFC 6749 section 5.2.\n",
5222
+ "description" : "Exchanges the code issued by `POST /auth/authorizations` for an API key of the user, after checking the PKCE verifier, the client and the redirect address. The code is single use. With `token_format=jwt`, returns an access token and a refresh token instead of an API key; `grant_type=refresh_token` then renews them. Errors follow RFC 6749 section 5.2.\n",
5223
5223
  "operationId" : "exchangeApplicationAuthorizationCode",
5224
5224
  "requestBody" : {
5225
5225
  "content" : {
@@ -5240,7 +5240,7 @@
5240
5240
  }
5241
5241
  }
5242
5242
  },
5243
- "description" : "API key of the user"
5243
+ "description" : "API key of the user, or access and refresh tokens"
5244
5244
  },
5245
5245
  "400" : {
5246
5246
  "content" : {
@@ -5254,7 +5254,41 @@
5254
5254
  }
5255
5255
  },
5256
5256
  "security" : [ ],
5257
- "summary" : "Exchange an application authorization code",
5257
+ "summary" : "Exchange an application authorization code, or refresh its tokens",
5258
+ "tags" : [ "auth" ]
5259
+ }
5260
+ },
5261
+ "/auth/revoke" : {
5262
+ "post" : {
5263
+ "description" : "Closes the session of a refresh token returned with `token_format=jwt` (RFC 7009), on logout from the application. Answers 200 whether the token existed or not. Access tokens already issued stay valid until they expire (1 h at most).\n",
5264
+ "operationId" : "revokeApplicationToken",
5265
+ "requestBody" : {
5266
+ "content" : {
5267
+ "application/json" : {
5268
+ "schema" : {
5269
+ "$ref" : "#/components/schemas/ApplicationTokenRevocationRequest"
5270
+ }
5271
+ }
5272
+ },
5273
+ "required" : true
5274
+ },
5275
+ "responses" : {
5276
+ "200" : {
5277
+ "description" : "Token revoked, or unknown"
5278
+ },
5279
+ "400" : {
5280
+ "content" : {
5281
+ "application/json" : {
5282
+ "schema" : {
5283
+ "$ref" : "#/components/schemas/ApplicationTokenError"
5284
+ }
5285
+ }
5286
+ },
5287
+ "description" : "OAuth error (`invalid_request`)"
5288
+ }
5289
+ },
5290
+ "security" : [ ],
5291
+ "summary" : "Revoke an application refresh token",
5258
5292
  "tags" : [ "auth" ]
5259
5293
  }
5260
5294
  },
@@ -28214,9 +28248,10 @@
28214
28248
  "type" : "object"
28215
28249
  },
28216
28250
  "ApplicationTokenRequest" : {
28251
+ "description" : "`authorization_code` exchanges the code (with `code`, `code_verifier` and `redirect_uri`); `refresh_token` renews the tokens of a session opened with `token_format=jwt`.\n",
28217
28252
  "properties" : {
28218
28253
  "grant_type" : {
28219
- "enum" : [ "authorization_code" ],
28254
+ "enum" : [ "authorization_code", "refresh_token" ],
28220
28255
  "type" : "string"
28221
28256
  },
28222
28257
  "code" : {
@@ -28228,35 +28263,78 @@
28228
28263
  "redirect_uri" : {
28229
28264
  "type" : "string"
28230
28265
  },
28266
+ "refresh_token" : {
28267
+ "description" : "Required with `grant_type=refresh_token`.",
28268
+ "type" : "string"
28269
+ },
28231
28270
  "client_id" : {
28232
28271
  "type" : "string"
28272
+ },
28273
+ "token_format" : {
28274
+ "$ref" : "#/components/schemas/ApplicationTokenFormat"
28233
28275
  }
28234
28276
  },
28235
- "required" : [ "client_id", "code", "code_verifier", "grant_type", "redirect_uri" ],
28277
+ "required" : [ "client_id", "grant_type" ],
28236
28278
  "type" : "object"
28237
28279
  },
28280
+ "ApplicationTokenFormat" : {
28281
+ "default" : "api_key",
28282
+ "description" : "`api_key` (default) creates an API key of the user. `jwt` returns a 1 h access token and a rotating 30-day refresh token instead, without creating an API key.\n",
28283
+ "enum" : [ "api_key", "jwt" ],
28284
+ "type" : "string"
28285
+ },
28238
28286
  "ApplicationTokenResponse" : {
28287
+ "description" : "An API key (`token_type: api_key`), or with `token_format=jwt` an access token and a refresh token (`token_type: Bearer`). Each refresh returns a new refresh token; the previous one stops working, and presenting it again closes the session.\n",
28239
28288
  "properties" : {
28240
28289
  "access_token" : {
28241
- "description" : "API key, to send in the `x-api-key` header.",
28290
+ "description" : "API key, to send in the `x-api-key` header; or access token, to send as `Authorization: Bearer`.\n",
28242
28291
  "type" : "string"
28243
28292
  },
28244
28293
  "token_type" : {
28245
- "enum" : [ "api_key" ],
28294
+ "enum" : [ "api_key", "Bearer" ],
28246
28295
  "type" : "string"
28247
28296
  },
28248
28297
  "key_id" : {
28298
+ "description" : "Only for an API key.",
28249
28299
  "type" : "string"
28250
28300
  },
28251
28301
  "key_name" : {
28302
+ "description" : "Only for an API key.",
28303
+ "type" : "string"
28304
+ },
28305
+ "expires_in" : {
28306
+ "description" : "Lifetime of the access token in seconds. Only with `token_format=jwt`.",
28307
+ "type" : "integer"
28308
+ },
28309
+ "refresh_token" : {
28310
+ "description" : "Only with `token_format=jwt`.",
28252
28311
  "type" : "string"
28253
28312
  },
28254
28313
  "email" : {
28255
28314
  "nullable" : true,
28256
28315
  "type" : "string"
28316
+ },
28317
+ "user_id" : {
28318
+ "type" : "string"
28319
+ }
28320
+ },
28321
+ "required" : [ "access_token", "token_type" ],
28322
+ "type" : "object"
28323
+ },
28324
+ "ApplicationTokenRevocationRequest" : {
28325
+ "properties" : {
28326
+ "token" : {
28327
+ "description" : "The refresh token to revoke.",
28328
+ "type" : "string"
28329
+ },
28330
+ "client_id" : {
28331
+ "type" : "string"
28332
+ },
28333
+ "token_type_hint" : {
28334
+ "type" : "string"
28257
28335
  }
28258
28336
  },
28259
- "required" : [ "access_token", "key_id", "key_name", "token_type" ],
28337
+ "required" : [ "client_id", "token" ],
28260
28338
  "type" : "object"
28261
28339
  },
28262
28340
  "OAuthProviderInfo" : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/client",
3
- "version": "1.0.199",
3
+ "version": "1.0.200",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",