agentphone 1.0.2 → 1.0.3

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 (158) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +6 -0
  3. package/dist/cjs/Client.js +18 -8
  4. package/dist/cjs/api/resources/agentWebhooks/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/agentWebhooks/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/agents/client/Client.d.ts +20 -2
  7. package/dist/cjs/api/resources/agents/client/Client.js +56 -2
  8. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
  9. package/dist/cjs/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.d.ts +11 -0
  10. package/dist/cjs/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.js +3 -0
  11. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -0
  12. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/calls/client/Client.d.ts +27 -3
  14. package/dist/cjs/api/resources/calls/client/Client.js +68 -4
  15. package/dist/cjs/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.ts +8 -0
  16. package/dist/cjs/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.d.ts +9 -0
  17. package/dist/cjs/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.js +3 -0
  18. package/dist/cjs/api/resources/calls/client/requests/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/contacts/client/Client.d.ts +94 -0
  20. package/dist/cjs/api/resources/contacts/client/Client.js +341 -0
  21. package/dist/cjs/api/resources/contacts/client/index.d.ts +1 -0
  22. package/dist/cjs/api/resources/contacts/client/index.js +17 -0
  23. package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +13 -0
  24. package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.js +3 -0
  25. package/dist/cjs/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.d.ts +9 -0
  26. package/dist/cjs/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.js +3 -0
  27. package/dist/cjs/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.d.ts +9 -0
  28. package/dist/cjs/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.js +3 -0
  29. package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +9 -0
  30. package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.js +3 -0
  31. package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.d.ts +13 -0
  32. package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.js +3 -0
  33. package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +5 -0
  34. package/dist/cjs/api/resources/contacts/client/requests/index.js +2 -0
  35. package/dist/cjs/api/resources/contacts/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/contacts/index.js +17 -0
  37. package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
  38. package/dist/cjs/api/resources/conversations/client/Client.js +1 -1
  39. package/dist/cjs/api/resources/index.d.ts +4 -0
  40. package/dist/cjs/api/resources/index.js +5 -1
  41. package/dist/cjs/api/resources/messages/client/Client.d.ts +49 -0
  42. package/dist/cjs/api/resources/messages/client/Client.js +183 -0
  43. package/dist/cjs/api/resources/messages/client/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/messages/client/index.js +17 -0
  45. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +15 -0
  46. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.js +3 -0
  47. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.d.ts +11 -0
  48. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.js +3 -0
  49. package/dist/cjs/api/resources/messages/client/requests/index.d.ts +2 -0
  50. package/dist/cjs/api/resources/messages/client/requests/index.js +2 -0
  51. package/dist/cjs/api/resources/messages/index.d.ts +1 -0
  52. package/dist/cjs/api/resources/messages/index.js +17 -0
  53. package/dist/cjs/api/resources/numbers/client/Client.d.ts +1 -1
  54. package/dist/cjs/api/resources/numbers/client/Client.js +1 -1
  55. package/dist/cjs/api/resources/usage/client/Client.d.ts +1 -1
  56. package/dist/cjs/api/resources/usage/client/Client.js +1 -1
  57. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +6 -6
  58. package/dist/cjs/api/resources/webhooks/client/Client.js +6 -6
  59. package/dist/cjs/api/types/AgentNumberResponse.d.ts +1 -0
  60. package/dist/cjs/api/types/AgentResponse.d.ts +1 -0
  61. package/dist/cjs/api/types/CallSummary.d.ts +1 -1
  62. package/dist/cjs/api/types/ContactListResponse.d.ts +6 -0
  63. package/dist/cjs/api/types/ContactListResponse.js +3 -0
  64. package/dist/cjs/api/types/ContactResponse.d.ts +9 -0
  65. package/dist/cjs/api/types/ContactResponse.js +3 -0
  66. package/dist/cjs/api/types/MessageInConversation.d.ts +2 -0
  67. package/dist/cjs/api/types/MessageResponse.d.ts +2 -0
  68. package/dist/cjs/api/types/PhoneNumberResponse.d.ts +1 -0
  69. package/dist/cjs/api/types/SendMessageResponse.d.ts +7 -0
  70. package/dist/cjs/api/types/SendMessageResponse.js +3 -0
  71. package/dist/cjs/api/types/SendReactionResponse.d.ts +6 -0
  72. package/dist/cjs/api/types/SendReactionResponse.js +3 -0
  73. package/dist/cjs/api/types/WebhookCreateRequest.d.ts +1 -0
  74. package/dist/cjs/api/types/WebhookResponse.d.ts +1 -0
  75. package/dist/cjs/api/types/index.d.ts +4 -0
  76. package/dist/cjs/api/types/index.js +4 -0
  77. package/dist/cjs/version.d.ts +1 -1
  78. package/dist/cjs/version.js +1 -1
  79. package/dist/esm/BaseClient.mjs +2 -2
  80. package/dist/esm/Client.d.mts +6 -0
  81. package/dist/esm/Client.mjs +10 -0
  82. package/dist/esm/api/resources/agentWebhooks/client/Client.d.mts +1 -1
  83. package/dist/esm/api/resources/agentWebhooks/client/Client.mjs +1 -1
  84. package/dist/esm/api/resources/agents/client/Client.d.mts +20 -2
  85. package/dist/esm/api/resources/agents/client/Client.mjs +56 -2
  86. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +1 -0
  87. package/dist/esm/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.d.mts +11 -0
  88. package/dist/esm/api/resources/agents/client/requests/DetachNumberFromAgentV1AgentsAgentIdNumbersNumberIdDeleteRequest.mjs +2 -0
  89. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -0
  90. package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -0
  91. package/dist/esm/api/resources/calls/client/Client.d.mts +27 -3
  92. package/dist/esm/api/resources/calls/client/Client.mjs +68 -4
  93. package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +8 -0
  94. package/dist/esm/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.d.mts +9 -0
  95. package/dist/esm/api/resources/calls/client/requests/StreamCallTranscriptV1CallsCallIdTranscriptStreamGetRequest.mjs +2 -0
  96. package/dist/esm/api/resources/calls/client/requests/index.d.mts +1 -0
  97. package/dist/esm/api/resources/contacts/client/Client.d.mts +94 -0
  98. package/dist/esm/api/resources/contacts/client/Client.mjs +304 -0
  99. package/dist/esm/api/resources/contacts/client/index.d.mts +1 -0
  100. package/dist/esm/api/resources/contacts/client/index.mjs +1 -0
  101. package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +13 -0
  102. package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.mjs +2 -0
  103. package/dist/esm/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.d.mts +9 -0
  104. package/dist/esm/api/resources/contacts/client/requests/DeleteContactV1ContactsContactIdDeleteRequest.mjs +2 -0
  105. package/dist/esm/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.d.mts +9 -0
  106. package/dist/esm/api/resources/contacts/client/requests/GetContactV1ContactsContactIdGetRequest.mjs +2 -0
  107. package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +9 -0
  108. package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.mjs +2 -0
  109. package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.d.mts +13 -0
  110. package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.mjs +2 -0
  111. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +5 -0
  112. package/dist/esm/api/resources/contacts/client/requests/index.mjs +1 -0
  113. package/dist/esm/api/resources/contacts/index.d.mts +1 -0
  114. package/dist/esm/api/resources/contacts/index.mjs +1 -0
  115. package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
  116. package/dist/esm/api/resources/conversations/client/Client.mjs +1 -1
  117. package/dist/esm/api/resources/index.d.mts +4 -0
  118. package/dist/esm/api/resources/index.mjs +4 -0
  119. package/dist/esm/api/resources/messages/client/Client.d.mts +49 -0
  120. package/dist/esm/api/resources/messages/client/Client.mjs +146 -0
  121. package/dist/esm/api/resources/messages/client/index.d.mts +1 -0
  122. package/dist/esm/api/resources/messages/client/index.mjs +1 -0
  123. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +15 -0
  124. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.mjs +2 -0
  125. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.d.mts +11 -0
  126. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.mjs +2 -0
  127. package/dist/esm/api/resources/messages/client/requests/index.d.mts +2 -0
  128. package/dist/esm/api/resources/messages/client/requests/index.mjs +1 -0
  129. package/dist/esm/api/resources/messages/index.d.mts +1 -0
  130. package/dist/esm/api/resources/messages/index.mjs +1 -0
  131. package/dist/esm/api/resources/numbers/client/Client.d.mts +1 -1
  132. package/dist/esm/api/resources/numbers/client/Client.mjs +1 -1
  133. package/dist/esm/api/resources/usage/client/Client.d.mts +1 -1
  134. package/dist/esm/api/resources/usage/client/Client.mjs +1 -1
  135. package/dist/esm/api/resources/webhooks/client/Client.d.mts +6 -6
  136. package/dist/esm/api/resources/webhooks/client/Client.mjs +6 -6
  137. package/dist/esm/api/types/AgentNumberResponse.d.mts +1 -0
  138. package/dist/esm/api/types/AgentResponse.d.mts +1 -0
  139. package/dist/esm/api/types/CallSummary.d.mts +1 -1
  140. package/dist/esm/api/types/ContactListResponse.d.mts +6 -0
  141. package/dist/esm/api/types/ContactListResponse.mjs +2 -0
  142. package/dist/esm/api/types/ContactResponse.d.mts +9 -0
  143. package/dist/esm/api/types/ContactResponse.mjs +2 -0
  144. package/dist/esm/api/types/MessageInConversation.d.mts +2 -0
  145. package/dist/esm/api/types/MessageResponse.d.mts +2 -0
  146. package/dist/esm/api/types/PhoneNumberResponse.d.mts +1 -0
  147. package/dist/esm/api/types/SendMessageResponse.d.mts +7 -0
  148. package/dist/esm/api/types/SendMessageResponse.mjs +2 -0
  149. package/dist/esm/api/types/SendReactionResponse.d.mts +6 -0
  150. package/dist/esm/api/types/SendReactionResponse.mjs +2 -0
  151. package/dist/esm/api/types/WebhookCreateRequest.d.mts +1 -0
  152. package/dist/esm/api/types/WebhookResponse.d.mts +1 -0
  153. package/dist/esm/api/types/index.d.mts +4 -0
  154. package/dist/esm/api/types/index.mjs +4 -0
  155. package/dist/esm/version.d.mts +1 -1
  156. package/dist/esm/version.mjs +1 -1
  157. package/package.json +1 -1
  158. package/reference.md +737 -126
@@ -0,0 +1,183 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.MessagesClient = void 0;
58
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
59
+ const headers_js_1 = require("../../../../core/headers.js");
60
+ const core = __importStar(require("../../../../core/index.js"));
61
+ const environments = __importStar(require("../../../../environments.js"));
62
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
63
+ const errors = __importStar(require("../../../../errors/index.js"));
64
+ const AgentPhone = __importStar(require("../../../index.js"));
65
+ class MessagesClient {
66
+ constructor(options) {
67
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
68
+ }
69
+ /**
70
+ * Send an outbound message (SMS or iMessage) via the provider assigned to the number.
71
+ *
72
+ * @param {AgentPhone.SendMessageRequest} request
73
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link AgentPhone.UnprocessableEntityError}
76
+ *
77
+ * @example
78
+ * await client.messages.sendMessage({
79
+ * agent_id: "agent_id",
80
+ * to_number: "to_number",
81
+ * body: "body"
82
+ * })
83
+ */
84
+ sendMessage(request, requestOptions) {
85
+ return core.HttpResponsePromise.fromPromise(this.__sendMessage(request, requestOptions));
86
+ }
87
+ __sendMessage(request, requestOptions) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
90
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
91
+ 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);
92
+ const _response = yield core.fetcher({
93
+ 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/messages"),
94
+ method: "POST",
95
+ headers: _headers,
96
+ contentType: "application/json",
97
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
98
+ requestType: "json",
99
+ body: request,
100
+ 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,
101
+ 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,
102
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
103
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
104
+ logging: this._options.logging,
105
+ });
106
+ if (_response.ok) {
107
+ return { data: _response.body, rawResponse: _response.rawResponse };
108
+ }
109
+ if (_response.error.reason === "status-code") {
110
+ switch (_response.error.statusCode) {
111
+ case 422:
112
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
113
+ default:
114
+ throw new errors.AgentPhoneError({
115
+ statusCode: _response.error.statusCode,
116
+ body: _response.error.body,
117
+ rawResponse: _response.rawResponse,
118
+ });
119
+ }
120
+ }
121
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/messages");
122
+ });
123
+ }
124
+ /**
125
+ * Send a tapback reaction to a message (iMessage only).
126
+ *
127
+ * Reactions are an iMessage feature. Attempting to react to a message
128
+ * sent via an SMS/Twilio number will return a clear error.
129
+ *
130
+ * @param {AgentPhone.SendReactionRequest} request
131
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
132
+ *
133
+ * @throws {@link AgentPhone.UnprocessableEntityError}
134
+ *
135
+ * @example
136
+ * await client.messages.sendReaction({
137
+ * message_id: "message_id",
138
+ * reaction: "reaction"
139
+ * })
140
+ */
141
+ sendReaction(request, requestOptions) {
142
+ return core.HttpResponsePromise.fromPromise(this.__sendReaction(request, requestOptions));
143
+ }
144
+ __sendReaction(request, requestOptions) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
147
+ const { message_id: messageId } = request, _body = __rest(request, ["message_id"]);
148
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
149
+ 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);
150
+ const _response = yield core.fetcher({
151
+ 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/messages/${core.url.encodePathParam(messageId)}/reactions`),
152
+ method: "POST",
153
+ headers: _headers,
154
+ contentType: "application/json",
155
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
156
+ requestType: "json",
157
+ body: _body,
158
+ 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,
159
+ 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,
160
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
161
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
162
+ logging: this._options.logging,
163
+ });
164
+ if (_response.ok) {
165
+ return { data: _response.body, rawResponse: _response.rawResponse };
166
+ }
167
+ if (_response.error.reason === "status-code") {
168
+ switch (_response.error.statusCode) {
169
+ case 422:
170
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
171
+ default:
172
+ throw new errors.AgentPhoneError({
173
+ statusCode: _response.error.statusCode,
174
+ body: _response.error.body,
175
+ rawResponse: _response.rawResponse,
176
+ });
177
+ }
178
+ }
179
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/messages/{message_id}/reactions");
180
+ });
181
+ }
182
+ }
183
+ exports.MessagesClient = MessagesClient;
@@ -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,15 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * agent_id: "agent_id",
5
+ * to_number: "to_number",
6
+ * body: "body"
7
+ * }
8
+ */
9
+ export interface SendMessageRequest {
10
+ agent_id: string;
11
+ to_number: string;
12
+ body: string;
13
+ media_url?: string | null;
14
+ number_id?: string | null;
15
+ }
@@ -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
+ * message_id: "message_id",
5
+ * reaction: "reaction"
6
+ * }
7
+ */
8
+ export interface SendReactionRequest {
9
+ message_id: string;
10
+ reaction: 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 { SendMessageRequest } from "./SendMessageRequest.js";
2
+ export type { SendReactionRequest } from "./SendReactionRequest.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);
@@ -11,7 +11,7 @@ export declare class NumbersClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<NumbersClient.Options>;
12
12
  constructor(options: NumbersClient.Options);
13
13
  /**
14
- * List all phone numbers for this project.
14
+ * List all phone numbers for this account.
15
15
  *
16
16
  * @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
17
17
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -56,7 +56,7 @@ class NumbersClient {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
59
- * List all phone numbers for this project.
59
+ * List all phone numbers for this account.
60
60
  *
61
61
  * @param {AgentPhone.ListNumbersV1NumbersGetRequest} request
62
62
  * @param {NumbersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -11,7 +11,7 @@ export declare class UsageClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<UsageClient.Options>;
12
12
  constructor(options: UsageClient.Options);
13
13
  /**
14
- * Get usage statistics for the current project.
14
+ * Get usage statistics for the current account.
15
15
  *
16
16
  * Returns:
17
17
  * - Phone number limits (used/limit/remaining)
@@ -56,7 +56,7 @@ class UsageClient {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
59
- * Get usage statistics for the current project.
59
+ * Get usage statistics for the current account.
60
60
  *
61
61
  * Returns:
62
62
  * - Phone number limits (used/limit/remaining)
@@ -11,7 +11,7 @@ export declare class WebhooksClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<WebhooksClient.Options>;
12
12
  constructor(options: WebhooksClient.Options);
13
13
  /**
14
- * Get the master webhook configuration for this project.
14
+ * Get the master webhook configuration for this account.
15
15
  *
16
16
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
17
17
  *
@@ -21,7 +21,7 @@ export declare class WebhooksClient {
21
21
  getWebhook(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse | null>;
22
22
  private __getWebhook;
23
23
  /**
24
- * Register or update the webhook URL for this project.
24
+ * Register or update the webhook URL for this account.
25
25
  *
26
26
  * If a webhook already exists, it will be updated.
27
27
  * A new secret is generated each time.
@@ -42,7 +42,7 @@ export declare class WebhooksClient {
42
42
  createOrUpdateWebhook(request: AgentPhone.WebhookCreateRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse>;
43
43
  private __createOrUpdateWebhook;
44
44
  /**
45
- * Remove the master webhook for this project.
45
+ * Remove the master webhook for this account.
46
46
  *
47
47
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
48
48
  *
@@ -52,7 +52,7 @@ export declare class WebhooksClient {
52
52
  deleteWebhook(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<unknown>;
53
53
  private __deleteWebhook;
54
54
  /**
55
- * Get paginated webhook delivery attempts for all project webhooks.
55
+ * Get paginated webhook delivery attempts for all account webhooks.
56
56
  *
57
57
  * @param {AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest} request
58
58
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -65,7 +65,7 @@ export declare class WebhooksClient {
65
65
  listDeliveries(request?: AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.PaginatedDeliveriesResponse>;
66
66
  private __listDeliveries;
67
67
  /**
68
- * Aggregated delivery stats for the project's webhooks over the last N hours.
68
+ * Aggregated delivery stats for the account's webhooks over the last N hours.
69
69
  *
70
70
  * @param {AgentPhone.DeliveryStatsV1WebhooksDeliveriesStatsGetRequest} request
71
71
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -92,7 +92,7 @@ export declare class WebhooksClient {
92
92
  *
93
93
  * Sends a fake message payload to the configured URL.
94
94
  * Pass ?agentId=... to control which agent appears in the payload;
95
- * otherwise the first agent in the project is used.
95
+ * otherwise the first agent in the account is used.
96
96
  *
97
97
  * @param {AgentPhone.TestWebhookV1WebhooksTestPostRequest} request
98
98
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -56,7 +56,7 @@ class WebhooksClient {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
59
- * Get the master webhook configuration for this project.
59
+ * Get the master webhook configuration for this account.
60
60
  *
61
61
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
62
62
  *
@@ -96,7 +96,7 @@ class WebhooksClient {
96
96
  });
97
97
  }
98
98
  /**
99
- * Register or update the webhook URL for this project.
99
+ * Register or update the webhook URL for this account.
100
100
  *
101
101
  * If a webhook already exists, it will be updated.
102
102
  * A new secret is generated each time.
@@ -155,7 +155,7 @@ class WebhooksClient {
155
155
  });
156
156
  }
157
157
  /**
158
- * Remove the master webhook for this project.
158
+ * Remove the master webhook for this account.
159
159
  *
160
160
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
161
161
  *
@@ -195,7 +195,7 @@ class WebhooksClient {
195
195
  });
196
196
  }
197
197
  /**
198
- * Get paginated webhook delivery attempts for all project webhooks.
198
+ * Get paginated webhook delivery attempts for all account webhooks.
199
199
  *
200
200
  * @param {AgentPhone.ListDeliveriesV1WebhooksDeliveriesGetRequest} request
201
201
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -252,7 +252,7 @@ class WebhooksClient {
252
252
  });
253
253
  }
254
254
  /**
255
- * Aggregated delivery stats for the project's webhooks over the last N hours.
255
+ * Aggregated delivery stats for the account's webhooks over the last N hours.
256
256
  *
257
257
  * @param {AgentPhone.DeliveryStatsV1WebhooksDeliveriesStatsGetRequest} request
258
258
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -351,7 +351,7 @@ class WebhooksClient {
351
351
  *
352
352
  * Sends a fake message payload to the configured URL.
353
353
  * Pass ?agentId=... to control which agent appears in the payload;
354
- * otherwise the first agent in the project is used.
354
+ * otherwise the first agent in the account is used.
355
355
  *
356
356
  * @param {AgentPhone.TestWebhookV1WebhooksTestPostRequest} request
357
357
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2,4 +2,5 @@ export interface AgentNumberResponse {
2
2
  id: string;
3
3
  phoneNumber: string;
4
4
  status: string;
5
+ type?: string;
5
6
  }
@@ -8,6 +8,7 @@ export interface AgentResponse {
8
8
  beginMessage?: string | null;
9
9
  voice: string;
10
10
  transferNumber?: string | null;
11
+ voicemailMessage?: string | null;
11
12
  createdAt: string;
12
13
  numbers?: AgentPhone.AgentNumberResponse[] | null;
13
14
  }
@@ -1,7 +1,7 @@
1
1
  export interface CallSummary {
2
2
  id: string;
3
3
  agentId: string | null;
4
- phoneNumberId: string;
4
+ phoneNumberId: string | null;
5
5
  phoneNumber: string | null;
6
6
  fromNumber: string;
7
7
  toNumber: string;
@@ -0,0 +1,6 @@
1
+ import type * as AgentPhone from "../index.js";
2
+ export interface ContactListResponse {
3
+ data: AgentPhone.ContactResponse[];
4
+ hasMore: boolean;
5
+ total: number;
6
+ }
@@ -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,9 @@
1
+ export interface ContactResponse {
2
+ id: string;
3
+ phoneNumber: string;
4
+ name: string;
5
+ email?: string | null;
6
+ notes?: string | null;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ }
@@ -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 });
@@ -4,5 +4,7 @@ export interface MessageInConversation {
4
4
  fromNumber: string;
5
5
  toNumber: string;
6
6
  direction: string;
7
+ channel?: string | null;
8
+ mediaUrl?: string | null;
7
9
  receivedAt: string;
8
10
  }
@@ -3,5 +3,7 @@ export interface MessageResponse {
3
3
  from_: string;
4
4
  to: string;
5
5
  body: string;
6
+ direction: string;
7
+ channel?: string | null;
6
8
  receivedAt: string;
7
9
  }
@@ -3,6 +3,7 @@ export interface PhoneNumberResponse {
3
3
  phoneNumber: string;
4
4
  country: string;
5
5
  status: string;
6
+ type?: string;
6
7
  agentId?: string | null;
7
8
  createdAt: string;
8
9
  }
@@ -0,0 +1,7 @@
1
+ export interface SendMessageResponse {
2
+ id: string;
3
+ status: string;
4
+ channel: string;
5
+ from_number: string;
6
+ to_number: string;
7
+ }
@@ -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,6 @@
1
+ export interface SendReactionResponse {
2
+ id: string;
3
+ reaction_type: string;
4
+ message_id: string;
5
+ channel: string;
6
+ }
@@ -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 });
@@ -1,4 +1,5 @@
1
1
  export interface WebhookCreateRequest {
2
2
  url: string;
3
3
  contextLimit?: number | null;
4
+ timeout?: number | null;
4
5
  }
@@ -4,5 +4,6 @@ export interface WebhookResponse {
4
4
  secret: string;
5
5
  status: string;
6
6
  contextLimit: number;
7
+ timeout: number;
7
8
  createdAt: string;
8
9
  }
@@ -9,6 +9,8 @@ export * from "./AppRoutesConversationsConversationSummary.js";
9
9
  export * from "./AttachNumberResponse.js";
10
10
  export * from "./CallListResponse.js";
11
11
  export * from "./CallSummary.js";
12
+ export * from "./ContactListResponse.js";
13
+ export * from "./ContactResponse.js";
12
14
  export * from "./ConversationDetail.js";
13
15
  export * from "./DailyUsagePoint.js";
14
16
  export * from "./DailyUsageResponse.js";
@@ -26,6 +28,8 @@ export * from "./PhoneNumberListResponse.js";
26
28
  export * from "./PhoneNumberResponse.js";
27
29
  export * from "./PlanInfo.js";
28
30
  export * from "./PlanLimits.js";
31
+ export * from "./SendMessageResponse.js";
32
+ export * from "./SendReactionResponse.js";
29
33
  export * from "./UsageResponse.js";
30
34
  export * from "./UsageStats.js";
31
35
  export * from "./ValidationError.js";
@@ -25,6 +25,8 @@ __exportStar(require("./AppRoutesConversationsConversationSummary.js"), exports)
25
25
  __exportStar(require("./AttachNumberResponse.js"), exports);
26
26
  __exportStar(require("./CallListResponse.js"), exports);
27
27
  __exportStar(require("./CallSummary.js"), exports);
28
+ __exportStar(require("./ContactListResponse.js"), exports);
29
+ __exportStar(require("./ContactResponse.js"), exports);
28
30
  __exportStar(require("./ConversationDetail.js"), exports);
29
31
  __exportStar(require("./DailyUsagePoint.js"), exports);
30
32
  __exportStar(require("./DailyUsageResponse.js"), exports);
@@ -42,6 +44,8 @@ __exportStar(require("./PhoneNumberListResponse.js"), exports);
42
44
  __exportStar(require("./PhoneNumberResponse.js"), exports);
43
45
  __exportStar(require("./PlanInfo.js"), exports);
44
46
  __exportStar(require("./PlanLimits.js"), exports);
47
+ __exportStar(require("./SendMessageResponse.js"), exports);
48
+ __exportStar(require("./SendReactionResponse.js"), exports);
45
49
  __exportStar(require("./UsageResponse.js"), exports);
46
50
  __exportStar(require("./UsageStats.js"), exports);
47
51
  __exportStar(require("./ValidationError.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.2";
1
+ export declare const SDK_VERSION = "1.0.3";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.0.2";
4
+ exports.SDK_VERSION = "1.0.3";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentphone",
9
- "X-Fern-SDK-Version": "1.0.1",
10
- "User-Agent": "agentphone/1.0.1",
9
+ "X-Fern-SDK-Version": "1.0.3",
10
+ "User-Agent": "agentphone/1.0.3",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,7 +1,9 @@
1
1
  import { AgentsClient } from "./api/resources/agents/client/Client.mjs";
2
2
  import { AgentWebhooksClient } from "./api/resources/agentWebhooks/client/Client.mjs";
3
3
  import { CallsClient } from "./api/resources/calls/client/Client.mjs";
4
+ import { ContactsClient } from "./api/resources/contacts/client/Client.mjs";
4
5
  import { ConversationsClient } from "./api/resources/conversations/client/Client.mjs";
6
+ import { MessagesClient } from "./api/resources/messages/client/Client.mjs";
5
7
  import { NumbersClient } from "./api/resources/numbers/client/Client.mjs";
6
8
  import { UsageClient } from "./api/resources/usage/client/Client.mjs";
7
9
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
@@ -18,15 +20,19 @@ export declare class AgentPhoneClient {
18
20
  protected _numbers: NumbersClient | undefined;
19
21
  protected _webhooks: WebhooksClient | undefined;
20
22
  protected _agentWebhooks: AgentWebhooksClient | undefined;
23
+ protected _contacts: ContactsClient | undefined;
21
24
  protected _conversations: ConversationsClient | undefined;
22
25
  protected _calls: CallsClient | undefined;
23
26
  protected _usage: UsageClient | undefined;
27
+ protected _messages: MessagesClient | undefined;
24
28
  constructor(options: AgentPhoneClient.Options);
25
29
  get agents(): AgentsClient;
26
30
  get numbers(): NumbersClient;
27
31
  get webhooks(): WebhooksClient;
28
32
  get agentWebhooks(): AgentWebhooksClient;
33
+ get contacts(): ContactsClient;
29
34
  get conversations(): ConversationsClient;
30
35
  get calls(): CallsClient;
31
36
  get usage(): UsageClient;
37
+ get messages(): MessagesClient;
32
38
  }