@djangocfg/api 2.1.57 → 2.1.59

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.
Files changed (75) hide show
  1. package/README.md +125 -9
  2. package/dist/auth.cjs +1865 -402
  3. package/dist/auth.cjs.map +1 -1
  4. package/dist/auth.d.cts +352 -76
  5. package/dist/auth.d.ts +352 -76
  6. package/dist/auth.mjs +1867 -404
  7. package/dist/auth.mjs.map +1 -1
  8. package/dist/clients.cjs +1637 -137
  9. package/dist/clients.cjs.map +1 -1
  10. package/dist/clients.d.cts +1394 -282
  11. package/dist/clients.d.ts +1394 -282
  12. package/dist/clients.mjs +1637 -137
  13. package/dist/clients.mjs.map +1 -1
  14. package/dist/hooks.cjs +24 -11
  15. package/dist/hooks.cjs.map +1 -1
  16. package/dist/hooks.d.cts +88 -21
  17. package/dist/hooks.d.ts +88 -21
  18. package/dist/hooks.mjs +24 -11
  19. package/dist/hooks.mjs.map +1 -1
  20. package/dist/index.cjs +38 -17
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +94 -21
  23. package/dist/index.d.ts +94 -21
  24. package/dist/index.mjs +38 -17
  25. package/dist/index.mjs.map +1 -1
  26. package/package.json +3 -3
  27. package/src/auth/context/AccountsContext.tsx +8 -1
  28. package/src/auth/context/AuthContext.tsx +31 -8
  29. package/src/auth/context/types.ts +8 -1
  30. package/src/auth/hooks/index.ts +29 -5
  31. package/src/auth/hooks/useAuthForm.ts +292 -226
  32. package/src/auth/hooks/useAuthFormState.ts +60 -0
  33. package/src/auth/hooks/useAuthValidation.ts +77 -0
  34. package/src/auth/hooks/useGithubAuth.ts +26 -5
  35. package/src/auth/hooks/useTwoFactor.ts +239 -0
  36. package/src/auth/hooks/useTwoFactorSetup.ts +213 -0
  37. package/src/auth/index.ts +3 -0
  38. package/src/auth/types/form.ts +194 -0
  39. package/src/auth/types/index.ts +28 -0
  40. package/src/clients.ts +10 -0
  41. package/src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +26 -3
  42. package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts +26 -3
  43. package/src/generated/cfg_accounts/accounts/client.ts +4 -1
  44. package/src/generated/cfg_accounts/accounts/models.ts +15 -6
  45. package/src/generated/cfg_accounts/accounts__oauth/models.ts +16 -7
  46. package/src/generated/cfg_accounts/client.ts +5 -2
  47. package/src/generated/cfg_accounts/http.ts +8 -2
  48. package/src/generated/cfg_accounts/schema.json +47 -19
  49. package/src/generated/cfg_centrifugo/client.ts +5 -2
  50. package/src/generated/cfg_centrifugo/http.ts +8 -2
  51. package/src/generated/cfg_totp/CLAUDE.md +12 -12
  52. package/src/generated/cfg_totp/_utils/fetchers/index.ts +3 -3
  53. package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_management.ts → totp__totp_management.ts} +3 -3
  54. package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_setup.ts → totp__totp_setup.ts} +3 -3
  55. package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_verification.ts → totp__totp_verification.ts} +3 -3
  56. package/src/generated/cfg_totp/_utils/hooks/index.ts +3 -3
  57. package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_management.ts → totp__totp_management.ts} +2 -2
  58. package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_setup.ts → totp__totp_setup.ts} +2 -2
  59. package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_verification.ts → totp__totp_verification.ts} +2 -2
  60. package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +1 -1
  61. package/src/generated/cfg_totp/client.ts +14 -11
  62. package/src/generated/cfg_totp/http.ts +8 -2
  63. package/src/generated/cfg_totp/index.ts +16 -16
  64. package/src/generated/cfg_totp/schema.json +8 -7
  65. package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/client.ts +2 -2
  66. package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/models.ts +1 -1
  67. package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/client.ts +4 -4
  68. package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/client.ts +2 -2
  69. package/src/generated/cfg_webpush/client.ts +5 -2
  70. package/src/generated/cfg_webpush/http.ts +8 -2
  71. /package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/index.ts +0 -0
  72. /package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/index.ts +0 -0
  73. /package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/models.ts +0 -0
  74. /package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/index.ts +0 -0
  75. /package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/models.ts +0 -0
@@ -14,6 +14,8 @@ export interface HttpRequest {
14
14
  params?: Record<string, any>;
15
15
  /** FormData for file uploads (multipart/form-data) */
16
16
  formData?: FormData;
17
+ /** Binary data for octet-stream uploads */
18
+ binaryBody?: Blob | ArrayBuffer;
17
19
  }
18
20
 
19
21
  export interface HttpResponse<T = any> {
@@ -37,7 +39,7 @@ export interface HttpClientAdapter {
37
39
  */
38
40
  export class FetchAdapter implements HttpClientAdapter {
39
41
  async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {
40
- const { method, url, headers, body, params, formData } = request;
42
+ const { method, url, headers, body, params, formData, binaryBody } = request;
41
43
 
42
44
  // Build URL with query params
43
45
  let finalUrl = url;
@@ -58,12 +60,16 @@ export class FetchAdapter implements HttpClientAdapter {
58
60
  const finalHeaders: Record<string, string> = { ...headers };
59
61
 
60
62
  // Determine body and content-type
61
- let requestBody: string | FormData | undefined;
63
+ let requestBody: string | FormData | Blob | ArrayBuffer | undefined;
62
64
 
63
65
  if (formData) {
64
66
  // For multipart/form-data, let browser set Content-Type with boundary
65
67
  requestBody = formData;
66
68
  // Don't set Content-Type - browser will set it with boundary
69
+ } else if (binaryBody) {
70
+ // Binary upload (application/octet-stream)
71
+ finalHeaders['Content-Type'] = 'application/octet-stream';
72
+ requestBody = binaryBody;
67
73
  } else if (body) {
68
74
  // JSON request
69
75
  finalHeaders['Content-Type'] = 'application/json';
@@ -16,30 +16,30 @@ python manage.py generate_client --groups cfg_totp --typescript
16
16
 
17
17
  ## Resources
18
18
 
19
- - **2FA Management** (2 ops)
20
- - **2FA Setup** (2 ops)
21
- - **2FA Verification** (2 ops)
22
19
  - **Backup Codes** (2 ops)
20
+ - **TOTP Management** (2 ops)
21
+ - **TOTP Setup** (2 ops)
22
+ - **TOTP Verification** (2 ops)
23
23
  - **totp** (1 ops)
24
24
 
25
25
  ## Operations
26
26
 
27
- **2FA Management:**
27
+ **Backup Codes:**
28
+ - `POST` /cfg/totp/backup-codes/regenerate/ → `cfg_totp_backup_codes_regenerate_create`
29
+ - `GET` /cfg/totp/backup-codes/ → `cfg_totp_backup_codes_retrieve`
30
+
31
+ **TOTP Management:**
28
32
  - `GET` /cfg/totp/devices/ → `cfg_totp_devices_list`
29
33
  - `POST` /cfg/totp/disable/ → `cfg_totp_disable_create`
30
34
 
31
- **2FA Setup:**
35
+ **TOTP Setup:**
32
36
  - `POST` /cfg/totp/setup/confirm/ → `cfg_totp_setup_confirm_create`
33
37
  - `POST` /cfg/totp/setup/ → `cfg_totp_setup_create`
34
38
 
35
- **2FA Verification:**
39
+ **TOTP Verification:**
36
40
  - `POST` /cfg/totp/verify/backup/ → `cfg_totp_verify_backup_create`
37
41
  - `POST` /cfg/totp/verify/ → `cfg_totp_verify_create`
38
42
 
39
- **Backup Codes:**
40
- - `POST` /cfg/totp/backup-codes/regenerate/ → `cfg_totp_backup_codes_regenerate_create`
41
- - `GET` /cfg/totp/backup-codes/ → `cfg_totp_backup_codes_retrieve`
42
-
43
43
  **totp:**
44
44
  - `DELETE` /cfg/totp/devices/{id}/ → `cfg_totp_devices_destroy`
45
45
 
@@ -52,8 +52,8 @@ const client = new APIClient({ baseUrl, token });
52
52
 
53
53
  await client.backup codes.retrieve({ id: 1 });
54
54
  await client.backup codes.create({ ... });
55
- await client.2fa management.list();
56
- await client.2fa management.create({ ... });
55
+ await client.totp management.list();
56
+ await client.totp management.create({ ... });
57
57
  ```
58
58
 
59
59
  **SWR Hooks:**
@@ -27,7 +27,7 @@
27
27
  */
28
28
 
29
29
  export * from './totp'
30
- export * from './totp__2fa_management'
31
- export * from './totp__2fa_setup'
32
- export * from './totp__2fa_verification'
33
30
  export * from './totp__backup_codes'
31
+ export * from './totp__totp_management'
32
+ export * from './totp__totp_setup'
33
+ export * from './totp__totp_verification'
@@ -1,6 +1,6 @@
1
1
  // Auto-generated by DjangoCFG - see CLAUDE.md
2
2
  /**
3
- * Typed fetchers for 2fa Management
3
+ * Typed fetchers for TOTP Management
4
4
  *
5
5
  * Universal functions that work in any environment:
6
6
  * - Next.js (App Router / Pages Router / Server Components)
@@ -44,7 +44,7 @@ import { getAPIInstance } from '../../api-instance'
44
44
  export async function getTotpDevicesList( params?: { page?: number; page_size?: number }, client?: any
45
45
  ): Promise<PaginatedDeviceListList> {
46
46
  const api = client || getAPIInstance()
47
- const response = await api.2fa_management.totpDevicesList(params?.page, params?.page_size)
47
+ const response = await api.totp_management.totpDevicesList(params?.page, params?.page_size)
48
48
  try {
49
49
  return PaginatedDeviceListListSchema.parse(response)
50
50
  } catch (error) {
@@ -101,7 +101,7 @@ export async function getTotpDevicesList( params?: { page?: number; page_size?:
101
101
  export async function createTotpDisableCreate( data: DisableRequest, client?: any
102
102
  ): Promise<any> {
103
103
  const api = client || getAPIInstance()
104
- const response = await api.2fa_management.totpDisableCreate(data)
104
+ const response = await api.totp_management.totpDisableCreate(data)
105
105
  return response
106
106
  }
107
107
 
@@ -1,6 +1,6 @@
1
1
  // Auto-generated by DjangoCFG - see CLAUDE.md
2
2
  /**
3
- * Typed fetchers for 2fa Setup
3
+ * Typed fetchers for TOTP Setup
4
4
  *
5
5
  * Universal functions that work in any environment:
6
6
  * - Next.js (App Router / Pages Router / Server Components)
@@ -46,7 +46,7 @@ import { getAPIInstance } from '../../api-instance'
46
46
  export async function createTotpSetupCreate( data: SetupRequest, client?: any
47
47
  ): Promise<SetupResponse> {
48
48
  const api = client || getAPIInstance()
49
- const response = await api.2fa_setup.totpSetupCreate(data)
49
+ const response = await api.totp_setup.create(data)
50
50
  try {
51
51
  return SetupResponseSchema.parse(response)
52
52
  } catch (error) {
@@ -103,7 +103,7 @@ export async function createTotpSetupCreate( data: SetupRequest, client?: any
103
103
  export async function createTotpSetupConfirmCreate( data: ConfirmSetupRequest, client?: any
104
104
  ): Promise<ConfirmSetupResponse> {
105
105
  const api = client || getAPIInstance()
106
- const response = await api.2fa_setup.totpSetupConfirmCreate(data)
106
+ const response = await api.totp_setup.confirmCreate(data)
107
107
  try {
108
108
  return ConfirmSetupResponseSchema.parse(response)
109
109
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  // Auto-generated by DjangoCFG - see CLAUDE.md
2
2
  /**
3
- * Typed fetchers for 2fa Verification
3
+ * Typed fetchers for TOTP Verification
4
4
  *
5
5
  * Universal functions that work in any environment:
6
6
  * - Next.js (App Router / Pages Router / Server Components)
@@ -45,7 +45,7 @@ import { getAPIInstance } from '../../api-instance'
45
45
  export async function createTotpVerifyCreate( data: VerifyRequest, client?: any
46
46
  ): Promise<VerifyResponse> {
47
47
  const api = client || getAPIInstance()
48
- const response = await api.2fa_verification.totpVerifyCreate(data)
48
+ const response = await api.totp_verification.totpVerifyCreate(data)
49
49
  try {
50
50
  return VerifyResponseSchema.parse(response)
51
51
  } catch (error) {
@@ -102,7 +102,7 @@ export async function createTotpVerifyCreate( data: VerifyRequest, client?: an
102
102
  export async function createTotpVerifyBackupCreate( data: VerifyBackupRequest, client?: any
103
103
  ): Promise<VerifyResponse> {
104
104
  const api = client || getAPIInstance()
105
- const response = await api.2fa_verification.totpVerifyBackupCreate(data)
105
+ const response = await api.totp_verification.totpVerifyBackupCreate(data)
106
106
  try {
107
107
  return VerifyResponseSchema.parse(response)
108
108
  } catch (error) {
@@ -26,8 +26,8 @@
26
26
  * ```
27
27
  */
28
28
 
29
- export * from './totp__2fa_management'
30
- export * from './totp__2fa_setup'
31
- export * from './totp__2fa_verification'
32
29
  export * from './totp__backup_codes'
30
+ export * from './totp__totp_management'
31
+ export * from './totp__totp_setup'
32
+ export * from './totp__totp_verification'
33
33
  export * from './totp'
@@ -2,7 +2,7 @@
2
2
  'use client';
3
3
 
4
4
  /**
5
- * SWR Hooks for 2fa Management
5
+ * SWR Hooks for TOTP Management
6
6
  *
7
7
  * React hooks powered by SWR for data fetching with automatic caching,
8
8
  * revalidation, and optimistic updates.
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import useSWR from 'swr'
21
21
  import { useSWRConfig } from 'swr'
22
- import * as Fetchers from '../fetchers/totp__2fa_management'
22
+ import * as Fetchers from '../fetchers/totp__totp_management'
23
23
  import type { API } from '../../index'
24
24
  import type { DisableRequest } from '../schemas/DisableRequest.schema'
25
25
  import type { PaginatedDeviceListList } from '../schemas/PaginatedDeviceListList.schema'
@@ -2,7 +2,7 @@
2
2
  'use client';
3
3
 
4
4
  /**
5
- * SWR Hooks for 2fa Setup
5
+ * SWR Hooks for TOTP Setup
6
6
  *
7
7
  * React hooks powered by SWR for data fetching with automatic caching,
8
8
  * revalidation, and optimistic updates.
@@ -18,7 +18,7 @@
18
18
  * ```
19
19
  */
20
20
  import { useSWRConfig } from 'swr'
21
- import * as Fetchers from '../fetchers/totp__2fa_setup'
21
+ import * as Fetchers from '../fetchers/totp__totp_setup'
22
22
  import type { API } from '../../index'
23
23
  import type { ConfirmSetupRequest } from '../schemas/ConfirmSetupRequest.schema'
24
24
  import type { ConfirmSetupResponse } from '../schemas/ConfirmSetupResponse.schema'
@@ -2,7 +2,7 @@
2
2
  'use client';
3
3
 
4
4
  /**
5
- * SWR Hooks for 2fa Verification
5
+ * SWR Hooks for TOTP Verification
6
6
  *
7
7
  * React hooks powered by SWR for data fetching with automatic caching,
8
8
  * revalidation, and optimistic updates.
@@ -18,7 +18,7 @@
18
18
  * ```
19
19
  */
20
20
  import { useSWRConfig } from 'swr'
21
- import * as Fetchers from '../fetchers/totp__2fa_verification'
21
+ import * as Fetchers from '../fetchers/totp__totp_verification'
22
22
  import type { API } from '../../index'
23
23
  import type { VerifyBackupRequest } from '../schemas/VerifyBackupRequest.schema'
24
24
  import type { VerifyRequest } from '../schemas/VerifyRequest.schema'
@@ -11,7 +11,7 @@ import * as Enums from '../../enums'
11
11
  * Serializer for listing TOTP devices.
12
12
  */
13
13
  export const DeviceListSchema = z.object({
14
- id: z.int(),
14
+ id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
15
15
  name: z.string(),
16
16
  is_primary: z.boolean(),
17
17
  status: z.nativeEnum(Enums.DeviceListStatus),
@@ -1,7 +1,7 @@
1
- import { 2faManagement } from "./totp__2fa_management";
2
- import { 2faSetup } from "./totp__2fa_setup";
3
- import { 2faVerification } from "./totp__2fa_verification";
4
1
  import { BackupCodes } from "./totp__backup_codes";
2
+ import { TotpManagement } from "./totp__totp_management";
3
+ import { TotpSetup } from "./totp__totp_setup";
4
+ import { TotpVerification } from "./totp__totp_verification";
5
5
  import { Totp } from "./totp";
6
6
  import { HttpClientAdapter, FetchAdapter } from "./http";
7
7
  import { APIError, NetworkError } from "./errors";
@@ -31,10 +31,10 @@ export class APIClient {
31
31
  private retryConfig: RetryConfig | null = null;
32
32
 
33
33
  // Sub-clients
34
- public 2fa_management: 2faManagement;
35
- public 2fa_setup: 2faSetup;
36
- public 2fa_verification: 2faVerification;
37
34
  public backup_codes: BackupCodes;
35
+ public totp_management: TotpManagement;
36
+ public totp_setup: TotpSetup;
37
+ public totp_verification: TotpVerification;
38
38
  public totp: Totp;
39
39
 
40
40
  constructor(
@@ -59,10 +59,10 @@ export class APIClient {
59
59
  }
60
60
 
61
61
  // Initialize sub-clients
62
- this.2fa_management = new 2faManagement(this);
63
- this.2fa_setup = new 2faSetup(this);
64
- this.2fa_verification = new 2faVerification(this);
65
62
  this.backup_codes = new BackupCodes(this);
63
+ this.totp_management = new TotpManagement(this);
64
+ this.totp_setup = new TotpSetup(this);
65
+ this.totp_verification = new TotpVerification(this);
66
66
  this.totp = new Totp(this);
67
67
  }
68
68
 
@@ -92,6 +92,7 @@ export class APIClient {
92
92
  params?: Record<string, any>;
93
93
  body?: any;
94
94
  formData?: FormData;
95
+ binaryBody?: Blob | ArrayBuffer;
95
96
  headers?: Record<string, string>;
96
97
  }
97
98
  ): Promise<T> {
@@ -128,6 +129,7 @@ export class APIClient {
128
129
  params?: Record<string, any>;
129
130
  body?: any;
130
131
  formData?: FormData;
132
+ binaryBody?: Blob | ArrayBuffer;
131
133
  headers?: Record<string, string>;
132
134
  }
133
135
  ): Promise<T> {
@@ -141,8 +143,8 @@ export class APIClient {
141
143
  ...(options?.headers || {})
142
144
  };
143
145
 
144
- // Don't set Content-Type for FormData (browser will set it with boundary)
145
- if (!options?.formData && !headers['Content-Type']) {
146
+ // Don't set Content-Type for FormData/binaryBody (browser will set it with boundary)
147
+ if (!options?.formData && !options?.binaryBody && !headers['Content-Type']) {
146
148
  headers['Content-Type'] = 'application/json';
147
149
  }
148
150
 
@@ -169,6 +171,7 @@ export class APIClient {
169
171
  params: options?.params,
170
172
  body: options?.body,
171
173
  formData: options?.formData,
174
+ binaryBody: options?.binaryBody,
172
175
  });
173
176
 
174
177
  const duration = Date.now() - startTime;
@@ -14,6 +14,8 @@ export interface HttpRequest {
14
14
  params?: Record<string, any>;
15
15
  /** FormData for file uploads (multipart/form-data) */
16
16
  formData?: FormData;
17
+ /** Binary data for octet-stream uploads */
18
+ binaryBody?: Blob | ArrayBuffer;
17
19
  }
18
20
 
19
21
  export interface HttpResponse<T = any> {
@@ -37,7 +39,7 @@ export interface HttpClientAdapter {
37
39
  */
38
40
  export class FetchAdapter implements HttpClientAdapter {
39
41
  async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {
40
- const { method, url, headers, body, params, formData } = request;
42
+ const { method, url, headers, body, params, formData, binaryBody } = request;
41
43
 
42
44
  // Build URL with query params
43
45
  let finalUrl = url;
@@ -58,12 +60,16 @@ export class FetchAdapter implements HttpClientAdapter {
58
60
  const finalHeaders: Record<string, string> = { ...headers };
59
61
 
60
62
  // Determine body and content-type
61
- let requestBody: string | FormData | undefined;
63
+ let requestBody: string | FormData | Blob | ArrayBuffer | undefined;
62
64
 
63
65
  if (formData) {
64
66
  // For multipart/form-data, let browser set Content-Type with boundary
65
67
  requestBody = formData;
66
68
  // Don't set Content-Type - browser will set it with boundary
69
+ } else if (binaryBody) {
70
+ // Binary upload (application/octet-stream)
71
+ finalHeaders['Content-Type'] = 'application/octet-stream';
72
+ requestBody = binaryBody;
67
73
  } else if (body) {
68
74
  // JSON request
69
75
  finalHeaders['Content-Type'] = 'application/json';
@@ -43,21 +43,21 @@ import {
43
43
  import type { RetryConfig } from "./retry";
44
44
  import type { LoggerConfig } from "./logger";
45
45
  import { APILogger } from "./logger";
46
- import { 2faManagement } from "./totp__2fa_management/client";
47
- import { 2faSetup } from "./totp__2fa_setup/client";
48
- import { 2faVerification } from "./totp__2fa_verification/client";
49
46
  import { BackupCodes } from "./totp__backup_codes/client";
47
+ import { TotpManagement } from "./totp__totp_management/client";
48
+ import { TotpSetup } from "./totp__totp_setup/client";
49
+ import { TotpVerification } from "./totp__totp_verification/client";
50
50
  import { Totp } from "./totp/client";
51
- export * as 2faManagementTypes from "./totp__2fa_management/models";
51
+ export * as BackupCodesTypes from "./totp__backup_codes/models";
52
52
  // Note: Direct exports (export * from) are removed to avoid duplicate type conflicts
53
53
  // Use namespace exports like CfgAccountsTypes.User or import from specific modules
54
- export * as 2faSetupTypes from "./totp__2fa_setup/models";
54
+ export * as TotpManagementTypes from "./totp__totp_management/models";
55
55
  // Note: Direct exports (export * from) are removed to avoid duplicate type conflicts
56
56
  // Use namespace exports like CfgAccountsTypes.User or import from specific modules
57
- export * as 2faVerificationTypes from "./totp__2fa_verification/models";
57
+ export * as TotpSetupTypes from "./totp__totp_setup/models";
58
58
  // Note: Direct exports (export * from) are removed to avoid duplicate type conflicts
59
59
  // Use namespace exports like CfgAccountsTypes.User or import from specific modules
60
- export * as BackupCodesTypes from "./totp__backup_codes/models";
60
+ export * as TotpVerificationTypes from "./totp__totp_verification/models";
61
61
  // Note: Direct exports (export * from) are removed to avoid duplicate type conflicts
62
62
  // Use namespace exports like CfgAccountsTypes.User or import from specific modules
63
63
  export * as TotpTypes from "./totp/models";
@@ -135,10 +135,10 @@ export class API {
135
135
  private options?: APIOptions;
136
136
 
137
137
  // Sub-clients
138
- public 2fa_management!: 2faManagement;
139
- public 2fa_setup!: 2faSetup;
140
- public 2fa_verification!: 2faVerification;
141
138
  public backup_codes!: BackupCodes;
139
+ public totp_management!: TotpManagement;
140
+ public totp_setup!: TotpSetup;
141
+ public totp_verification!: TotpVerification;
142
142
  public totp!: Totp;
143
143
 
144
144
  constructor(baseUrl: string, options?: APIOptions) {
@@ -163,10 +163,10 @@ export class API {
163
163
  this._injectAuthHeader();
164
164
 
165
165
  // Initialize sub-clients from APIClient
166
- this.2fa_management = this._client.2fa_management;
167
- this.2fa_setup = this._client.2fa_setup;
168
- this.2fa_verification = this._client.2fa_verification;
169
166
  this.backup_codes = this._client.backup_codes;
167
+ this.totp_management = this._client.totp_management;
168
+ this.totp_setup = this._client.totp_setup;
169
+ this.totp_verification = this._client.totp_verification;
170
170
  this.totp = this._client.totp;
171
171
  }
172
172
 
@@ -185,10 +185,10 @@ export class API {
185
185
  this._injectAuthHeader();
186
186
 
187
187
  // Reinitialize sub-clients
188
- this.2fa_management = this._client.2fa_management;
189
- this.2fa_setup = this._client.2fa_setup;
190
- this.2fa_verification = this._client.2fa_verification;
191
188
  this.backup_codes = this._client.backup_codes;
189
+ this.totp_management = this._client.totp_management;
190
+ this.totp_setup = this._client.totp_setup;
191
+ this.totp_verification = this._client.totp_verification;
192
192
  this.totp = this._client.totp;
193
193
  }
194
194
 
@@ -123,7 +123,7 @@
123
123
  }
124
124
  ],
125
125
  "tags": [
126
- "2FA Management"
126
+ "TOTP Management"
127
127
  ],
128
128
  "security": [
129
129
  {
@@ -181,7 +181,7 @@
181
181
  "operationId": "cfg_totp_disable_create",
182
182
  "description": "Completely disable 2FA for account.\n\nRequires verification code.",
183
183
  "tags": [
184
- "2FA Management"
184
+ "TOTP Management"
185
185
  ],
186
186
  "requestBody": {
187
187
  "content": {
@@ -238,7 +238,7 @@
238
238
  "operationId": "cfg_totp_setup_create",
239
239
  "description": "Start 2FA setup process.\n\nCreates a new TOTP device and returns QR code for scanning.",
240
240
  "tags": [
241
- "2FA Setup"
241
+ "TOTP Setup"
242
242
  ],
243
243
  "requestBody": {
244
244
  "content": {
@@ -294,7 +294,7 @@
294
294
  "operationId": "cfg_totp_setup_confirm_create",
295
295
  "description": "Confirm 2FA setup with first valid code.\n\nActivates the device and generates backup codes.",
296
296
  "tags": [
297
- "2FA Setup"
297
+ "TOTP Setup"
298
298
  ],
299
299
  "requestBody": {
300
300
  "content": {
@@ -351,7 +351,7 @@
351
351
  "operationId": "cfg_totp_verify_create",
352
352
  "description": "Verify TOTP code for 2FA session.\n\nCompletes authentication and returns JWT tokens on success.",
353
353
  "tags": [
354
- "2FA Verification"
354
+ "TOTP Verification"
355
355
  ],
356
356
  "requestBody": {
357
357
  "content": {
@@ -419,7 +419,7 @@
419
419
  "operationId": "cfg_totp_verify_backup_create",
420
420
  "description": "Verify backup recovery code for 2FA session.\n\nAlternative verification method when TOTP device unavailable.",
421
421
  "tags": [
422
- "2FA Verification"
422
+ "TOTP Verification"
423
423
  ],
424
424
  "requestBody": {
425
425
  "content": {
@@ -585,7 +585,8 @@
585
585
  "description": "Serializer for listing TOTP devices.",
586
586
  "properties": {
587
587
  "id": {
588
- "type": "integer",
588
+ "type": "string",
589
+ "format": "uuid",
589
590
  "readOnly": true
590
591
  },
591
592
  "name": {
@@ -2,9 +2,9 @@ import * as Models from "./models";
2
2
 
3
3
 
4
4
  /**
5
- * API endpoints for 2fa Management.
5
+ * API endpoints for TOTP Management.
6
6
  */
7
- export class 2faManagement {
7
+ export class TotpManagement {
8
8
  private client: any;
9
9
 
10
10
  constructor(client: any) {
@@ -42,7 +42,7 @@ export interface DisableRequest {
42
42
  * Response model (includes read-only fields).
43
43
  */
44
44
  export interface DeviceList {
45
- id: number;
45
+ id: string;
46
46
  /** Device name for identification */
47
47
  name: string;
48
48
  /** Primary device used for verification */
@@ -2,9 +2,9 @@ import * as Models from "./models";
2
2
 
3
3
 
4
4
  /**
5
- * API endpoints for 2fa Setup.
5
+ * API endpoints for TOTP Setup.
6
6
  */
7
- export class 2faSetup {
7
+ export class TotpSetup {
8
8
  private client: any;
9
9
 
10
10
  constructor(client: any) {
@@ -15,7 +15,7 @@ export class 2faSetup {
15
15
  * Start 2FA setup process. Creates a new TOTP device and returns QR code
16
16
  * for scanning.
17
17
  */
18
- async totpSetupCreate(data: Models.SetupRequest): Promise<Models.SetupResponse> {
18
+ async create(data: Models.SetupRequest): Promise<Models.SetupResponse> {
19
19
  const response = await this.client.request('POST', "/cfg/totp/setup/", { body: data });
20
20
  return response;
21
21
  }
@@ -24,7 +24,7 @@ export class 2faSetup {
24
24
  * Confirm 2FA setup with first valid code. Activates the device and
25
25
  * generates backup codes.
26
26
  */
27
- async totpSetupConfirmCreate(data: Models.ConfirmSetupRequest): Promise<Models.ConfirmSetupResponse> {
27
+ async confirmCreate(data: Models.ConfirmSetupRequest): Promise<Models.ConfirmSetupResponse> {
28
28
  const response = await this.client.request('POST', "/cfg/totp/setup/confirm/", { body: data });
29
29
  return response;
30
30
  }
@@ -2,9 +2,9 @@ import * as Models from "./models";
2
2
 
3
3
 
4
4
  /**
5
- * API endpoints for 2fa Verification.
5
+ * API endpoints for TOTP Verification.
6
6
  */
7
- export class 2faVerification {
7
+ export class TotpVerification {
8
8
  private client: any;
9
9
 
10
10
  constructor(client: any) {
@@ -80,6 +80,7 @@ export class APIClient {
80
80
  params?: Record<string, any>;
81
81
  body?: any;
82
82
  formData?: FormData;
83
+ binaryBody?: Blob | ArrayBuffer;
83
84
  headers?: Record<string, string>;
84
85
  }
85
86
  ): Promise<T> {
@@ -116,6 +117,7 @@ export class APIClient {
116
117
  params?: Record<string, any>;
117
118
  body?: any;
118
119
  formData?: FormData;
120
+ binaryBody?: Blob | ArrayBuffer;
119
121
  headers?: Record<string, string>;
120
122
  }
121
123
  ): Promise<T> {
@@ -129,8 +131,8 @@ export class APIClient {
129
131
  ...(options?.headers || {})
130
132
  };
131
133
 
132
- // Don't set Content-Type for FormData (browser will set it with boundary)
133
- if (!options?.formData && !headers['Content-Type']) {
134
+ // Don't set Content-Type for FormData/binaryBody (browser will set it with boundary)
135
+ if (!options?.formData && !options?.binaryBody && !headers['Content-Type']) {
134
136
  headers['Content-Type'] = 'application/json';
135
137
  }
136
138
 
@@ -157,6 +159,7 @@ export class APIClient {
157
159
  params: options?.params,
158
160
  body: options?.body,
159
161
  formData: options?.formData,
162
+ binaryBody: options?.binaryBody,
160
163
  });
161
164
 
162
165
  const duration = Date.now() - startTime;
@@ -14,6 +14,8 @@ export interface HttpRequest {
14
14
  params?: Record<string, any>;
15
15
  /** FormData for file uploads (multipart/form-data) */
16
16
  formData?: FormData;
17
+ /** Binary data for octet-stream uploads */
18
+ binaryBody?: Blob | ArrayBuffer;
17
19
  }
18
20
 
19
21
  export interface HttpResponse<T = any> {
@@ -37,7 +39,7 @@ export interface HttpClientAdapter {
37
39
  */
38
40
  export class FetchAdapter implements HttpClientAdapter {
39
41
  async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {
40
- const { method, url, headers, body, params, formData } = request;
42
+ const { method, url, headers, body, params, formData, binaryBody } = request;
41
43
 
42
44
  // Build URL with query params
43
45
  let finalUrl = url;
@@ -58,12 +60,16 @@ export class FetchAdapter implements HttpClientAdapter {
58
60
  const finalHeaders: Record<string, string> = { ...headers };
59
61
 
60
62
  // Determine body and content-type
61
- let requestBody: string | FormData | undefined;
63
+ let requestBody: string | FormData | Blob | ArrayBuffer | undefined;
62
64
 
63
65
  if (formData) {
64
66
  // For multipart/form-data, let browser set Content-Type with boundary
65
67
  requestBody = formData;
66
68
  // Don't set Content-Type - browser will set it with boundary
69
+ } else if (binaryBody) {
70
+ // Binary upload (application/octet-stream)
71
+ finalHeaders['Content-Type'] = 'application/octet-stream';
72
+ requestBody = binaryBody;
67
73
  } else if (body) {
68
74
  // JSON request
69
75
  finalHeaders['Content-Type'] = 'application/json';