@outseta/api-client 0.2.5 → 0.3.1

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.2.5",
3
+ "version": "0.3.1",
4
4
  "description": "Generated API client for the Outseta REST API",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/client.ts CHANGED
@@ -60,6 +60,13 @@ export function createClient(creds: OutsetaCredentials): OutsetaClient {
60
60
  * Consumers pass `{ client }` in the options to inject a client from
61
61
  * `createClient()`.
62
62
  */
63
+ export function withClient(
64
+ client: OutsetaClient,
65
+ init: RequestInit = {},
66
+ ): RequestInit {
67
+ return { ...init, client } as OutsetaRequestInit as RequestInit;
68
+ }
69
+
63
70
  export const customFetch = async <T>(
64
71
  url: string,
65
72
  options: OutsetaRequestInit,
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthGetTokenParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthResendTwoFactorParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthSwitchTwoFactorMechanismParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthVerifyTwoFactorRecoveryParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthVerifyTwoFactorTokenParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -99,6 +99,11 @@ export * from './article';
99
99
  export * from './articleAllOf';
100
100
  export * from './articleAllOfCategory';
101
101
  export * from './articleGetAllArticlesParams';
102
+ export * from './authGetTokenParams';
103
+ export * from './authResendTwoFactorParams';
104
+ export * from './authSwitchTwoFactorMechanismParams';
105
+ export * from './authVerifyTwoFactorRecoveryParams';
106
+ export * from './authVerifyTwoFactorTokenParams';
102
107
  export * from './backGroundTaskType';
103
108
  export * from './billSettings';
104
109
  export * from './billSettingsAllOf';
@@ -464,6 +469,11 @@ export * from './taxRateAllOf';
464
469
  export * from './template';
465
470
  export * from './templateAllOf';
466
471
  export * from './temporaryPasswordModel';
472
+ export * from './tokenPayload';
473
+ export * from './tokenTwoFactorEnrollmentBeginEmailParams';
474
+ export * from './tokenTwoFactorEnrollmentBeginTotpParams';
475
+ export * from './tokenTwoFactorEnrollmentConfirmEmailParams';
476
+ export * from './tokenTwoFactorEnrollmentConfirmTotpParams';
467
477
  export * from './transaction';
468
478
  export * from './transactionAllOf';
469
479
  export * from './transactionAllOfAccount';
@@ -471,6 +481,9 @@ export * from './transactionAllOfInvoice';
471
481
  export * from './transactionsAddPaymentTransactionBody';
472
482
  export * from './translation';
473
483
  export * from './translationAllOf';
484
+ export * from './twoFactorChallengePayload';
485
+ export * from './twoFactorEnrollmentConfirmationPayload';
486
+ export * from './twoFactorTotpEnrollmentPayload';
474
487
  export * from './usage';
475
488
  export * from './usageAddUsageBody';
476
489
  export * from './usageAllOf';
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+
3
+ export interface TokenPayload {
4
+ /** @nullable */
5
+ access_token?: string | null;
6
+ /** @nullable */
7
+ authentication_callback_url?: string | null;
8
+ expires_in?: number;
9
+ /** @nullable */
10
+ id_token?: string | null;
11
+ /** @nullable */
12
+ token_type?: string | null;
13
+ }
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentBeginEmailParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentBeginTotpParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentConfirmEmailParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentConfirmTotpParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,69 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Returned when a login cannot complete with a password alone because the
5
+ user has two-factor authentication enabled. Carries the opaque challenge
6
+ token that must be echoed back to POST /api/v1/tokens/two-factor
7
+ (or the recovery / resend / switch-mechanism endpoints) along with enough
8
+ metadata for a client to render the verification step without a second
9
+ round-trip. The property names are snake_case to match the wire format of
10
+ the other token endpoints (see TokenPayload).
11
+ */
12
+ export interface TwoFactorChallengePayload {
13
+ /**
14
+ * Present and true on the 202 response from POST /api/v1/tokens
15
+ when the user has at least one verified 2FA method. Absent on the
16
+ resend / switch-mechanism responses, which only ever follow an
17
+ already-issued login challenge.
18
+ * @nullable
19
+ */
20
+ two_factor_required?: boolean | null;
21
+ /**
22
+ * Present and true instead of two_factor_required
23
+ when the tenant forces 2FA but the user has not yet enrolled any
24
+ method. In that case only challenge_token and
25
+ expires_in are populated and the client must route the
26
+ user through the mid-login enrollment endpoints
27
+ (/api/v1/tokens/two-factor/enroll/...) before a token can be issued.
28
+ * @nullable
29
+ */
30
+ two_factor_enrollment_required?: boolean | null;
31
+ /**
32
+ * Short-lived signed JWT (audience outseta:2fa-challenge) that
33
+ identifies this challenge. Echo it back verbatim to complete the login.
34
+ * @nullable
35
+ */
36
+ challenge_token?: string | null;
37
+ /**
38
+ * The mechanism this challenge was issued against: Email or
39
+ Totp (authenticator app). For Email a code has already
40
+ been sent to the user; for Totp the user reads the current
41
+ code from their authenticator app and nothing is sent.
42
+ * @nullable
43
+ */
44
+ mechanism?: string | null;
45
+ /**
46
+ * A masked view of where an emailed code was sent (e.g. b***@outseta.com),
47
+ suitable for display. Empty when mechanism is Totp.
48
+ * @nullable
49
+ */
50
+ masked_destination?: string | null;
51
+ /** Seconds until the challenge expires (600). After this the
52
+ challenge_token can no longer be verified and the login must restart. */
53
+ expires_in?: number;
54
+ /**
55
+ * Every verified mechanism enrolled for this user (excluding recovery
56
+ codes), e.g. ["Totp", "Email"]. A client can offer a
57
+ "use a different method" option for any value other than the current
58
+ mechanism via POST /api/v1/tokens/two-factor/switch-mechanism.
59
+ * @nullable
60
+ */
61
+ available_mechanisms?: string[] | null;
62
+ /**
63
+ * true when the user has a batch of recovery codes on file, in
64
+ which case POST /api/v1/tokens/two-factor/recovery can be used
65
+ as a fallback if they cannot produce a primary code.
66
+ * @nullable
67
+ */
68
+ recovery_codes_available?: boolean | null;
69
+ }
@@ -0,0 +1,35 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Returned from the mid-login enrollment confirm endpoints
5
+ (POST /api/v1/tokens/two-factor/enroll/{email|totp}/confirm) once the
6
+ user has proven control of the new mechanism. Completes a forced-enrollment
7
+ login: it both finalizes the JWT access token and surfaces the freshly
8
+ generated recovery codes. The property names are snake_case to match the
9
+ wire format of the other token endpoints (see TokenPayload).
10
+ */
11
+ export interface TwoFactorEnrollmentConfirmationPayload {
12
+ /** Always true on a success response; the enrollment is now active. */
13
+ confirmed?: boolean;
14
+ /**
15
+ * The user's recovery codes, generated as part of first-time enrollment.
16
+ These are shown once and never returned again — prompt the user
17
+ to store them somewhere safe. Each code is single-use at
18
+ POST /api/v1/tokens/two-factor/recovery.
19
+ * @nullable
20
+ */
21
+ recovery_codes?: string[] | null;
22
+ /**
23
+ * The JWT access token. Use it as Authorization: bearer {access_token}
24
+ for subsequent API calls — login is complete.
25
+ * @nullable
26
+ */
27
+ access_token?: string | null;
28
+ /**
29
+ * Always Bearer.
30
+ * @nullable
31
+ */
32
+ token_type?: string | null;
33
+ /** Seconds until the access token expires. */
34
+ expires_in?: number;
35
+ }
@@ -0,0 +1,39 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Returned from POST /api/v1/tokens/two-factor/enroll/totp/begin when a
5
+ user forced into 2FA chooses to enroll an authenticator app. Carries the
6
+ shared secret in the three forms a client may need to present it, plus the
7
+ challenge token the user's first generated code is confirmed against. The
8
+ property names are snake_case to match the wire format of the other token
9
+ endpoints (see TokenPayload).
10
+ */
11
+ export interface TwoFactorTotpEnrollmentPayload {
12
+ /**
13
+ * Short-lived signed JWT identifying the enrollment-test challenge.
14
+ Echo it back to POST /api/v1/tokens/two-factor/enroll/totp/confirm
15
+ along with the first code from the authenticator app.
16
+ * @nullable
17
+ */
18
+ challenge_token?: string | null;
19
+ /**
20
+ * The Base32-encoded shared secret. Offer this for manual entry by users
21
+ who cannot scan the QR code.
22
+ * @nullable
23
+ */
24
+ secret?: string | null;
25
+ /**
26
+ * The full otpauth://totp/... URI encoding the secret, issuer and
27
+ parameters. Most authenticator apps add an account directly from this.
28
+ * @nullable
29
+ */
30
+ otpauth_uri?: string | null;
31
+ /**
32
+ * A QR code rendering of otpauth_uri as a PNG, Base64
33
+ encoded — render it as an <img> for the user to scan.
34
+ * @nullable
35
+ */
36
+ qr_code_png_base64?: string | null;
37
+ /** Seconds until the enrollment-test challenge expires (600). */
38
+ expires_in?: number;
39
+ }