agentphone 1.0.4 → 1.0.6

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 (137) hide show
  1. package/README.md +10 -10
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +4 -1
  4. package/dist/cjs/Client.js +24 -19
  5. package/dist/cjs/api/resources/agentSignup/client/Client.d.ts +50 -0
  6. package/dist/cjs/api/resources/agentSignup/client/Client.js +170 -0
  7. package/dist/cjs/api/resources/agentSignup/client/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/agentSignup/client/index.js +17 -0
  9. package/dist/cjs/api/resources/agentSignup/client/requests/AgentSignUpRequest.d.ts +10 -0
  10. package/dist/cjs/api/resources/agentSignup/client/requests/AgentSignUpRequest.js +3 -0
  11. package/dist/cjs/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.ts +11 -0
  12. package/dist/cjs/api/resources/agentSignup/client/requests/AgentVerifyRequest.js +3 -0
  13. package/dist/cjs/api/resources/agentSignup/client/requests/index.d.ts +2 -0
  14. package/dist/cjs/api/resources/agentSignup/client/requests/index.js +2 -0
  15. package/dist/cjs/api/resources/agentSignup/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/agentSignup/index.js +17 -0
  17. package/dist/cjs/api/resources/agentWebhooks/client/Client.d.ts +1 -1
  18. package/dist/cjs/api/resources/agentWebhooks/client/Client.js +6 -6
  19. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  20. package/dist/cjs/api/resources/agents/client/Client.js +11 -11
  21. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +41 -2
  22. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.js +30 -0
  23. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +41 -2
  24. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +30 -0
  25. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +2 -2
  26. package/dist/cjs/api/resources/agents/client/requests/index.js +5 -0
  27. package/dist/cjs/api/resources/calls/client/Client.d.ts +27 -1
  28. package/dist/cjs/api/resources/calls/client/Client.js +69 -8
  29. package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +2 -0
  30. package/dist/cjs/api/resources/calls/client/requests/CreateWebCallRequest.d.ts +2 -0
  31. package/dist/cjs/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.d.ts +9 -0
  32. package/dist/cjs/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.js +3 -0
  33. package/dist/cjs/api/resources/calls/client/requests/index.d.ts +1 -0
  34. package/dist/cjs/api/resources/contacts/client/Client.d.ts +1 -1
  35. package/dist/cjs/api/resources/contacts/client/Client.js +6 -6
  36. package/dist/cjs/api/resources/conversations/client/Client.d.ts +20 -1
  37. package/dist/cjs/api/resources/conversations/client/Client.js +60 -5
  38. package/dist/cjs/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.d.ts +9 -0
  39. package/dist/cjs/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.js +3 -0
  40. package/dist/cjs/api/resources/conversations/client/requests/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/index.d.ts +2 -0
  42. package/dist/cjs/api/resources/index.js +3 -1
  43. package/dist/cjs/api/resources/messages/client/Client.d.ts +1 -1
  44. package/dist/cjs/api/resources/messages/client/Client.js +3 -3
  45. package/dist/cjs/api/resources/numbers/client/Client.d.ts +1 -1
  46. package/dist/cjs/api/resources/numbers/client/Client.js +5 -5
  47. package/dist/cjs/api/resources/usage/client/Client.d.ts +11 -1
  48. package/dist/cjs/api/resources/usage/client/Client.js +44 -4
  49. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +1 -1
  50. package/dist/cjs/api/resources/webhooks/client/Client.js +8 -8
  51. package/dist/cjs/api/types/AgentResponse.d.ts +41 -2
  52. package/dist/cjs/api/types/AgentResponse.js +30 -0
  53. package/dist/cjs/api/types/MessageInConversation.d.ts +2 -0
  54. package/dist/cjs/api/types/NumberUsageItem.d.ts +10 -0
  55. package/dist/cjs/api/types/NumberUsageItem.js +3 -0
  56. package/dist/cjs/api/types/NumberUsageResponse.d.ts +4 -0
  57. package/dist/cjs/api/types/NumberUsageResponse.js +3 -0
  58. package/dist/cjs/api/types/ReactionInConversation.d.ts +7 -0
  59. package/dist/cjs/api/types/ReactionInConversation.js +3 -0
  60. package/dist/cjs/api/types/SendTypingResponse.d.ts +5 -0
  61. package/dist/cjs/api/types/SendTypingResponse.js +3 -0
  62. package/dist/cjs/api/types/index.d.ts +4 -0
  63. package/dist/cjs/api/types/index.js +4 -0
  64. package/dist/cjs/auth/BearerAuthProvider.d.ts +1 -1
  65. package/dist/cjs/environments.d.ts +2 -2
  66. package/dist/cjs/environments.js +1 -1
  67. package/dist/cjs/version.d.ts +1 -1
  68. package/dist/cjs/version.js +1 -1
  69. package/dist/esm/BaseClient.mjs +2 -2
  70. package/dist/esm/Client.d.mts +4 -1
  71. package/dist/esm/Client.mjs +6 -1
  72. package/dist/esm/api/resources/agentSignup/client/Client.d.mts +50 -0
  73. package/dist/esm/api/resources/agentSignup/client/Client.mjs +133 -0
  74. package/dist/esm/api/resources/agentSignup/client/index.d.mts +1 -0
  75. package/dist/esm/api/resources/agentSignup/client/index.mjs +1 -0
  76. package/dist/esm/api/resources/agentSignup/client/requests/AgentSignUpRequest.d.mts +10 -0
  77. package/dist/esm/api/resources/agentSignup/client/requests/AgentSignUpRequest.mjs +2 -0
  78. package/dist/esm/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.mts +11 -0
  79. package/dist/esm/api/resources/agentSignup/client/requests/AgentVerifyRequest.mjs +2 -0
  80. package/dist/esm/api/resources/agentSignup/client/requests/index.d.mts +2 -0
  81. package/dist/esm/api/resources/agentSignup/client/requests/index.mjs +1 -0
  82. package/dist/esm/api/resources/agentSignup/index.d.mts +1 -0
  83. package/dist/esm/api/resources/agentSignup/index.mjs +1 -0
  84. package/dist/esm/api/resources/agentWebhooks/client/Client.d.mts +1 -1
  85. package/dist/esm/api/resources/agentWebhooks/client/Client.mjs +6 -6
  86. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  87. package/dist/esm/api/resources/agents/client/Client.mjs +11 -11
  88. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +41 -2
  89. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.mjs +29 -1
  90. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +41 -2
  91. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +29 -1
  92. package/dist/esm/api/resources/agents/client/requests/index.d.mts +2 -2
  93. package/dist/esm/api/resources/agents/client/requests/index.mjs +2 -1
  94. package/dist/esm/api/resources/calls/client/Client.d.mts +27 -1
  95. package/dist/esm/api/resources/calls/client/Client.mjs +69 -8
  96. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
  97. package/dist/esm/api/resources/calls/client/requests/CreateWebCallRequest.d.mts +2 -0
  98. package/dist/esm/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.d.mts +9 -0
  99. package/dist/esm/api/resources/calls/client/requests/GetCallRecordingV1CallsCallIdRecordingGetRequest.mjs +2 -0
  100. package/dist/esm/api/resources/calls/client/requests/index.d.mts +1 -0
  101. package/dist/esm/api/resources/contacts/client/Client.d.mts +1 -1
  102. package/dist/esm/api/resources/contacts/client/Client.mjs +6 -6
  103. package/dist/esm/api/resources/conversations/client/Client.d.mts +20 -1
  104. package/dist/esm/api/resources/conversations/client/Client.mjs +60 -5
  105. package/dist/esm/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.d.mts +9 -0
  106. package/dist/esm/api/resources/conversations/client/requests/SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.mjs +2 -0
  107. package/dist/esm/api/resources/conversations/client/requests/index.d.mts +1 -0
  108. package/dist/esm/api/resources/index.d.mts +2 -0
  109. package/dist/esm/api/resources/index.mjs +2 -0
  110. package/dist/esm/api/resources/messages/client/Client.d.mts +1 -1
  111. package/dist/esm/api/resources/messages/client/Client.mjs +3 -3
  112. package/dist/esm/api/resources/numbers/client/Client.d.mts +1 -1
  113. package/dist/esm/api/resources/numbers/client/Client.mjs +5 -5
  114. package/dist/esm/api/resources/usage/client/Client.d.mts +11 -1
  115. package/dist/esm/api/resources/usage/client/Client.mjs +44 -4
  116. package/dist/esm/api/resources/webhooks/client/Client.d.mts +1 -1
  117. package/dist/esm/api/resources/webhooks/client/Client.mjs +8 -8
  118. package/dist/esm/api/types/AgentResponse.d.mts +41 -2
  119. package/dist/esm/api/types/AgentResponse.mjs +29 -1
  120. package/dist/esm/api/types/MessageInConversation.d.mts +2 -0
  121. package/dist/esm/api/types/NumberUsageItem.d.mts +10 -0
  122. package/dist/esm/api/types/NumberUsageItem.mjs +2 -0
  123. package/dist/esm/api/types/NumberUsageResponse.d.mts +4 -0
  124. package/dist/esm/api/types/NumberUsageResponse.mjs +2 -0
  125. package/dist/esm/api/types/ReactionInConversation.d.mts +7 -0
  126. package/dist/esm/api/types/ReactionInConversation.mjs +2 -0
  127. package/dist/esm/api/types/SendTypingResponse.d.mts +5 -0
  128. package/dist/esm/api/types/SendTypingResponse.mjs +2 -0
  129. package/dist/esm/api/types/index.d.mts +4 -0
  130. package/dist/esm/api/types/index.mjs +4 -0
  131. package/dist/esm/auth/BearerAuthProvider.d.mts +1 -1
  132. package/dist/esm/environments.d.mts +2 -2
  133. package/dist/esm/environments.mjs +1 -1
  134. package/dist/esm/version.d.mts +1 -1
  135. package/dist/esm/version.mjs +1 -1
  136. package/package.json +1 -1
  137. package/reference.md +338 -0
package/README.md CHANGED
@@ -41,8 +41,8 @@ Instantiate and use the client with the following:
41
41
  import { AgentPhoneClient } from "agentphone";
42
42
 
43
43
  const client = new AgentPhoneClient({ token: "YOUR_TOKEN" });
44
- await client.agents.createAgent({
45
- name: "name"
44
+ await client.agentSignup.agentSignUp({
45
+ human_email: "human_email"
46
46
  });
47
47
  ```
48
48
 
@@ -54,7 +54,7 @@ following namespace:
54
54
  ```typescript
55
55
  import { AgentPhone } from "agentphone";
56
56
 
57
- const request: AgentPhone.ListAgentsV1AgentsGetRequest = {
57
+ const request: AgentPhone.AgentSignUpRequest = {
58
58
  ...
59
59
  };
60
60
  ```
@@ -68,7 +68,7 @@ will be thrown.
68
68
  import { AgentPhoneError } from "agentphone";
69
69
 
70
70
  try {
71
- await client.agents.createAgent(...);
71
+ await client.agentSignup.agentSignUp(...);
72
72
  } catch (err) {
73
73
  if (err instanceof AgentPhoneError) {
74
74
  console.log(err.statusCode);
@@ -95,7 +95,7 @@ const client = new AgentPhoneClient({
95
95
  }
96
96
  });
97
97
 
98
- const response = await client.agents.createAgent(..., {
98
+ const response = await client.agentSignup.agentSignUp(..., {
99
99
  headers: {
100
100
  'X-Custom-Header': 'custom value'
101
101
  }
@@ -107,7 +107,7 @@ const response = await client.agents.createAgent(..., {
107
107
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
108
108
 
109
109
  ```typescript
110
- const response = await client.agents.createAgent(..., {
110
+ const response = await client.agentSignup.agentSignUp(..., {
111
111
  queryParams: {
112
112
  'customQueryParamKey': 'custom query param value'
113
113
  }
@@ -129,7 +129,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
129
129
  Use the `maxRetries` request option to configure this behavior.
130
130
 
131
131
  ```typescript
132
- const response = await client.agents.createAgent(..., {
132
+ const response = await client.agentSignup.agentSignUp(..., {
133
133
  maxRetries: 0 // override maxRetries at the request level
134
134
  });
135
135
  ```
@@ -139,7 +139,7 @@ const response = await client.agents.createAgent(..., {
139
139
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
140
140
 
141
141
  ```typescript
142
- const response = await client.agents.createAgent(..., {
142
+ const response = await client.agentSignup.agentSignUp(..., {
143
143
  timeoutInSeconds: 30 // override timeout to 30s
144
144
  });
145
145
  ```
@@ -150,7 +150,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
150
150
 
151
151
  ```typescript
152
152
  const controller = new AbortController();
153
- const response = await client.agents.createAgent(..., {
153
+ const response = await client.agentSignup.agentSignUp(..., {
154
154
  abortSignal: controller.signal
155
155
  });
156
156
  controller.abort(); // aborts the request
@@ -162,7 +162,7 @@ The SDK provides access to raw response data, including headers, through the `.w
162
162
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
163
163
 
164
164
  ```typescript
165
- const { data, rawResponse } = await client.agents.createAgent(...).withRawResponse();
165
+ const { data, rawResponse } = await client.agentSignup.agentSignUp(...).withRawResponse();
166
166
 
167
167
  console.log(data);
168
168
  console.log(rawResponse.headers['X-My-Header']);
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentphone",
46
- "X-Fern-SDK-Version": "1.0.4",
47
- "User-Agent": "agentphone/1.0.4",
46
+ "X-Fern-SDK-Version": "1.0.6",
47
+ "User-Agent": "agentphone/1.0.6",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,3 +1,4 @@
1
+ import { AgentSignupClient } from "./api/resources/agentSignup/client/Client.js";
1
2
  import { AgentsClient } from "./api/resources/agents/client/Client.js";
2
3
  import { AgentWebhooksClient } from "./api/resources/agentWebhooks/client/Client.js";
3
4
  import { CallsClient } from "./api/resources/calls/client/Client.js";
@@ -16,6 +17,7 @@ export declare namespace AgentPhoneClient {
16
17
  }
17
18
  export declare class AgentPhoneClient {
18
19
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentPhoneClient.Options>;
20
+ protected _agentSignup: AgentSignupClient | undefined;
19
21
  protected _agents: AgentsClient | undefined;
20
22
  protected _numbers: NumbersClient | undefined;
21
23
  protected _webhooks: WebhooksClient | undefined;
@@ -25,7 +27,8 @@ export declare class AgentPhoneClient {
25
27
  protected _calls: CallsClient | undefined;
26
28
  protected _usage: UsageClient | undefined;
27
29
  protected _messages: MessagesClient | undefined;
28
- constructor(options: AgentPhoneClient.Options);
30
+ constructor(options?: AgentPhoneClient.Options);
31
+ get agentSignup(): AgentSignupClient;
29
32
  get agents(): AgentsClient;
30
33
  get numbers(): NumbersClient;
31
34
  get webhooks(): WebhooksClient;
@@ -2,55 +2,60 @@
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.AgentPhoneClient = void 0;
5
- const Client_js_1 = require("./api/resources/agents/client/Client.js");
6
- const Client_js_2 = require("./api/resources/agentWebhooks/client/Client.js");
7
- const Client_js_3 = require("./api/resources/calls/client/Client.js");
8
- const Client_js_4 = require("./api/resources/contacts/client/Client.js");
9
- const Client_js_5 = require("./api/resources/conversations/client/Client.js");
10
- const Client_js_6 = require("./api/resources/messages/client/Client.js");
11
- const Client_js_7 = require("./api/resources/numbers/client/Client.js");
12
- const Client_js_8 = require("./api/resources/usage/client/Client.js");
13
- const Client_js_9 = require("./api/resources/webhooks/client/Client.js");
5
+ const Client_js_1 = require("./api/resources/agentSignup/client/Client.js");
6
+ const Client_js_2 = require("./api/resources/agents/client/Client.js");
7
+ const Client_js_3 = require("./api/resources/agentWebhooks/client/Client.js");
8
+ const Client_js_4 = require("./api/resources/calls/client/Client.js");
9
+ const Client_js_5 = require("./api/resources/contacts/client/Client.js");
10
+ const Client_js_6 = require("./api/resources/conversations/client/Client.js");
11
+ const Client_js_7 = require("./api/resources/messages/client/Client.js");
12
+ const Client_js_8 = require("./api/resources/numbers/client/Client.js");
13
+ const Client_js_9 = require("./api/resources/usage/client/Client.js");
14
+ const Client_js_10 = require("./api/resources/webhooks/client/Client.js");
14
15
  const BaseClient_js_1 = require("./BaseClient.js");
15
16
  class AgentPhoneClient {
16
- constructor(options) {
17
+ constructor(options = {}) {
17
18
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
18
19
  }
20
+ get agentSignup() {
21
+ var _a;
22
+ return ((_a = this._agentSignup) !== null && _a !== void 0 ? _a : (this._agentSignup = new Client_js_1.AgentSignupClient(this._options)));
23
+ }
19
24
  get agents() {
20
25
  var _a;
21
- return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_1.AgentsClient(this._options)));
26
+ return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_2.AgentsClient(this._options)));
22
27
  }
23
28
  get numbers() {
24
29
  var _a;
25
- return ((_a = this._numbers) !== null && _a !== void 0 ? _a : (this._numbers = new Client_js_7.NumbersClient(this._options)));
30
+ return ((_a = this._numbers) !== null && _a !== void 0 ? _a : (this._numbers = new Client_js_8.NumbersClient(this._options)));
26
31
  }
27
32
  get webhooks() {
28
33
  var _a;
29
- return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_9.WebhooksClient(this._options)));
34
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_10.WebhooksClient(this._options)));
30
35
  }
31
36
  get agentWebhooks() {
32
37
  var _a;
33
- return ((_a = this._agentWebhooks) !== null && _a !== void 0 ? _a : (this._agentWebhooks = new Client_js_2.AgentWebhooksClient(this._options)));
38
+ return ((_a = this._agentWebhooks) !== null && _a !== void 0 ? _a : (this._agentWebhooks = new Client_js_3.AgentWebhooksClient(this._options)));
34
39
  }
35
40
  get contacts() {
36
41
  var _a;
37
- return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_js_4.ContactsClient(this._options)));
42
+ return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_js_5.ContactsClient(this._options)));
38
43
  }
39
44
  get conversations() {
40
45
  var _a;
41
- return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_5.ConversationsClient(this._options)));
46
+ return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_6.ConversationsClient(this._options)));
42
47
  }
43
48
  get calls() {
44
49
  var _a;
45
- return ((_a = this._calls) !== null && _a !== void 0 ? _a : (this._calls = new Client_js_3.CallsClient(this._options)));
50
+ return ((_a = this._calls) !== null && _a !== void 0 ? _a : (this._calls = new Client_js_4.CallsClient(this._options)));
46
51
  }
47
52
  get usage() {
48
53
  var _a;
49
- return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_8.UsageClient(this._options)));
54
+ return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_9.UsageClient(this._options)));
50
55
  }
51
56
  get messages() {
52
57
  var _a;
53
- return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_6.MessagesClient(this._options)));
58
+ return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_7.MessagesClient(this._options)));
54
59
  }
55
60
  }
56
61
  exports.AgentPhoneClient = AgentPhoneClient;
@@ -0,0 +1,50 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptions } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as AgentPhone from "../../../index.js";
5
+ export declare namespace AgentSignupClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AgentSignupClient {
11
+ protected readonly _options: NormalizedClientOptions<AgentSignupClient.Options>;
12
+ constructor(options?: AgentSignupClient.Options);
13
+ /**
14
+ * Kick off agent self-signup.
15
+ *
16
+ * Sends a 6-digit OTP to the human's email. Nothing is provisioned server-side
17
+ * until /v0/agent/verify is called with the code.
18
+ *
19
+ * @param {AgentPhone.AgentSignUpRequest} request
20
+ * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
21
+ *
22
+ * @throws {@link AgentPhone.UnprocessableEntityError}
23
+ *
24
+ * @example
25
+ * await client.agentSignup.agentSignUp({
26
+ * human_email: "human_email"
27
+ * })
28
+ */
29
+ agentSignUp(request: AgentPhone.AgentSignUpRequest, requestOptions?: AgentSignupClient.RequestOptions): core.HttpResponsePromise<unknown>;
30
+ private __agentSignUp;
31
+ /**
32
+ * Verify the OTP and atomically provision everything.
33
+ *
34
+ * Creates: User + Project (+ mirrored Account) + starter hosted Agent + Twilio number
35
+ * + first-month charge + API key. Returns the key once — agents must save it.
36
+ *
37
+ * @param {AgentPhone.AgentVerifyRequest} request
38
+ * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
39
+ *
40
+ * @throws {@link AgentPhone.UnprocessableEntityError}
41
+ *
42
+ * @example
43
+ * await client.agentSignup.agentVerify({
44
+ * verification_id: "verification_id",
45
+ * otp_code: "otp_code"
46
+ * })
47
+ */
48
+ agentVerify(request: AgentPhone.AgentVerifyRequest, requestOptions?: AgentSignupClient.RequestOptions): core.HttpResponsePromise<unknown>;
49
+ private __agentVerify;
50
+ }
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.AgentSignupClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const AgentPhone = __importStar(require("../../../index.js"));
54
+ class AgentSignupClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
57
+ }
58
+ /**
59
+ * Kick off agent self-signup.
60
+ *
61
+ * Sends a 6-digit OTP to the human's email. Nothing is provisioned server-side
62
+ * until /v0/agent/verify is called with the code.
63
+ *
64
+ * @param {AgentPhone.AgentSignUpRequest} request
65
+ * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
66
+ *
67
+ * @throws {@link AgentPhone.UnprocessableEntityError}
68
+ *
69
+ * @example
70
+ * await client.agentSignup.agentSignUp({
71
+ * human_email: "human_email"
72
+ * })
73
+ */
74
+ agentSignUp(request, requestOptions) {
75
+ return core.HttpResponsePromise.fromPromise(this.__agentSignUp(request, requestOptions));
76
+ }
77
+ __agentSignUp(request, requestOptions) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
80
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
81
+ const _response = yield core.fetcher({
82
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v0/agent/sign-up"),
83
+ method: "POST",
84
+ headers: _headers,
85
+ contentType: "application/json",
86
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
87
+ requestType: "json",
88
+ body: request,
89
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
90
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
91
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
93
+ logging: this._options.logging,
94
+ });
95
+ if (_response.ok) {
96
+ return { data: _response.body, rawResponse: _response.rawResponse };
97
+ }
98
+ if (_response.error.reason === "status-code") {
99
+ switch (_response.error.statusCode) {
100
+ case 422:
101
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
102
+ default:
103
+ throw new errors.AgentPhoneError({
104
+ statusCode: _response.error.statusCode,
105
+ body: _response.error.body,
106
+ rawResponse: _response.rawResponse,
107
+ });
108
+ }
109
+ }
110
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
111
+ });
112
+ }
113
+ /**
114
+ * Verify the OTP and atomically provision everything.
115
+ *
116
+ * Creates: User + Project (+ mirrored Account) + starter hosted Agent + Twilio number
117
+ * + first-month charge + API key. Returns the key once — agents must save it.
118
+ *
119
+ * @param {AgentPhone.AgentVerifyRequest} request
120
+ * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
121
+ *
122
+ * @throws {@link AgentPhone.UnprocessableEntityError}
123
+ *
124
+ * @example
125
+ * await client.agentSignup.agentVerify({
126
+ * verification_id: "verification_id",
127
+ * otp_code: "otp_code"
128
+ * })
129
+ */
130
+ agentVerify(request, requestOptions) {
131
+ return core.HttpResponsePromise.fromPromise(this.__agentVerify(request, requestOptions));
132
+ }
133
+ __agentVerify(request, requestOptions) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
136
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
137
+ const _response = yield core.fetcher({
138
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v0/agent/verify"),
139
+ method: "POST",
140
+ headers: _headers,
141
+ contentType: "application/json",
142
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
143
+ requestType: "json",
144
+ body: request,
145
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
146
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
147
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
148
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
149
+ logging: this._options.logging,
150
+ });
151
+ if (_response.ok) {
152
+ return { data: _response.body, rawResponse: _response.rawResponse };
153
+ }
154
+ if (_response.error.reason === "status-code") {
155
+ switch (_response.error.statusCode) {
156
+ case 422:
157
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
158
+ default:
159
+ throw new errors.AgentPhoneError({
160
+ statusCode: _response.error.statusCode,
161
+ body: _response.error.body,
162
+ rawResponse: _response.rawResponse,
163
+ });
164
+ }
165
+ }
166
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/verify");
167
+ });
168
+ }
169
+ }
170
+ exports.AgentSignupClient = AgentSignupClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * human_email: "human_email"
5
+ * }
6
+ */
7
+ export interface AgentSignUpRequest {
8
+ human_email: string;
9
+ agent_name?: string | null;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * verification_id: "verification_id",
5
+ * otp_code: "otp_code"
6
+ * }
7
+ */
8
+ export interface AgentVerifyRequest {
9
+ verification_id: string;
10
+ otp_code: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export type { AgentSignUpRequest } from "./AgentSignUpRequest.js";
2
+ export type { AgentVerifyRequest } from "./AgentVerifyRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -9,7 +9,7 @@ export declare namespace AgentWebhooksClient {
9
9
  }
10
10
  export declare class AgentWebhooksClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentWebhooksClient.Options>;
12
- constructor(options: AgentWebhooksClient.Options);
12
+ constructor(options?: AgentWebhooksClient.Options);
13
13
  /**
14
14
  * Get the webhook configuration for a specific agent.
15
15
  *
@@ -52,7 +52,7 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
52
52
  const errors = __importStar(require("../../../../errors/index.js"));
53
53
  const AgentPhone = __importStar(require("../../../index.js"));
54
54
  class AgentWebhooksClient {
55
- constructor(options) {
55
+ constructor(options = {}) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
@@ -78,7 +78,7 @@ class AgentWebhooksClient {
78
78
  const _authRequest = yield this._options.authProvider.getAuthRequest();
79
79
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
80
80
  const _response = yield core.fetcher({
81
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
81
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
82
82
  method: "GET",
83
83
  headers: _headers,
84
84
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -134,7 +134,7 @@ class AgentWebhooksClient {
134
134
  const _authRequest = yield this._options.authProvider.getAuthRequest();
135
135
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
136
136
  const _response = yield core.fetcher({
137
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
137
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
138
138
  method: "POST",
139
139
  headers: _headers,
140
140
  contentType: "application/json",
@@ -188,7 +188,7 @@ class AgentWebhooksClient {
188
188
  const _authRequest = yield this._options.authProvider.getAuthRequest();
189
189
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
190
190
  const _response = yield core.fetcher({
191
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
191
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/agents/${core.url.encodePathParam(agentId)}/webhook`),
192
192
  method: "DELETE",
193
193
  headers: _headers,
194
194
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -242,7 +242,7 @@ class AgentWebhooksClient {
242
242
  const _authRequest = yield this._options.authProvider.getAuthRequest();
243
243
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
244
244
  const _response = yield core.fetcher({
245
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/webhook/deliveries`),
245
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/agents/${core.url.encodePathParam(agentId)}/webhook/deliveries`),
246
246
  method: "GET",
247
247
  headers: _headers,
248
248
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
@@ -293,7 +293,7 @@ class AgentWebhooksClient {
293
293
  const _authRequest = yield this._options.authProvider.getAuthRequest();
294
294
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
295
295
  const _response = yield core.fetcher({
296
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Default, `v1/agents/${core.url.encodePathParam(agentId)}/webhook/test`),
296
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, `v1/agents/${core.url.encodePathParam(agentId)}/webhook/test`),
297
297
  method: "POST",
298
298
  headers: _headers,
299
299
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -9,7 +9,7 @@ export declare namespace AgentsClient {
9
9
  }
10
10
  export declare class AgentsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
12
- constructor(options: AgentsClient.Options);
12
+ constructor(options?: AgentsClient.Options);
13
13
  /**
14
14
  * Return available voices from the call provider (Retell).
15
15
  *