sendblue 3.6.1 → 3.8.0

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 (129) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client.d.mts +6 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/internal/utils/env.js +2 -2
  11. package/internal/utils/env.js.map +1 -1
  12. package/internal/utils/env.mjs +2 -2
  13. package/internal/utils/env.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/index.d.mts +2 -0
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +2 -0
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +5 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +2 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/lines/call-forwarding.d.mts +94 -0
  24. package/resources/lines/call-forwarding.d.mts.map +1 -0
  25. package/resources/lines/call-forwarding.d.ts +94 -0
  26. package/resources/lines/call-forwarding.d.ts.map +1 -0
  27. package/resources/lines/call-forwarding.js +65 -0
  28. package/resources/lines/call-forwarding.js.map +1 -0
  29. package/resources/lines/call-forwarding.mjs +61 -0
  30. package/resources/lines/call-forwarding.mjs.map +1 -0
  31. package/resources/lines/index.d.mts +3 -0
  32. package/resources/lines/index.d.mts.map +1 -0
  33. package/resources/lines/index.d.ts +3 -0
  34. package/resources/lines/index.d.ts.map +1 -0
  35. package/resources/lines/index.js +9 -0
  36. package/resources/lines/index.js.map +1 -0
  37. package/resources/lines/index.mjs +4 -0
  38. package/resources/lines/index.mjs.map +1 -0
  39. package/resources/lines/lines.d.mts +10 -0
  40. package/resources/lines/lines.d.mts.map +1 -0
  41. package/resources/lines/lines.d.ts +10 -0
  42. package/resources/lines/lines.d.ts.map +1 -0
  43. package/resources/lines/lines.js +17 -0
  44. package/resources/lines/lines.js.map +1 -0
  45. package/resources/lines/lines.mjs +12 -0
  46. package/resources/lines/lines.mjs.map +1 -0
  47. package/resources/lines.d.mts +2 -0
  48. package/resources/lines.d.mts.map +1 -0
  49. package/resources/lines.d.ts +2 -0
  50. package/resources/lines.d.ts.map +1 -0
  51. package/resources/lines.js +6 -0
  52. package/resources/lines.js.map +1 -0
  53. package/resources/lines.mjs +3 -0
  54. package/resources/lines.mjs.map +1 -0
  55. package/resources/v2/index.d.mts +3 -0
  56. package/resources/v2/index.d.mts.map +1 -0
  57. package/resources/v2/index.d.ts +3 -0
  58. package/resources/v2/index.d.ts.map +1 -0
  59. package/resources/v2/index.js +9 -0
  60. package/resources/v2/index.js.map +1 -0
  61. package/resources/v2/index.mjs +4 -0
  62. package/resources/v2/index.mjs.map +1 -0
  63. package/resources/v2/totp/index.d.mts +3 -0
  64. package/resources/v2/totp/index.d.mts.map +1 -0
  65. package/resources/v2/totp/index.d.ts +3 -0
  66. package/resources/v2/totp/index.d.ts.map +1 -0
  67. package/resources/v2/totp/index.js +9 -0
  68. package/resources/v2/totp/index.js.map +1 -0
  69. package/resources/v2/totp/index.mjs +4 -0
  70. package/resources/v2/totp/index.mjs.map +1 -0
  71. package/resources/v2/totp/secrets.d.mts +159 -0
  72. package/resources/v2/totp/secrets.d.mts.map +1 -0
  73. package/resources/v2/totp/secrets.d.ts +159 -0
  74. package/resources/v2/totp/secrets.d.ts.map +1 -0
  75. package/resources/v2/totp/secrets.js +57 -0
  76. package/resources/v2/totp/secrets.js.map +1 -0
  77. package/resources/v2/totp/secrets.mjs +53 -0
  78. package/resources/v2/totp/secrets.mjs.map +1 -0
  79. package/resources/v2/totp/totp.d.mts +39 -0
  80. package/resources/v2/totp/totp.d.mts.map +1 -0
  81. package/resources/v2/totp/totp.d.ts +39 -0
  82. package/resources/v2/totp/totp.d.ts.map +1 -0
  83. package/resources/v2/totp/totp.js +35 -0
  84. package/resources/v2/totp/totp.js.map +1 -0
  85. package/resources/v2/totp/totp.mjs +30 -0
  86. package/resources/v2/totp/totp.mjs.map +1 -0
  87. package/resources/v2/totp.d.mts +2 -0
  88. package/resources/v2/totp.d.mts.map +1 -0
  89. package/resources/v2/totp.d.ts +2 -0
  90. package/resources/v2/totp.d.ts.map +1 -0
  91. package/resources/v2/totp.js +6 -0
  92. package/resources/v2/totp.js.map +1 -0
  93. package/resources/v2/totp.mjs +3 -0
  94. package/resources/v2/totp.mjs.map +1 -0
  95. package/resources/v2/v2.d.mts +10 -0
  96. package/resources/v2/v2.d.mts.map +1 -0
  97. package/resources/v2/v2.d.ts +10 -0
  98. package/resources/v2/v2.d.ts.map +1 -0
  99. package/resources/v2/v2.js +17 -0
  100. package/resources/v2/v2.js.map +1 -0
  101. package/resources/v2/v2.mjs +12 -0
  102. package/resources/v2/v2.mjs.map +1 -0
  103. package/resources/v2.d.mts +2 -0
  104. package/resources/v2.d.mts.map +1 -0
  105. package/resources/v2.d.ts +2 -0
  106. package/resources/v2.d.ts.map +1 -0
  107. package/resources/v2.js +6 -0
  108. package/resources/v2.js.map +1 -0
  109. package/resources/v2.mjs +3 -0
  110. package/resources/v2.mjs.map +1 -0
  111. package/src/client.ts +10 -0
  112. package/src/internal/utils/env.ts +2 -2
  113. package/src/resources/index.ts +2 -0
  114. package/src/resources/lines/call-forwarding.ts +122 -0
  115. package/src/resources/lines/index.ts +10 -0
  116. package/src/resources/lines/lines.ts +27 -0
  117. package/src/resources/lines.ts +3 -0
  118. package/src/resources/v2/index.ts +4 -0
  119. package/src/resources/v2/totp/index.ts +10 -0
  120. package/src/resources/v2/totp/secrets.ts +204 -0
  121. package/src/resources/v2/totp/totp.ts +64 -0
  122. package/src/resources/v2/totp.ts +3 -0
  123. package/src/resources/v2/v2.ts +15 -0
  124. package/src/resources/v2.ts +3 -0
  125. package/src/version.ts +1 -1
  126. package/version.d.mts +1 -1
  127. package/version.d.ts +1 -1
  128. package/version.js +1 -1
  129. package/version.mjs +1 -1
@@ -0,0 +1,10 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as TotpAPI from "./totp/totp.js";
3
+ import { Totp, TotpGetCodeResponse } from "./totp/totp.js";
4
+ export declare class V2 extends APIResource {
5
+ totp: TotpAPI.Totp;
6
+ }
7
+ export declare namespace V2 {
8
+ export { Totp as Totp, type TotpGetCodeResponse as TotpGetCodeResponse };
9
+ }
10
+ //# sourceMappingURL=v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/resources/v2/v2.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAE,mBAAmB,EAAE;AAEpC,qBAAa,EAAG,SAAQ,WAAW;IACjC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;CACrD;AAID,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC1E"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.V2 = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const TotpAPI = tslib_1.__importStar(require("./totp/totp.js"));
8
+ const totp_1 = require("./totp/totp.js");
9
+ class V2 extends resource_1.APIResource {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.totp = new TotpAPI.Totp(this._client);
13
+ }
14
+ }
15
+ exports.V2 = V2;
16
+ V2.Totp = totp_1.Totp;
17
+ //# sourceMappingURL=v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.js","sourceRoot":"","sources":["../../src/resources/v2/v2.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,gEAAuC;AACvC,yCAAwD;AAExD,MAAa,EAAG,SAAQ,sBAAW;IAAnC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAFD,gBAEC;AAED,EAAE,CAAC,IAAI,GAAG,WAAI,CAAC"}
@@ -0,0 +1,12 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as TotpAPI from "./totp/totp.mjs";
4
+ import { Totp } from "./totp/totp.mjs";
5
+ export class V2 extends APIResource {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.totp = new TotpAPI.Totp(this._client);
9
+ }
10
+ }
11
+ V2.Totp = Totp;
12
+ //# sourceMappingURL=v2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.mjs","sourceRoot":"","sources":["../../src/resources/v2/v2.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAuB;AAEpC,MAAM,OAAO,EAAG,SAAQ,WAAW;IAAnC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAED,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./v2/index.mjs";
2
+ //# sourceMappingURL=v2.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.d.mts","sourceRoot":"","sources":["../src/resources/v2.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./v2/index.js";
2
+ //# sourceMappingURL=v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../src/resources/v2.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("../internal/tslib.js");
5
+ tslib_1.__exportStar(require("./v2/index.js"), exports);
6
+ //# sourceMappingURL=v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.js","sourceRoot":"","sources":["../src/resources/v2.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAA2B"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./v2/index.mjs";
3
+ //# sourceMappingURL=v2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.mjs","sourceRoot":"","sources":["../src/resources/v2.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
package/src/client.ts CHANGED
@@ -64,6 +64,8 @@ import {
64
64
  ContactVerifyResponse,
65
65
  Contacts,
66
66
  } from './resources/contacts/contacts';
67
+ import { Lines } from './resources/lines/lines';
68
+ import { V2 } from './resources/v2/v2';
67
69
  import { type Fetch } from './internal/builtin-types';
68
70
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
69
71
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -820,6 +822,8 @@ export class SendblueAPI {
820
822
  * Operations for sending and managing messages
821
823
  */
822
824
  sendCarousel: API.SendCarousel = new API.SendCarousel(this);
825
+ v2: API.V2 = new API.V2(this);
826
+ lines: API.Lines = new API.Lines(this);
823
827
  }
824
828
 
825
829
  SendblueAPI.Messages = Messages;
@@ -830,6 +834,8 @@ SendblueAPI.TypingIndicators = TypingIndicators;
830
834
  SendblueAPI.Contacts = Contacts;
831
835
  SendblueAPI.Webhooks = Webhooks;
832
836
  SendblueAPI.SendCarousel = SendCarousel;
837
+ SendblueAPI.V2 = V2;
838
+ SendblueAPI.Lines = Lines;
833
839
 
834
840
  export declare namespace SendblueAPI {
835
841
  export type RequestOptions = Opts.RequestOptions;
@@ -905,4 +911,8 @@ export declare namespace SendblueAPI {
905
911
  type SendCarouselSendResponse as SendCarouselSendResponse,
906
912
  type SendCarouselSendParams as SendCarouselSendParams,
907
913
  };
914
+
915
+ export { V2 as V2 };
916
+
917
+ export { Lines as Lines };
908
918
  }
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -23,6 +23,7 @@ export {
23
23
  type GroupModifyParams,
24
24
  type GroupSendMessageParams,
25
25
  } from './groups';
26
+ export { Lines } from './lines/lines';
26
27
  export { Lookups, type LookupLookupNumberResponse, type LookupLookupNumberParams } from './lookups';
27
28
  export { MediaObjects, type MediaObjectUploadResponse, type MediaObjectUploadParams } from './media-objects';
28
29
  export {
@@ -41,6 +42,7 @@ export {
41
42
  type TypingIndicatorSendResponse,
42
43
  type TypingIndicatorSendParams,
43
44
  } from './typing-indicators';
45
+ export { V2 } from './v2/v2';
44
46
  export {
45
47
  Webhooks,
46
48
  type WebhookConfiguration,
@@ -0,0 +1,122 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class CallForwarding extends APIResource {
9
+ /**
10
+ * Returns the current call forwarding number for a dedicated phone line.
11
+ *
12
+ * Per-line forwarding takes priority over the company default forwarding number
13
+ * but is overridden by seat-level forwarding when a seat has a forwarding number
14
+ * set.
15
+ *
16
+ * **Priority order:** seat forwarding → per-line forwarding → company default
17
+ * forwarding
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const callForwarding =
22
+ * await client.lines.callForwarding.retrieve(
23
+ * '+12125550101',
24
+ * );
25
+ * ```
26
+ */
27
+ retrieve(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingRetrieveResponse> {
28
+ return this._client.get(path`/api/lines/${sendblueNumber}/call-forwarding`, options);
29
+ }
30
+
31
+ /**
32
+ * Sets a call forwarding number for a specific dedicated phone line. Inbound calls
33
+ * to this line will be forwarded to the specified number.
34
+ *
35
+ * The `forwarding_number` is normalized to E.164 format before storage. US numbers
36
+ * can be supplied in local format (e.g. `2125550199`).
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const callForwarding =
41
+ * await client.lines.callForwarding.update('+12125550101', {
42
+ * forwarding_number: '+16692138010',
43
+ * });
44
+ * ```
45
+ */
46
+ update(
47
+ sendblueNumber: string,
48
+ body: CallForwardingUpdateParams,
49
+ options?: RequestOptions,
50
+ ): APIPromise<CallForwardingUpdateResponse> {
51
+ return this._client.put(path`/api/lines/${sendblueNumber}/call-forwarding`, { body, ...options });
52
+ }
53
+
54
+ /**
55
+ * Removes the per-line call forwarding number. After clearing, inbound calls will
56
+ * fall back to the company default forwarding number (if configured).
57
+ *
58
+ * This operation is idempotent — calling it on a line with no forwarding set
59
+ * returns 200 with `forwarding_number: null`.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const callForwarding =
64
+ * await client.lines.callForwarding.delete('+12125550101');
65
+ * ```
66
+ */
67
+ delete(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingDeleteResponse> {
68
+ return this._client.delete(path`/api/lines/${sendblueNumber}/call-forwarding`, options);
69
+ }
70
+ }
71
+
72
+ export interface CallForwardingRetrieveResponse {
73
+ /**
74
+ * The number calls are forwarded to, or null if not set
75
+ */
76
+ forwarding_number: string | null;
77
+
78
+ /**
79
+ * The Sendblue phone number (E.164)
80
+ */
81
+ sendblue_number: string;
82
+ }
83
+
84
+ export interface CallForwardingUpdateResponse {
85
+ /**
86
+ * The number calls are forwarded to, or null if not set
87
+ */
88
+ forwarding_number: string | null;
89
+
90
+ /**
91
+ * The Sendblue phone number (E.164)
92
+ */
93
+ sendblue_number: string;
94
+ }
95
+
96
+ export interface CallForwardingDeleteResponse {
97
+ /**
98
+ * The number calls are forwarded to, or null if not set
99
+ */
100
+ forwarding_number: string | null;
101
+
102
+ /**
103
+ * The Sendblue phone number (E.164)
104
+ */
105
+ sendblue_number: string;
106
+ }
107
+
108
+ export interface CallForwardingUpdateParams {
109
+ /**
110
+ * Phone number to forward calls to (E.164 or US local format)
111
+ */
112
+ forwarding_number: string;
113
+ }
114
+
115
+ export declare namespace CallForwarding {
116
+ export {
117
+ type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse,
118
+ type CallForwardingUpdateResponse as CallForwardingUpdateResponse,
119
+ type CallForwardingDeleteResponse as CallForwardingDeleteResponse,
120
+ type CallForwardingUpdateParams as CallForwardingUpdateParams,
121
+ };
122
+ }
@@ -0,0 +1,10 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ CallForwarding,
5
+ type CallForwardingRetrieveResponse,
6
+ type CallForwardingUpdateResponse,
7
+ type CallForwardingDeleteResponse,
8
+ type CallForwardingUpdateParams,
9
+ } from './call-forwarding';
10
+ export { Lines } from './lines';
@@ -0,0 +1,27 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as CallForwardingAPI from './call-forwarding';
5
+ import {
6
+ CallForwarding,
7
+ CallForwardingDeleteResponse,
8
+ CallForwardingRetrieveResponse,
9
+ CallForwardingUpdateParams,
10
+ CallForwardingUpdateResponse,
11
+ } from './call-forwarding';
12
+
13
+ export class Lines extends APIResource {
14
+ callForwarding: CallForwardingAPI.CallForwarding = new CallForwardingAPI.CallForwarding(this._client);
15
+ }
16
+
17
+ Lines.CallForwarding = CallForwarding;
18
+
19
+ export declare namespace Lines {
20
+ export {
21
+ CallForwarding as CallForwarding,
22
+ type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse,
23
+ type CallForwardingUpdateResponse as CallForwardingUpdateResponse,
24
+ type CallForwardingDeleteResponse as CallForwardingDeleteResponse,
25
+ type CallForwardingUpdateParams as CallForwardingUpdateParams,
26
+ };
27
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './lines/index';
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Totp, type TotpGetCodeResponse } from './totp/index';
4
+ export { V2 } from './v2';
@@ -0,0 +1,10 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Secrets,
5
+ type SecretCreateResponse,
6
+ type SecretListResponse,
7
+ type SecretDeleteResponse,
8
+ type SecretCreateParams,
9
+ } from './secrets';
10
+ export { Totp, type TotpGetCodeResponse } from './totp';
@@ -0,0 +1,204 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+ import { path } from '../../../internal/utils/path';
7
+
8
+ /**
9
+ * Store and retrieve TOTP codes for agent 2FA (authenticator app replacement)
10
+ */
11
+ export class Secrets extends APIResource {
12
+ /**
13
+ * Store an encrypted TOTP secret for your account. Agents can use this instead of
14
+ * a phone-based authenticator app.
15
+ *
16
+ * Provide either:
17
+ *
18
+ * - A `uri` (the `otpauth://` URI from a QR code scan), which auto-populates all
19
+ * fields
20
+ * - A base32 `secret` with optional `label`, `issuer`, `algorithm`, `digits`, and
21
+ * `period`
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const secret = await client.v2.totp.secrets.create();
26
+ * ```
27
+ */
28
+ create(body: SecretCreateParams, options?: RequestOptions): APIPromise<SecretCreateResponse> {
29
+ return this._client.post('/api/v2/totp/secrets', { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * List all stored TOTP secrets for the account. The encrypted secret values are
34
+ * never returned.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const secrets = await client.v2.totp.secrets.list();
39
+ * ```
40
+ */
41
+ list(options?: RequestOptions): APIPromise<SecretListResponse> {
42
+ return this._client.get('/api/v2/totp/secrets', options);
43
+ }
44
+
45
+ /**
46
+ * Permanently delete a stored TOTP secret.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const secret = await client.v2.totp.secrets.delete(
51
+ * '550e8400-e29b-41d4-a716-446655440000',
52
+ * );
53
+ * ```
54
+ */
55
+ delete(secretID: string, options?: RequestOptions): APIPromise<SecretDeleteResponse> {
56
+ return this._client.delete(path`/api/v2/totp/secrets/${secretID}`, options);
57
+ }
58
+ }
59
+
60
+ export interface SecretCreateResponse {
61
+ status?: string;
62
+
63
+ totp_secret?: SecretCreateResponse.TotpSecret;
64
+ }
65
+
66
+ export namespace SecretCreateResponse {
67
+ export interface TotpSecret {
68
+ /**
69
+ * Unique identifier for this TOTP secret
70
+ */
71
+ id?: string;
72
+
73
+ /**
74
+ * Hash algorithm used
75
+ */
76
+ algorithm?: 'SHA1' | 'SHA256' | 'SHA512';
77
+
78
+ created_at?: string;
79
+
80
+ /**
81
+ * Code length (6 or 8)
82
+ */
83
+ digits?: number;
84
+
85
+ /**
86
+ * Service name
87
+ */
88
+ issuer?: string | null;
89
+
90
+ /**
91
+ * Human-readable label
92
+ */
93
+ label?: string;
94
+
95
+ /**
96
+ * Rotation period in seconds
97
+ */
98
+ period?: number;
99
+
100
+ /**
101
+ * Base32 secret — only returned on creation, never on list/get
102
+ */
103
+ secret?: string;
104
+ }
105
+ }
106
+
107
+ export interface SecretListResponse {
108
+ status?: string;
109
+
110
+ totp_secrets?: Array<SecretListResponse.TotpSecret>;
111
+ }
112
+
113
+ export namespace SecretListResponse {
114
+ export interface TotpSecret {
115
+ /**
116
+ * Unique identifier for this TOTP secret
117
+ */
118
+ id?: string;
119
+
120
+ /**
121
+ * Hash algorithm used
122
+ */
123
+ algorithm?: 'SHA1' | 'SHA256' | 'SHA512';
124
+
125
+ created_at?: string;
126
+
127
+ /**
128
+ * Code length (6 or 8)
129
+ */
130
+ digits?: number;
131
+
132
+ /**
133
+ * Service name
134
+ */
135
+ issuer?: string | null;
136
+
137
+ /**
138
+ * Human-readable label
139
+ */
140
+ label?: string;
141
+
142
+ /**
143
+ * Rotation period in seconds
144
+ */
145
+ period?: number;
146
+
147
+ /**
148
+ * Base32 secret — only returned on creation, never on list/get
149
+ */
150
+ secret?: string;
151
+ }
152
+ }
153
+
154
+ export interface SecretDeleteResponse {
155
+ status?: string;
156
+ }
157
+
158
+ export interface SecretCreateParams {
159
+ /**
160
+ * Hash algorithm
161
+ */
162
+ algorithm?: 'SHA1' | 'SHA256' | 'SHA512';
163
+
164
+ /**
165
+ * Code length
166
+ */
167
+ digits?: 6 | 8;
168
+
169
+ /**
170
+ * Service name (e.g. "GitHub", "Google")
171
+ */
172
+ issuer?: string;
173
+
174
+ /**
175
+ * Human-readable label for this secret (e.g. "GitHub - agent@example.com").
176
+ * Required unless `uri` is provided.
177
+ */
178
+ label?: string;
179
+
180
+ /**
181
+ * Rotation period in seconds
182
+ */
183
+ period?: number;
184
+
185
+ /**
186
+ * Base32-encoded TOTP secret. Omit to auto-generate one.
187
+ */
188
+ secret?: string;
189
+
190
+ /**
191
+ * Full `otpauth://totp/...` URI from a QR code. Overrides all other fields if
192
+ * provided.
193
+ */
194
+ uri?: string;
195
+ }
196
+
197
+ export declare namespace Secrets {
198
+ export {
199
+ type SecretCreateResponse as SecretCreateResponse,
200
+ type SecretListResponse as SecretListResponse,
201
+ type SecretDeleteResponse as SecretDeleteResponse,
202
+ type SecretCreateParams as SecretCreateParams,
203
+ };
204
+ }
@@ -0,0 +1,64 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as SecretsAPI from './secrets';
5
+ import {
6
+ SecretCreateParams,
7
+ SecretCreateResponse,
8
+ SecretDeleteResponse,
9
+ SecretListResponse,
10
+ Secrets,
11
+ } from './secrets';
12
+ import { APIPromise } from '../../../core/api-promise';
13
+ import { RequestOptions } from '../../../internal/request-options';
14
+ import { path } from '../../../internal/utils/path';
15
+
16
+ /**
17
+ * Store and retrieve TOTP codes for agent 2FA (authenticator app replacement)
18
+ */
19
+ export class Totp extends APIResource {
20
+ secrets: SecretsAPI.Secrets = new SecretsAPI.Secrets(this._client);
21
+
22
+ /**
23
+ * Generate the current 6- or 8-digit TOTP code for a stored secret, along with how
24
+ * many seconds remain until it rotates.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const response = await client.v2.totp.getCode(
29
+ * '550e8400-e29b-41d4-a716-446655440000',
30
+ * );
31
+ * ```
32
+ */
33
+ getCode(secretID: string, options?: RequestOptions): APIPromise<TotpGetCodeResponse> {
34
+ return this._client.get(path`/api/v2/totp/code/${secretID}`, options);
35
+ }
36
+ }
37
+
38
+ export interface TotpGetCodeResponse {
39
+ /**
40
+ * The current TOTP code
41
+ */
42
+ code?: string;
43
+
44
+ /**
45
+ * Seconds until this code rotates
46
+ */
47
+ expires_in?: number;
48
+
49
+ status?: string;
50
+ }
51
+
52
+ Totp.Secrets = Secrets;
53
+
54
+ export declare namespace Totp {
55
+ export { type TotpGetCodeResponse as TotpGetCodeResponse };
56
+
57
+ export {
58
+ Secrets as Secrets,
59
+ type SecretCreateResponse as SecretCreateResponse,
60
+ type SecretListResponse as SecretListResponse,
61
+ type SecretDeleteResponse as SecretDeleteResponse,
62
+ type SecretCreateParams as SecretCreateParams,
63
+ };
64
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './totp/index';
@@ -0,0 +1,15 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as TotpAPI from './totp/totp';
5
+ import { Totp, TotpGetCodeResponse } from './totp/totp';
6
+
7
+ export class V2 extends APIResource {
8
+ totp: TotpAPI.Totp = new TotpAPI.Totp(this._client);
9
+ }
10
+
11
+ V2.Totp = Totp;
12
+
13
+ export declare namespace V2 {
14
+ export { Totp as Totp, type TotpGetCodeResponse as TotpGetCodeResponse };
15
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './v2/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.6.1'; // x-release-please-version
1
+ export const VERSION = '3.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.6.1";
1
+ export declare const VERSION = "3.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.6.1";
1
+ export declare const VERSION = "3.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.6.1'; // x-release-please-version
4
+ exports.VERSION = '3.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.6.1'; // x-release-please-version
1
+ export const VERSION = '3.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map