@outseta/api-client 0.3.3 → 0.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/api-client",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Generated API client for the Outseta REST API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -100,11 +100,9 @@ export * from './articleAllOf';
100
100
  export * from './articleAllOfCategory';
101
101
  export * from './articleGetAllArticlesParams';
102
102
  export * from './authGetTokenParams';
103
- export * from './authRefreshTokenParams';
104
103
  export * from './authResendTwoFactorParams';
105
104
  export * from './authSwitchTwoFactorMechanismParams';
106
105
  export * from './authVerifyTwoFactorRecoveryParams';
107
- export * from './authVerifyTwoFactorTokenParams';
108
106
  export * from './backGroundTaskType';
109
107
  export * from './billSettings';
110
108
  export * from './billSettingsAllOf';
@@ -485,6 +483,7 @@ export * from './translationAllOf';
485
483
  export * from './twoFactorChallengePayload';
486
484
  export * from './twoFactorEnrollmentConfirmationPayload';
487
485
  export * from './twoFactorTotpEnrollmentPayload';
486
+ export * from './twoFactorVerifyRequest';
488
487
  export * from './usage';
489
488
  export * from './usageAddUsageBody';
490
489
  export * from './usageAllOf';
@@ -0,0 +1,25 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Request body for POST /api/v1/tokens/two-factor: the challenge token
5
+ from the login response plus the user's one-time code. Property names are
6
+ snake_case to match the wire format of the token endpoints.
7
+
8
+ The action binds the body as a loose JObject at runtime; this type
9
+ exists so the API docs describe the body instead of an opaque data
10
+ parameter (see [OpenApiRequestBody] on the action).
11
+ */
12
+ export interface TwoFactorVerifyRequest {
13
+ /**
14
+ * The challenge_token returned by POST /api/v1/tokens when
15
+ two-factor authentication is required. Echo it back verbatim.
16
+ * @nullable
17
+ */
18
+ challenge_token?: string | null;
19
+ /**
20
+ * The user's one-time code: the emailed code for an Email challenge,
21
+ or the current code from their authenticator app for a Totp challenge.
22
+ * @nullable
23
+ */
24
+ code?: string | null;
25
+ }
@@ -1,11 +1,9 @@
1
1
  // @ts-nocheck
2
2
  import type {
3
3
  AuthGetTokenParams,
4
- AuthRefreshTokenParams,
5
4
  AuthResendTwoFactorParams,
6
5
  AuthSwitchTwoFactorMechanismParams,
7
6
  AuthVerifyTwoFactorRecoveryParams,
8
- AuthVerifyTwoFactorTokenParams,
9
7
  TokenPayload,
10
8
  TokenTwoFactorEnrollmentBeginEmailParams,
11
9
  TokenTwoFactorEnrollmentBeginTotpParams,
@@ -13,7 +11,8 @@ import type {
13
11
  TokenTwoFactorEnrollmentConfirmTotpParams,
14
12
  TwoFactorChallengePayload,
15
13
  TwoFactorEnrollmentConfirmationPayload,
16
- TwoFactorTotpEnrollmentPayload
14
+ TwoFactorTotpEnrollmentPayload,
15
+ TwoFactorVerifyRequest
17
16
  } from '.././models';
18
17
 
19
18
  import { customFetch } from '../../client';
@@ -124,7 +123,7 @@ An incorrect code returns `400` (`invalid_grant`). A code has at most
124
123
  five attempts before the challenge locks. An expired challenge returns
125
124
  `410` (`challenge_expired`) — restart at `POST /api/v1/tokens`. The
126
125
  endpoint is rate limited to 10 requests per minute (`429`).
127
- * @summary Complete a two-factor login challenge and obtain a JWT access token.
126
+ * @summary Complete login when user has two-factor authentication enabled.
128
127
  */
129
128
  export type authVerifyTwoFactorTokenResponse200 = {
130
129
  data: TokenPayload
@@ -150,29 +149,23 @@ export type authVerifyTwoFactorTokenResponseError = (authVerifyTwoFactorTokenRes
150
149
 
151
150
  export type authVerifyTwoFactorTokenResponse = (authVerifyTwoFactorTokenResponseSuccess | authVerifyTwoFactorTokenResponseError)
152
151
 
153
- export const getAuthVerifyTwoFactorTokenUrl = (params: AuthVerifyTwoFactorTokenParams,) => {
154
- const normalizedParams = new URLSearchParams();
152
+ export const getAuthVerifyTwoFactorTokenUrl = () => {
155
153
 
156
- Object.entries(params || {}).forEach(([key, value]) => {
157
-
158
- if (value !== undefined) {
159
- normalizedParams.append(key, value === null ? 'null' : value.toString())
160
- }
161
- });
162
154
 
163
- const stringifiedParams = normalizedParams.toString();
155
+
164
156
 
165
- return stringifiedParams.length > 0 ? `/api/v1/tokens/two-factor?${stringifiedParams}` : `/api/v1/tokens/two-factor`
157
+ return `/api/v1/tokens/two-factor`
166
158
  }
167
159
 
168
- export const authVerifyTwoFactorToken = async (params: AuthVerifyTwoFactorTokenParams, options?: RequestInit): Promise<authVerifyTwoFactorTokenResponse> => {
160
+ export const authVerifyTwoFactorToken = async (twoFactorVerifyRequest: TwoFactorVerifyRequest, options?: RequestInit): Promise<authVerifyTwoFactorTokenResponse> => {
169
161
 
170
- return customFetch<authVerifyTwoFactorTokenResponse>(getAuthVerifyTwoFactorTokenUrl(params),
162
+ return customFetch<authVerifyTwoFactorTokenResponse>(getAuthVerifyTwoFactorTokenUrl(),
171
163
  {
172
164
  ...options,
173
- method: 'POST'
174
-
175
-
165
+ method: 'POST',
166
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
167
+ body: JSON.stringify(
168
+ twoFactorVerifyRequest,)
176
169
  }
177
170
  );}
178
171
 
@@ -320,8 +313,7 @@ requests per minute (`429`).
320
313
 
321
314
  Used by the embed login widget; the hosted Razor flow has its own
322
315
  equivalent action on the AuthenticationController.
323
- * @summary Complete a two-factor login challenge with a recovery code instead of
324
- the primary one-time code, and obtain a JWT access token.
316
+ * @summary Complete login with a two-factor recovery code.
325
317
  */
326
318
  export type authVerifyTwoFactorRecoveryResponse200 = {
327
319
  data: TokenPayload
@@ -374,65 +366,6 @@ export const authVerifyTwoFactorRecovery = async (params: AuthVerifyTwoFactorRec
374
366
  );}
375
367
 
376
368
 
377
- /**
378
- * Post the refresh token returned from `POST /api/v1/tokens` or the
379
- two-factor completion endpoints:
380
-
381
- { "refresh_token": "..." }
382
-
383
- On success the response is `200` with a new access token and refresh token:
384
-
385
- { "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
386
-
387
- An invalid or expired refresh token returns `400` with a body of `invalid_grant`.
388
- * @summary Exchange a refresh token for a new access token.
389
- */
390
- export type authRefreshTokenResponse200 = {
391
- data: TokenPayload
392
- status: 200
393
- }
394
-
395
- export type authRefreshTokenResponse400 = {
396
- data: string
397
- status: 400
398
- }
399
-
400
- export type authRefreshTokenResponseSuccess = (authRefreshTokenResponse200) & {
401
- headers: Headers;
402
- };
403
- export type authRefreshTokenResponseError = (authRefreshTokenResponse400) & {
404
- headers: Headers;
405
- };
406
-
407
- export type authRefreshTokenResponse = (authRefreshTokenResponseSuccess | authRefreshTokenResponseError)
408
-
409
- export const getAuthRefreshTokenUrl = (params: AuthRefreshTokenParams,) => {
410
- const normalizedParams = new URLSearchParams();
411
-
412
- Object.entries(params || {}).forEach(([key, value]) => {
413
-
414
- if (value !== undefined) {
415
- normalizedParams.append(key, value === null ? 'null' : value.toString())
416
- }
417
- });
418
-
419
- const stringifiedParams = normalizedParams.toString();
420
-
421
- return stringifiedParams.length > 0 ? `/api/v1/tokens/refresh-token?${stringifiedParams}` : `/api/v1/tokens/refresh-token`
422
- }
423
-
424
- export const authRefreshToken = async (params: AuthRefreshTokenParams, options?: RequestInit): Promise<authRefreshTokenResponse> => {
425
-
426
- return customFetch<authRefreshTokenResponse>(getAuthRefreshTokenUrl(params),
427
- {
428
- ...options,
429
- method: 'POST'
430
-
431
-
432
- }
433
- );}
434
-
435
-
436
369
  /**
437
370
  * Call this when `POST /api/v1/tokens` returned
438
371
  `two_factor_enrollment_required` and the user chooses email. Post the
@@ -1,8 +0,0 @@
1
- // @ts-nocheck
2
-
3
- export type AuthRefreshTokenParams = {
4
- /**
5
- * @nullable
6
- */
7
- data: unknown | null;
8
- };
@@ -1,8 +0,0 @@
1
- // @ts-nocheck
2
-
3
- export type AuthVerifyTwoFactorTokenParams = {
4
- /**
5
- * @nullable
6
- */
7
- data: unknown | null;
8
- };