@outseta/api-client 0.3.2 → 0.3.3

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.2",
3
+ "version": "0.3.3",
4
4
  "description": "Generated API client for the Outseta REST API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthRefreshTokenParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -100,6 +100,7 @@ export * from './articleAllOf';
100
100
  export * from './articleAllOfCategory';
101
101
  export * from './articleGetAllArticlesParams';
102
102
  export * from './authGetTokenParams';
103
+ export * from './authRefreshTokenParams';
103
104
  export * from './authResendTwoFactorParams';
104
105
  export * from './authSwitchTwoFactorMechanismParams';
105
106
  export * from './authVerifyTwoFactorRecoveryParams';
@@ -32,4 +32,6 @@ export type SendGridDomainAuthenticationAllOf = {
32
32
  LastValidationAttempt?: string | null;
33
33
  /** @nullable */
34
34
  DnsEntries?: DnsEntry[] | null;
35
+ /** @nullable */
36
+ LegacyDnsEntries?: DnsEntry[] | null;
35
37
  };
@@ -9,5 +9,7 @@ export interface TokenPayload {
9
9
  /** @nullable */
10
10
  id_token?: string | null;
11
11
  /** @nullable */
12
+ refresh_token?: string | null;
13
+ /** @nullable */
12
14
  token_type?: string | null;
13
15
  }
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import type {
3
3
  AuthGetTokenParams,
4
+ AuthRefreshTokenParams,
4
5
  AuthResendTwoFactorParams,
5
6
  AuthSwitchTwoFactorMechanismParams,
6
7
  AuthVerifyTwoFactorRecoveryParams,
@@ -22,9 +23,9 @@ import { customFetch } from '../../client';
22
23
 
23
24
  { "username": "user@example.com", "password": "their-password" }
24
25
 
25
- On success the response is `200` with an access token:
26
+ On success the response is `200` with an access token and refresh token:
26
27
 
27
- { "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
28
+ { "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
28
29
 
29
30
  **Two-factor authentication.** If the user has a verified 2FA method,
30
31
  the password alone is not enough. After verifying the password this
@@ -117,7 +118,7 @@ authenticator app):
117
118
  On success the response is `200` with the final access token, in the
118
119
  same shape as `POST /api/v1/tokens`:
119
120
 
120
- { "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
121
+ { "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
121
122
 
122
123
  An incorrect code returns `400` (`invalid_grant`). A code has at most
123
124
  five attempts before the challenge locks. An expired challenge returns
@@ -373,6 +374,65 @@ export const authVerifyTwoFactorRecovery = async (params: AuthVerifyTwoFactorRec
373
374
  );}
374
375
 
375
376
 
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
+
376
436
  /**
377
437
  * Call this when `POST /api/v1/tokens` returned
378
438
  `two_factor_enrollment_required` and the user chooses email. Post the