agentphone 1.0.10 → 1.0.12

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 (112) hide show
  1. package/README.md +10 -10
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +3 -3
  4. package/dist/cjs/Client.js +21 -21
  5. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  6. package/dist/cjs/api/resources/agents/client/Client.js +1 -1
  7. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +75 -0
  8. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.js +66 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +75 -0
  10. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +66 -0
  11. package/dist/cjs/api/resources/calls/client/Client.d.ts +4 -4
  12. package/dist/cjs/api/resources/calls/client/Client.js +4 -4
  13. package/dist/cjs/api/resources/conversations/client/Client.d.ts +39 -1
  14. package/dist/cjs/api/resources/conversations/client/Client.js +114 -1
  15. package/dist/cjs/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.d.ts +9 -0
  16. package/dist/cjs/api/resources/conversations/client/requests/SetBackgroundRequest.d.ts +12 -0
  17. package/dist/cjs/api/resources/conversations/client/requests/index.d.ts +2 -0
  18. package/dist/cjs/api/resources/index.d.ts +2 -2
  19. package/dist/cjs/api/resources/index.js +3 -3
  20. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +2 -0
  21. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.d.ts +2 -14
  22. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.js +0 -13
  23. package/dist/cjs/api/resources/messages/client/requests/index.d.ts +1 -1
  24. package/dist/cjs/api/resources/messages/client/requests/index.js +1 -3
  25. package/dist/cjs/api/resources/registration/client/Client.d.ts +61 -0
  26. package/dist/cjs/api/resources/{agentSignup → registration}/client/Client.js +44 -69
  27. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.d.ts +61 -0
  28. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.js +3 -0
  29. package/dist/cjs/api/resources/registration/client/requests/index.d.ts +1 -0
  30. package/dist/cjs/api/types/AgentResponse.d.ts +8 -0
  31. package/dist/cjs/api/{resources/agentSignup/client/requests → types}/AgentSignUpRequest.d.ts +0 -6
  32. package/dist/cjs/api/types/AgentSignUpRequest.js +3 -0
  33. package/dist/cjs/api/types/AgentVerifyRequest.d.ts +4 -0
  34. package/dist/cjs/api/types/AgentVerifyRequest.js +3 -0
  35. package/dist/cjs/api/types/FieldWarning.d.ts +6 -0
  36. package/dist/cjs/api/types/FieldWarning.js +3 -0
  37. package/dist/cjs/api/types/RegistrationResponse.d.ts +8 -0
  38. package/dist/cjs/api/types/RegistrationResponse.js +3 -0
  39. package/dist/cjs/api/types/SendMessageResponse.d.ts +2 -0
  40. package/dist/cjs/api/types/SetBackgroundResponse.d.ts +8 -0
  41. package/dist/cjs/api/types/SetBackgroundResponse.js +3 -0
  42. package/dist/cjs/api/types/index.d.ts +5 -0
  43. package/dist/cjs/api/types/index.js +5 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +3 -3
  48. package/dist/esm/Client.mjs +5 -5
  49. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  50. package/dist/esm/api/resources/agents/client/Client.mjs +1 -1
  51. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +75 -0
  52. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.mjs +66 -0
  53. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +75 -0
  54. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +66 -0
  55. package/dist/esm/api/resources/calls/client/Client.d.mts +4 -4
  56. package/dist/esm/api/resources/calls/client/Client.mjs +4 -4
  57. package/dist/esm/api/resources/conversations/client/Client.d.mts +39 -1
  58. package/dist/esm/api/resources/conversations/client/Client.mjs +114 -1
  59. package/dist/esm/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.d.mts +9 -0
  60. package/dist/esm/api/resources/conversations/client/requests/SetBackgroundRequest.d.mts +12 -0
  61. package/dist/esm/api/resources/conversations/client/requests/index.d.mts +2 -0
  62. package/dist/esm/api/resources/index.d.mts +2 -2
  63. package/dist/esm/api/resources/index.mjs +2 -2
  64. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +2 -0
  65. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.d.mts +2 -14
  66. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.mjs +1 -12
  67. package/dist/esm/api/resources/messages/client/requests/index.d.mts +1 -1
  68. package/dist/esm/api/resources/messages/client/requests/index.mjs +0 -1
  69. package/dist/esm/api/resources/registration/client/Client.d.mts +61 -0
  70. package/dist/esm/api/resources/registration/client/Client.mjs +108 -0
  71. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.d.mts +61 -0
  72. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.mjs +2 -0
  73. package/dist/esm/api/resources/registration/client/requests/index.d.mts +1 -0
  74. package/dist/esm/api/types/AgentResponse.d.mts +8 -0
  75. package/dist/esm/api/{resources/agentSignup/client/requests → types}/AgentSignUpRequest.d.mts +0 -6
  76. package/dist/esm/api/types/AgentSignUpRequest.mjs +2 -0
  77. package/dist/esm/api/types/AgentVerifyRequest.d.mts +4 -0
  78. package/dist/esm/api/types/AgentVerifyRequest.mjs +2 -0
  79. package/dist/esm/api/types/FieldWarning.d.mts +6 -0
  80. package/dist/esm/api/types/FieldWarning.mjs +2 -0
  81. package/dist/esm/api/types/RegistrationResponse.d.mts +8 -0
  82. package/dist/esm/api/types/RegistrationResponse.mjs +2 -0
  83. package/dist/esm/api/types/SendMessageResponse.d.mts +2 -0
  84. package/dist/esm/api/types/SetBackgroundResponse.d.mts +8 -0
  85. package/dist/esm/api/types/SetBackgroundResponse.mjs +2 -0
  86. package/dist/esm/api/types/index.d.mts +5 -0
  87. package/dist/esm/api/types/index.mjs +5 -0
  88. package/dist/esm/version.d.mts +1 -1
  89. package/dist/esm/version.mjs +1 -1
  90. package/package.json +1 -1
  91. package/reference.md +243 -144
  92. package/dist/cjs/api/resources/agentSignup/client/Client.d.ts +0 -50
  93. package/dist/cjs/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.ts +0 -11
  94. package/dist/cjs/api/resources/agentSignup/client/requests/index.d.ts +0 -2
  95. package/dist/esm/api/resources/agentSignup/client/Client.d.mts +0 -50
  96. package/dist/esm/api/resources/agentSignup/client/Client.mjs +0 -133
  97. package/dist/esm/api/resources/agentSignup/client/requests/AgentVerifyRequest.d.mts +0 -11
  98. package/dist/esm/api/resources/agentSignup/client/requests/index.d.mts +0 -2
  99. /package/dist/cjs/api/resources/{agentSignup/client/requests/AgentSignUpRequest.js → conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.js} +0 -0
  100. /package/dist/cjs/api/resources/{agentSignup/client/requests/AgentVerifyRequest.js → conversations/client/requests/SetBackgroundRequest.js} +0 -0
  101. /package/dist/cjs/api/resources/{agentSignup → registration}/client/index.d.ts +0 -0
  102. /package/dist/cjs/api/resources/{agentSignup → registration}/client/index.js +0 -0
  103. /package/dist/cjs/api/resources/{agentSignup → registration}/client/requests/index.js +0 -0
  104. /package/dist/cjs/api/resources/{agentSignup → registration}/index.d.ts +0 -0
  105. /package/dist/cjs/api/resources/{agentSignup → registration}/index.js +0 -0
  106. /package/dist/esm/api/resources/{agentSignup/client/requests/AgentSignUpRequest.mjs → conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.mjs} +0 -0
  107. /package/dist/esm/api/resources/{agentSignup/client/requests/AgentVerifyRequest.mjs → conversations/client/requests/SetBackgroundRequest.mjs} +0 -0
  108. /package/dist/esm/api/resources/{agentSignup → registration}/client/index.d.mts +0 -0
  109. /package/dist/esm/api/resources/{agentSignup → registration}/client/index.mjs +0 -0
  110. /package/dist/esm/api/resources/{agentSignup → registration}/client/requests/index.mjs +0 -0
  111. /package/dist/esm/api/resources/{agentSignup → registration}/index.d.mts +0 -0
  112. /package/dist/esm/api/resources/{agentSignup → registration}/index.mjs +0 -0
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.10";
1
+ export declare const SDK_VERSION = "1.0.12";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.10";
1
+ export const SDK_VERSION = "1.0.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentphone",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -1,142 +1,4 @@
1
1
  # Reference
2
- ## AgentSignup
3
- <details><summary><code>client.agentSignup.<a href="/src/api/resources/agentSignup/client/Client.ts">agentSignUp</a>({ ...params }) -> unknown</code></summary>
4
- <dl>
5
- <dd>
6
-
7
- #### 📝 Description
8
-
9
- <dl>
10
- <dd>
11
-
12
- <dl>
13
- <dd>
14
-
15
- Kick off agent self-signup.
16
-
17
- Sends a 6-digit OTP to the human's email. Nothing is provisioned server-side
18
- until /v0/agent/verify is called with the code.
19
- </dd>
20
- </dl>
21
- </dd>
22
- </dl>
23
-
24
- #### 🔌 Usage
25
-
26
- <dl>
27
- <dd>
28
-
29
- <dl>
30
- <dd>
31
-
32
- ```typescript
33
- await client.agentSignup.agentSignUp({
34
- human_email: "human_email"
35
- });
36
-
37
- ```
38
- </dd>
39
- </dl>
40
- </dd>
41
- </dl>
42
-
43
- #### ⚙️ Parameters
44
-
45
- <dl>
46
- <dd>
47
-
48
- <dl>
49
- <dd>
50
-
51
- **request:** `AgentPhone.AgentSignUpRequest`
52
-
53
- </dd>
54
- </dl>
55
-
56
- <dl>
57
- <dd>
58
-
59
- **requestOptions:** `AgentSignupClient.RequestOptions`
60
-
61
- </dd>
62
- </dl>
63
- </dd>
64
- </dl>
65
-
66
-
67
- </dd>
68
- </dl>
69
- </details>
70
-
71
- <details><summary><code>client.agentSignup.<a href="/src/api/resources/agentSignup/client/Client.ts">agentVerify</a>({ ...params }) -> unknown</code></summary>
72
- <dl>
73
- <dd>
74
-
75
- #### 📝 Description
76
-
77
- <dl>
78
- <dd>
79
-
80
- <dl>
81
- <dd>
82
-
83
- Verify the OTP and atomically provision everything.
84
-
85
- Creates: User + Project (+ mirrored Account) + starter hosted Agent + phone number
86
- + first-month charge + API key. Returns the key once — agents must save it.
87
- </dd>
88
- </dl>
89
- </dd>
90
- </dl>
91
-
92
- #### 🔌 Usage
93
-
94
- <dl>
95
- <dd>
96
-
97
- <dl>
98
- <dd>
99
-
100
- ```typescript
101
- await client.agentSignup.agentVerify({
102
- verification_id: "verification_id",
103
- otp_code: "otp_code"
104
- });
105
-
106
- ```
107
- </dd>
108
- </dl>
109
- </dd>
110
- </dl>
111
-
112
- #### ⚙️ Parameters
113
-
114
- <dl>
115
- <dd>
116
-
117
- <dl>
118
- <dd>
119
-
120
- **request:** `AgentPhone.AgentVerifyRequest`
121
-
122
- </dd>
123
- </dl>
124
-
125
- <dl>
126
- <dd>
127
-
128
- **requestOptions:** `AgentSignupClient.RequestOptions`
129
-
130
- </dd>
131
- </dl>
132
- </dd>
133
- </dl>
134
-
135
-
136
- </dd>
137
- </dl>
138
- </details>
139
-
140
2
  ## Agents
141
3
  <details><summary><code>client.agents.<a href="/src/api/resources/agents/client/Client.ts">listVoices</a>() -> unknown</code></summary>
142
4
  <dl>
@@ -150,7 +12,7 @@ await client.agentSignup.agentVerify({
150
12
  <dl>
151
13
  <dd>
152
14
 
153
- Return available voices from the call provider (Retell).
15
+ Return available voices from the configured voice provider.
154
16
  </dd>
155
17
  </dl>
156
18
  </dd>
@@ -2175,7 +2037,7 @@ await client.contacts.updateContact({
2175
2037
  List all conversations for this account.
2176
2038
 
2177
2039
  Sorted by most recent activity (lastMessageAt desc).
2178
- Also includes conversations on shared lines owned by this account.
2040
+ Sorted by most recent activity.
2179
2041
  </dd>
2180
2042
  </dl>
2181
2043
  </dd>
@@ -2495,6 +2357,144 @@ await client.conversations.sendTypingIndicator({
2495
2357
  </dl>
2496
2358
 
2497
2359
 
2360
+ </dd>
2361
+ </dl>
2362
+ </details>
2363
+
2364
+ <details><summary><code>client.conversations.<a href="/src/api/resources/conversations/client/Client.ts">setChatBackground</a>({ ...params }) -> AgentPhone.SetBackgroundResponse</code></summary>
2365
+ <dl>
2366
+ <dd>
2367
+
2368
+ #### 📝 Description
2369
+
2370
+ <dl>
2371
+ <dd>
2372
+
2373
+ <dl>
2374
+ <dd>
2375
+
2376
+ Set a custom wallpaper for the chat (iMessage only).
2377
+
2378
+ Customer sends `image_url`; we fetch (≤10MB, JPEG/PNG/GIF/WebP/HEIC),
2379
+ validate, and forward as multipart to the iMessage provider. Idempotent —
2380
+ re-setting replaces. Recipients on iOS < 18 fall back to the default
2381
+ silently.
2382
+ </dd>
2383
+ </dl>
2384
+ </dd>
2385
+ </dl>
2386
+
2387
+ #### 🔌 Usage
2388
+
2389
+ <dl>
2390
+ <dd>
2391
+
2392
+ <dl>
2393
+ <dd>
2394
+
2395
+ ```typescript
2396
+ await client.conversations.setChatBackground({
2397
+ conversation_id: "conversation_id",
2398
+ image_url: "https://example.com/wallpaper.jpg"
2399
+ });
2400
+
2401
+ ```
2402
+ </dd>
2403
+ </dl>
2404
+ </dd>
2405
+ </dl>
2406
+
2407
+ #### ⚙️ Parameters
2408
+
2409
+ <dl>
2410
+ <dd>
2411
+
2412
+ <dl>
2413
+ <dd>
2414
+
2415
+ **request:** `AgentPhone.SetBackgroundRequest`
2416
+
2417
+ </dd>
2418
+ </dl>
2419
+
2420
+ <dl>
2421
+ <dd>
2422
+
2423
+ **requestOptions:** `ConversationsClient.RequestOptions`
2424
+
2425
+ </dd>
2426
+ </dl>
2427
+ </dd>
2428
+ </dl>
2429
+
2430
+
2431
+ </dd>
2432
+ </dl>
2433
+ </details>
2434
+
2435
+ <details><summary><code>client.conversations.<a href="/src/api/resources/conversations/client/Client.ts">removeChatBackground</a>({ ...params }) -> void</code></summary>
2436
+ <dl>
2437
+ <dd>
2438
+
2439
+ #### 📝 Description
2440
+
2441
+ <dl>
2442
+ <dd>
2443
+
2444
+ <dl>
2445
+ <dd>
2446
+
2447
+ Clear the custom wallpaper for the chat (iMessage only).
2448
+
2449
+ Idempotent: deleting a default-background chat returns 204 (no-op).
2450
+ </dd>
2451
+ </dl>
2452
+ </dd>
2453
+ </dl>
2454
+
2455
+ #### 🔌 Usage
2456
+
2457
+ <dl>
2458
+ <dd>
2459
+
2460
+ <dl>
2461
+ <dd>
2462
+
2463
+ ```typescript
2464
+ await client.conversations.removeChatBackground({
2465
+ conversation_id: "conversation_id"
2466
+ });
2467
+
2468
+ ```
2469
+ </dd>
2470
+ </dl>
2471
+ </dd>
2472
+ </dl>
2473
+
2474
+ #### ⚙️ Parameters
2475
+
2476
+ <dl>
2477
+ <dd>
2478
+
2479
+ <dl>
2480
+ <dd>
2481
+
2482
+ **request:** `AgentPhone.RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest`
2483
+
2484
+ </dd>
2485
+ </dl>
2486
+
2487
+ <dl>
2488
+ <dd>
2489
+
2490
+ **requestOptions:** `ConversationsClient.RequestOptions`
2491
+
2492
+ </dd>
2493
+ </dl>
2494
+ </dd>
2495
+ </dl>
2496
+
2497
+
2498
2498
  </dd>
2499
2499
  </dl>
2500
2500
  </details>
@@ -2794,10 +2794,10 @@ await client.calls.getCall({
2794
2794
 
2795
2795
  Terminate an ongoing call.
2796
2796
 
2797
- Works for both hosted-mode and webhook-mode calls. The call_ended
2798
- webhook from Retell updates status/endedAt asynchronously, so this
2799
- endpoint returns the current call as soon as the stop request is
2800
- accepted by Retell.
2797
+ Works for both hosted-mode and webhook-mode calls. The call_ended
2798
+ webhook from the voice provider updates status/endedAt asynchronously,
2799
+ so this endpoint returns the current call as soon as the stop request
2800
+ is accepted upstream.
2801
2801
  </dd>
2802
2802
  </dl>
2803
2803
  </dd>
@@ -3795,6 +3795,105 @@ await client.contactCards.deleteContactCard({
3795
3795
  </dl>
3796
3796
 
3797
3797
 
3798
+ </dd>
3799
+ </dl>
3800
+ </details>
3801
+
3802
+ ## Registration
3803
+ <details><summary><code>client.registration.<a href="/src/api/resources/registration/client/Client.ts">registerA2P</a>({ ...params }) -> AgentPhone.RegistrationResponse</code></summary>
3804
+ <dl>
3805
+ <dd>
3806
+
3807
+ #### 📝 Description
3808
+
3809
+ <dl>
3810
+ <dd>
3811
+
3812
+ <dl>
3813
+ <dd>
3814
+
3815
+ Submit an A2P 10DLC registration to enable outbound SMS on your account.
3816
+
3817
+ US carriers require 10DLC registration before your AI agent can send text messages. This endpoint accepts both `sole_proprietor` and `standard_brand` registration types.
3818
+
3819
+ ### How it works
3820
+
3821
+ 1. Submit your registration details via this endpoint
3822
+ 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
3823
+ 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
3824
+ 4. After payment, we submit your registration to the carriers on your behalf
3825
+ 5. Carrier approval typically takes 7-10 business days
3826
+
3827
+ ### Registration types
3828
+
3829
+ - **`sole_proprietor`** — For individuals or small businesses. Simpler requirements, fewer fields.
3830
+ - **`standard_brand`** — For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
3831
+
3832
+ ### Opt-in image
3833
+
3834
+ `opt_in_image_url` must be a publicly accessible HTTPS URL to a screenshot showing how users opt in to receive messages from you (e.g. a consent checkbox on your signup form). Supports PNG, JPG, WEBP, and GIF up to 2MB. Google Drive links (`drive.google.com/file/d/.../view`) are automatically converted if the file is shared publicly.
3835
+
3836
+ ### Re-submitting
3837
+
3838
+ If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
3839
+ </dd>
3840
+ </dl>
3841
+ </dd>
3842
+ </dl>
3843
+
3844
+ #### 🔌 Usage
3845
+
3846
+ <dl>
3847
+ <dd>
3848
+
3849
+ <dl>
3850
+ <dd>
3851
+
3852
+ ```typescript
3853
+ await client.registration.registerA2P({
3854
+ registration_type: "registration_type",
3855
+ first_name: "first_name",
3856
+ last_name: "last_name",
3857
+ email: "email",
3858
+ phone_number: "phone_number",
3859
+ street_address: "street_address",
3860
+ city: "city",
3861
+ state: "state",
3862
+ zip_code: "zip_code",
3863
+ use_case_description: "use_case_description",
3864
+ opt_in_image_url: "opt_in_image_url"
3865
+ });
3866
+
3867
+ ```
3868
+ </dd>
3869
+ </dl>
3870
+ </dd>
3871
+ </dl>
3872
+
3873
+ #### ⚙️ Parameters
3874
+
3875
+ <dl>
3876
+ <dd>
3877
+
3878
+ <dl>
3879
+ <dd>
3880
+
3881
+ **request:** `AgentPhone.RegistrationRequest`
3882
+
3883
+ </dd>
3884
+ </dl>
3885
+
3886
+ <dl>
3887
+ <dd>
3888
+
3889
+ **requestOptions:** `RegistrationClient.RequestOptions`
3890
+
3891
+ </dd>
3892
+ </dl>
3893
+ </dd>
3894
+ </dl>
3895
+
3896
+
3798
3897
  </dd>
3799
3898
  </dl>
3800
3899
  </details>
@@ -1,50 +0,0 @@
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 + phone 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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export type { AgentSignUpRequest } from "./AgentSignUpRequest.js";
2
- export type { AgentVerifyRequest } from "./AgentVerifyRequest.js";
@@ -1,50 +0,0 @@
1
- import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
- import { type NormalizedClientOptions } from "../../../../BaseClient.mjs";
3
- import * as core from "../../../../core/index.mjs";
4
- import * as AgentPhone from "../../../index.mjs";
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 + phone 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
- }
@@ -1,133 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import { normalizeClientOptions } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
13
- import * as core from "../../../../core/index.mjs";
14
- import * as environments from "../../../../environments.mjs";
15
- import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
- import * as errors from "../../../../errors/index.mjs";
17
- import * as AgentPhone from "../../../index.mjs";
18
- export class AgentSignupClient {
19
- constructor(options = {}) {
20
- this._options = normalizeClientOptions(options);
21
- }
22
- /**
23
- * Kick off agent self-signup.
24
- *
25
- * Sends a 6-digit OTP to the human's email. Nothing is provisioned server-side
26
- * until /v0/agent/verify is called with the code.
27
- *
28
- * @param {AgentPhone.AgentSignUpRequest} request
29
- * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
30
- *
31
- * @throws {@link AgentPhone.UnprocessableEntityError}
32
- *
33
- * @example
34
- * await client.agentSignup.agentSignUp({
35
- * human_email: "human_email"
36
- * })
37
- */
38
- agentSignUp(request, requestOptions) {
39
- return core.HttpResponsePromise.fromPromise(this.__agentSignUp(request, requestOptions));
40
- }
41
- __agentSignUp(request, requestOptions) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
44
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
45
- const _response = yield core.fetcher({
46
- 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"),
47
- method: "POST",
48
- headers: _headers,
49
- contentType: "application/json",
50
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
51
- requestType: "json",
52
- body: request,
53
- 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,
54
- 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,
55
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
56
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
57
- logging: this._options.logging,
58
- });
59
- if (_response.ok) {
60
- return { data: _response.body, rawResponse: _response.rawResponse };
61
- }
62
- if (_response.error.reason === "status-code") {
63
- switch (_response.error.statusCode) {
64
- case 422:
65
- throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
66
- default:
67
- throw new errors.AgentPhoneError({
68
- statusCode: _response.error.statusCode,
69
- body: _response.error.body,
70
- rawResponse: _response.rawResponse,
71
- });
72
- }
73
- }
74
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
75
- });
76
- }
77
- /**
78
- * Verify the OTP and atomically provision everything.
79
- *
80
- * Creates: User + Project (+ mirrored Account) + starter hosted Agent + phone number
81
- * + first-month charge + API key. Returns the key once — agents must save it.
82
- *
83
- * @param {AgentPhone.AgentVerifyRequest} request
84
- * @param {AgentSignupClient.RequestOptions} requestOptions - Request-specific configuration.
85
- *
86
- * @throws {@link AgentPhone.UnprocessableEntityError}
87
- *
88
- * @example
89
- * await client.agentSignup.agentVerify({
90
- * verification_id: "verification_id",
91
- * otp_code: "otp_code"
92
- * })
93
- */
94
- agentVerify(request, requestOptions) {
95
- return core.HttpResponsePromise.fromPromise(this.__agentVerify(request, requestOptions));
96
- }
97
- __agentVerify(request, requestOptions) {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
100
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
101
- const _response = yield core.fetcher({
102
- 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"),
103
- method: "POST",
104
- headers: _headers,
105
- contentType: "application/json",
106
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
107
- requestType: "json",
108
- body: request,
109
- 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,
110
- 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,
111
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
112
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
113
- logging: this._options.logging,
114
- });
115
- if (_response.ok) {
116
- return { data: _response.body, rawResponse: _response.rawResponse };
117
- }
118
- if (_response.error.reason === "status-code") {
119
- switch (_response.error.statusCode) {
120
- case 422:
121
- throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
122
- default:
123
- throw new errors.AgentPhoneError({
124
- statusCode: _response.error.statusCode,
125
- body: _response.error.body,
126
- rawResponse: _response.rawResponse,
127
- });
128
- }
129
- }
130
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/verify");
131
- });
132
- }
133
- }