agentphone 1.0.12 → 1.0.13

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 (108) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +9 -4
  4. package/dist/cjs/api/resources/agents/client/Client.js +11 -11
  5. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
  6. package/dist/cjs/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.ts +2 -0
  7. package/dist/cjs/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.ts +2 -0
  8. package/dist/cjs/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.ts +2 -1
  9. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -0
  10. package/dist/cjs/api/resources/calls/client/Client.js +16 -5
  11. package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +2 -0
  12. package/dist/cjs/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.ts +2 -1
  13. package/dist/cjs/api/resources/contacts/client/Client.js +2 -3
  14. package/dist/cjs/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.ts +2 -1
  15. package/dist/cjs/api/resources/conversations/client/Client.d.ts +5 -3
  16. package/dist/cjs/api/resources/conversations/client/Client.js +7 -6
  17. package/dist/cjs/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.ts +2 -1
  18. package/dist/cjs/api/resources/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/index.js +3 -1
  20. package/dist/cjs/api/resources/numbers/client/Client.js +18 -7
  21. package/dist/cjs/api/resources/numbers/client/requests/CreateNumberRequest.d.ts +2 -0
  22. package/dist/cjs/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.ts +2 -0
  23. package/dist/cjs/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.ts +2 -1
  24. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +61 -0
  25. package/dist/cjs/api/resources/subAccounts/client/Client.js +261 -0
  26. package/dist/cjs/api/resources/subAccounts/client/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/subAccounts/client/index.js +17 -0
  28. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.ts +9 -0
  29. package/dist/cjs/api/resources/subAccounts/client/requests/CreateSubAccountRequest.js +3 -0
  30. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.ts +9 -0
  31. package/dist/cjs/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.js +3 -0
  32. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.ts +11 -0
  33. package/dist/cjs/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.js +3 -0
  34. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +3 -0
  35. package/dist/cjs/api/resources/subAccounts/client/requests/index.js +2 -0
  36. package/dist/cjs/api/resources/subAccounts/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/subAccounts/index.js +17 -0
  38. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +7 -4
  39. package/dist/cjs/api/resources/webhooks/client/Client.js +14 -9
  40. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.ts +14 -0
  41. package/dist/cjs/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.js +3 -0
  42. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.ts +8 -0
  43. package/dist/cjs/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.js +3 -0
  44. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  45. package/dist/cjs/api/types/AppRoutesConversationsConversationSummary.d.ts +6 -0
  46. package/dist/cjs/api/types/ConversationDetail.d.ts +5 -0
  47. package/dist/cjs/api/types/GroupParticipant.d.ts +7 -0
  48. package/dist/cjs/api/types/GroupParticipant.js +3 -0
  49. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  50. package/dist/cjs/api/types/index.d.ts +1 -0
  51. package/dist/cjs/api/types/index.js +1 -0
  52. package/dist/cjs/version.d.ts +1 -1
  53. package/dist/cjs/version.js +1 -1
  54. package/dist/esm/BaseClient.mjs +2 -2
  55. package/dist/esm/Client.d.mts +3 -0
  56. package/dist/esm/Client.mjs +5 -0
  57. package/dist/esm/api/resources/agents/client/Client.mjs +12 -12
  58. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +2 -0
  59. package/dist/esm/api/resources/agents/client/requests/DeleteAgentV1AgentsAgentIdDeleteRequest.d.mts +2 -0
  60. package/dist/esm/api/resources/agents/client/requests/GetAgentV1AgentsAgentIdGetRequest.d.mts +2 -0
  61. package/dist/esm/api/resources/agents/client/requests/ListAgentsV1AgentsGetRequest.d.mts +2 -1
  62. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -0
  63. package/dist/esm/api/resources/calls/client/Client.mjs +17 -6
  64. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +2 -0
  65. package/dist/esm/api/resources/calls/client/requests/ListCallsV1CallsGetRequest.d.mts +2 -1
  66. package/dist/esm/api/resources/contacts/client/Client.mjs +3 -4
  67. package/dist/esm/api/resources/contacts/client/requests/ListContactsV1ContactsGetRequest.d.mts +2 -1
  68. package/dist/esm/api/resources/conversations/client/Client.d.mts +5 -3
  69. package/dist/esm/api/resources/conversations/client/Client.mjs +8 -7
  70. package/dist/esm/api/resources/conversations/client/requests/ListConversationsV1ConversationsGetRequest.d.mts +2 -1
  71. package/dist/esm/api/resources/index.d.mts +2 -0
  72. package/dist/esm/api/resources/index.mjs +2 -0
  73. package/dist/esm/api/resources/numbers/client/Client.mjs +19 -8
  74. package/dist/esm/api/resources/numbers/client/requests/CreateNumberRequest.d.mts +2 -0
  75. package/dist/esm/api/resources/numbers/client/requests/DeleteNumberV1NumbersNumberIdDeleteRequest.d.mts +2 -0
  76. package/dist/esm/api/resources/numbers/client/requests/ListNumbersV1NumbersGetRequest.d.mts +2 -1
  77. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +61 -0
  78. package/dist/esm/api/resources/subAccounts/client/Client.mjs +224 -0
  79. package/dist/esm/api/resources/subAccounts/client/index.d.mts +1 -0
  80. package/dist/esm/api/resources/subAccounts/client/index.mjs +1 -0
  81. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.d.mts +9 -0
  82. package/dist/esm/api/resources/subAccounts/client/requests/CreateSubAccountRequest.mjs +2 -0
  83. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.d.mts +9 -0
  84. package/dist/esm/api/resources/subAccounts/client/requests/DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs +2 -0
  85. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.d.mts +11 -0
  86. package/dist/esm/api/resources/subAccounts/client/requests/UpdateSubAccountRequest.mjs +2 -0
  87. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +3 -0
  88. package/dist/esm/api/resources/subAccounts/client/requests/index.mjs +1 -0
  89. package/dist/esm/api/resources/subAccounts/index.d.mts +1 -0
  90. package/dist/esm/api/resources/subAccounts/index.mjs +1 -0
  91. package/dist/esm/api/resources/webhooks/client/Client.d.mts +7 -4
  92. package/dist/esm/api/resources/webhooks/client/Client.mjs +15 -10
  93. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.d.mts +14 -0
  94. package/dist/esm/api/resources/webhooks/client/requests/CreateOrUpdateWebhookV1WebhooksPostRequest.mjs +2 -0
  95. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.d.mts +8 -0
  96. package/dist/esm/api/resources/webhooks/client/requests/GetWebhookV1WebhooksGetRequest.mjs +2 -0
  97. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  98. package/dist/esm/api/types/AppRoutesConversationsConversationSummary.d.mts +6 -0
  99. package/dist/esm/api/types/ConversationDetail.d.mts +5 -0
  100. package/dist/esm/api/types/GroupParticipant.d.mts +7 -0
  101. package/dist/esm/api/types/GroupParticipant.mjs +2 -0
  102. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  103. package/dist/esm/api/types/index.d.mts +1 -0
  104. package/dist/esm/api/types/index.mjs +1 -0
  105. package/dist/esm/version.d.mts +1 -1
  106. package/dist/esm/version.mjs +1 -1
  107. package/package.json +1 -1
  108. package/reference.md +214 -6
@@ -0,0 +1,224 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
+ import { mergeHeaders } from "../../../../core/headers.mjs";
24
+ import * as core from "../../../../core/index.mjs";
25
+ import * as environments from "../../../../environments.mjs";
26
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
27
+ import * as errors from "../../../../errors/index.mjs";
28
+ import * as AgentPhone from "../../../index.mjs";
29
+ export class SubAccountsClient {
30
+ constructor(options = {}) {
31
+ this._options = normalizeClientOptionsWithAuth(options);
32
+ }
33
+ /**
34
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.subAccounts.listSubAccounts()
38
+ */
39
+ listSubAccounts(requestOptions) {
40
+ return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(requestOptions));
41
+ }
42
+ __listSubAccounts(requestOptions) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
46
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
47
+ const _response = yield core.fetcher({
48
+ 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/sub-accounts"),
49
+ method: "GET",
50
+ headers: _headers,
51
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
52
+ 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,
53
+ 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,
54
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
55
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
56
+ logging: this._options.logging,
57
+ });
58
+ if (_response.ok) {
59
+ return { data: _response.body, rawResponse: _response.rawResponse };
60
+ }
61
+ if (_response.error.reason === "status-code") {
62
+ throw new errors.AgentPhoneError({
63
+ statusCode: _response.error.statusCode,
64
+ body: _response.error.body,
65
+ rawResponse: _response.rawResponse,
66
+ });
67
+ }
68
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/sub-accounts");
69
+ });
70
+ }
71
+ /**
72
+ * @param {AgentPhone.CreateSubAccountRequest} request
73
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link AgentPhone.UnprocessableEntityError}
76
+ *
77
+ * @example
78
+ * await client.subAccounts.createSubAccount({
79
+ * name: "name"
80
+ * })
81
+ */
82
+ createSubAccount(request, requestOptions) {
83
+ return core.HttpResponsePromise.fromPromise(this.__createSubAccount(request, requestOptions));
84
+ }
85
+ __createSubAccount(request, requestOptions) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
88
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
89
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
90
+ const _response = yield core.fetcher({
91
+ 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/sub-accounts"),
92
+ method: "POST",
93
+ headers: _headers,
94
+ contentType: "application/json",
95
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
96
+ requestType: "json",
97
+ body: request,
98
+ 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,
99
+ 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,
100
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
101
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
102
+ logging: this._options.logging,
103
+ });
104
+ if (_response.ok) {
105
+ return { data: _response.body, rawResponse: _response.rawResponse };
106
+ }
107
+ if (_response.error.reason === "status-code") {
108
+ switch (_response.error.statusCode) {
109
+ case 422:
110
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
111
+ default:
112
+ throw new errors.AgentPhoneError({
113
+ statusCode: _response.error.statusCode,
114
+ body: _response.error.body,
115
+ rawResponse: _response.rawResponse,
116
+ });
117
+ }
118
+ }
119
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/sub-accounts");
120
+ });
121
+ }
122
+ /**
123
+ * @param {AgentPhone.DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest} request
124
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
125
+ *
126
+ * @throws {@link AgentPhone.UnprocessableEntityError}
127
+ *
128
+ * @example
129
+ * await client.subAccounts.deleteSubAccount({
130
+ * sub_account_id: "sub_account_id"
131
+ * })
132
+ */
133
+ deleteSubAccount(request, requestOptions) {
134
+ return core.HttpResponsePromise.fromPromise(this.__deleteSubAccount(request, requestOptions));
135
+ }
136
+ __deleteSubAccount(request, requestOptions) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
139
+ const { sub_account_id: subAccountId } = request;
140
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
141
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
142
+ const _response = yield core.fetcher({
143
+ 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/sub-accounts/${core.url.encodePathParam(subAccountId)}`),
144
+ method: "DELETE",
145
+ headers: _headers,
146
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
147
+ 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,
148
+ 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,
149
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
150
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
151
+ logging: this._options.logging,
152
+ });
153
+ if (_response.ok) {
154
+ return { data: _response.body, rawResponse: _response.rawResponse };
155
+ }
156
+ if (_response.error.reason === "status-code") {
157
+ switch (_response.error.statusCode) {
158
+ case 422:
159
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
160
+ default:
161
+ throw new errors.AgentPhoneError({
162
+ statusCode: _response.error.statusCode,
163
+ body: _response.error.body,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ }
168
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/sub-accounts/{sub_account_id}");
169
+ });
170
+ }
171
+ /**
172
+ * @param {AgentPhone.UpdateSubAccountRequest} request
173
+ * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
174
+ *
175
+ * @throws {@link AgentPhone.UnprocessableEntityError}
176
+ *
177
+ * @example
178
+ * await client.subAccounts.updateSubAccount({
179
+ * sub_account_id: "sub_account_id",
180
+ * name: "name"
181
+ * })
182
+ */
183
+ updateSubAccount(request, requestOptions) {
184
+ return core.HttpResponsePromise.fromPromise(this.__updateSubAccount(request, requestOptions));
185
+ }
186
+ __updateSubAccount(request, requestOptions) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
189
+ const { sub_account_id: subAccountId } = request, _body = __rest(request, ["sub_account_id"]);
190
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
191
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
192
+ const _response = yield core.fetcher({
193
+ 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/sub-accounts/${core.url.encodePathParam(subAccountId)}`),
194
+ method: "PATCH",
195
+ headers: _headers,
196
+ contentType: "application/json",
197
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
198
+ requestType: "json",
199
+ body: _body,
200
+ 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,
201
+ 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,
202
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
203
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
204
+ logging: this._options.logging,
205
+ });
206
+ if (_response.ok) {
207
+ return { data: _response.body, rawResponse: _response.rawResponse };
208
+ }
209
+ if (_response.error.reason === "status-code") {
210
+ switch (_response.error.statusCode) {
211
+ case 422:
212
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
213
+ default:
214
+ throw new errors.AgentPhoneError({
215
+ statusCode: _response.error.statusCode,
216
+ body: _response.error.body,
217
+ rawResponse: _response.rawResponse,
218
+ });
219
+ }
220
+ }
221
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/sub-accounts/{sub_account_id}");
222
+ });
223
+ }
224
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * name: "name"
5
+ * }
6
+ */
7
+ export interface CreateSubAccountRequest {
8
+ name: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * sub_account_id: "sub_account_id"
5
+ * }
6
+ */
7
+ export interface DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest {
8
+ sub_account_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * sub_account_id: "sub_account_id",
5
+ * name: "name"
6
+ * }
7
+ */
8
+ export interface UpdateSubAccountRequest {
9
+ sub_account_id: string;
10
+ name: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { CreateSubAccountRequest } from "./CreateSubAccountRequest.mjs";
2
+ export type { DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest } from "./DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs";
3
+ export type { UpdateSubAccountRequest } from "./UpdateSubAccountRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -13,12 +13,13 @@ export declare class WebhooksClient {
13
13
  /**
14
14
  * Get the master webhook configuration for this account.
15
15
  *
16
+ * @param {AgentPhone.GetWebhookV1WebhooksGetRequest} request
16
17
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
17
18
  *
18
19
  * @example
19
20
  * await client.webhooks.getWebhook()
20
21
  */
21
- getWebhook(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse | null>;
22
+ getWebhook(request?: AgentPhone.GetWebhookV1WebhooksGetRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse | null>;
22
23
  private __getWebhook;
23
24
  /**
24
25
  * Register or update the webhook URL for this account.
@@ -29,17 +30,19 @@ export declare class WebhooksClient {
29
30
  * contextLimit: Number of recent messages to include in webhook payloads (0-50, default: 10).
30
31
  * Set to 0 to disable history in webhooks.
31
32
  *
32
- * @param {AgentPhone.WebhookCreateRequest} request
33
+ * @param {AgentPhone.CreateOrUpdateWebhookV1WebhooksPostRequest} request
33
34
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
34
35
  *
35
36
  * @throws {@link AgentPhone.UnprocessableEntityError}
36
37
  *
37
38
  * @example
38
39
  * await client.webhooks.createOrUpdateWebhook({
39
- * url: "url"
40
+ * body: {
41
+ * url: "url"
42
+ * }
40
43
  * })
41
44
  */
42
- createOrUpdateWebhook(request: AgentPhone.WebhookCreateRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse>;
45
+ createOrUpdateWebhook(request: AgentPhone.CreateOrUpdateWebhookV1WebhooksPostRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<AgentPhone.WebhookResponse>;
43
46
  private __createOrUpdateWebhook;
44
47
  /**
45
48
  * Remove the master webhook for this account.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import * as environments from "../../../../environments.mjs";
15
15
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -22,19 +22,21 @@ export class WebhooksClient {
22
22
  /**
23
23
  * Get the master webhook configuration for this account.
24
24
  *
25
+ * @param {AgentPhone.GetWebhookV1WebhooksGetRequest} request
25
26
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
26
27
  *
27
28
  * @example
28
29
  * await client.webhooks.getWebhook()
29
30
  */
30
- getWebhook(requestOptions) {
31
- return core.HttpResponsePromise.fromPromise(this.__getWebhook(requestOptions));
31
+ getWebhook(request = {}, requestOptions) {
32
+ return core.HttpResponsePromise.fromPromise(this.__getWebhook(request, requestOptions));
32
33
  }
33
- __getWebhook(requestOptions) {
34
- return __awaiter(this, void 0, void 0, function* () {
34
+ __getWebhook() {
35
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
35
36
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
37
+ const { "X-Sub-Account-Id": subAccountId } = request;
36
38
  const _authRequest = yield this._options.authProvider.getAuthRequest();
37
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
39
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
38
40
  const _response = yield core.fetcher({
39
41
  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/webhooks"),
40
42
  method: "GET",
@@ -68,14 +70,16 @@ export class WebhooksClient {
68
70
  * contextLimit: Number of recent messages to include in webhook payloads (0-50, default: 10).
69
71
  * Set to 0 to disable history in webhooks.
70
72
  *
71
- * @param {AgentPhone.WebhookCreateRequest} request
73
+ * @param {AgentPhone.CreateOrUpdateWebhookV1WebhooksPostRequest} request
72
74
  * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
73
75
  *
74
76
  * @throws {@link AgentPhone.UnprocessableEntityError}
75
77
  *
76
78
  * @example
77
79
  * await client.webhooks.createOrUpdateWebhook({
78
- * url: "url"
80
+ * body: {
81
+ * url: "url"
82
+ * }
79
83
  * })
80
84
  */
81
85
  createOrUpdateWebhook(request, requestOptions) {
@@ -84,8 +88,9 @@ export class WebhooksClient {
84
88
  __createOrUpdateWebhook(request, requestOptions) {
85
89
  return __awaiter(this, void 0, void 0, function* () {
86
90
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
91
+ const { "X-Sub-Account-Id": subAccountId, body: _body } = request;
87
92
  const _authRequest = yield this._options.authProvider.getAuthRequest();
88
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
93
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
89
94
  const _response = yield core.fetcher({
90
95
  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/webhooks"),
91
96
  method: "POST",
@@ -93,7 +98,7 @@ export class WebhooksClient {
93
98
  contentType: "application/json",
94
99
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
95
100
  requestType: "json",
96
- body: request,
101
+ body: _body,
97
102
  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,
98
103
  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,
99
104
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1,14 @@
1
+ import type * as AgentPhone from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * body: {
6
+ * url: "url"
7
+ * }
8
+ * }
9
+ */
10
+ export interface CreateOrUpdateWebhookV1WebhooksPostRequest {
11
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
12
+ "X-Sub-Account-Id"?: string;
13
+ body: AgentPhone.WebhookCreateRequest;
14
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface GetWebhookV1WebhooksGetRequest {
6
+ /** Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account. */
7
+ "X-Sub-Account-Id"?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,5 @@
1
+ export type { CreateOrUpdateWebhookV1WebhooksPostRequest } from "./CreateOrUpdateWebhookV1WebhooksPostRequest.mjs";
1
2
  export type { DeliveryStatsV1WebhooksDeliveriesStatsGetRequest } from "./DeliveryStatsV1WebhooksDeliveriesStatsGetRequest.mjs";
3
+ export type { GetWebhookV1WebhooksGetRequest } from "./GetWebhookV1WebhooksGetRequest.mjs";
2
4
  export type { ListDeliveriesV1WebhooksDeliveriesGetRequest } from "./ListDeliveriesV1WebhooksDeliveriesGetRequest.mjs";
3
5
  export type { TestWebhookV1WebhooksTestPostRequest } from "./TestWebhookV1WebhooksTestPostRequest.mjs";
@@ -1,9 +1,15 @@
1
+ import type * as AgentPhone from "../index.mjs";
1
2
  export interface AppRoutesConversationsConversationSummary {
2
3
  id: string;
3
4
  agentId?: string | null;
4
5
  phoneNumberId: string;
5
6
  phoneNumber: string;
6
7
  participant: string;
8
+ isGroup?: boolean;
9
+ groupId?: string | null;
10
+ groupName?: string | null;
11
+ groupIconUrl?: string | null;
12
+ participants?: AgentPhone.GroupParticipant[] | null;
7
13
  lastMessageAt: string;
8
14
  lastMessagePreview: string;
9
15
  messageCount: number;
@@ -5,6 +5,11 @@ export interface ConversationDetail {
5
5
  phoneNumberId: string;
6
6
  phoneNumber: string;
7
7
  participant: string;
8
+ isGroup?: boolean;
9
+ groupId?: string | null;
10
+ groupName?: string | null;
11
+ groupIconUrl?: string | null;
12
+ participants?: AgentPhone.GroupParticipant[] | null;
8
13
  lastMessageAt: string;
9
14
  messageCount: number;
10
15
  metadata?: Record<string, unknown> | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A member of a group chat, mirrored from Conversation.participants.
3
+ */
4
+ export interface GroupParticipant {
5
+ identifier: string;
6
+ name?: string | null;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -5,6 +5,7 @@ export interface MessageInConversation {
5
5
  fromNumber: string;
6
6
  toNumber: string;
7
7
  direction: string;
8
+ senderIdentifier?: string | null;
8
9
  channel?: string | null;
9
10
  mediaUrl?: string | null;
10
11
  mediaUrls?: string[];
@@ -21,6 +21,7 @@ export * from "./DailyUsagePoint.mjs";
21
21
  export * from "./DailyUsageResponse.mjs";
22
22
  export * from "./DeleteAgentResponse.mjs";
23
23
  export * from "./FieldWarning.mjs";
24
+ export * from "./GroupParticipant.mjs";
24
25
  export * from "./HttpValidationError.mjs";
25
26
  export * from "./MessageInConversation.mjs";
26
27
  export * from "./MessageListResponse.mjs";
@@ -21,6 +21,7 @@ export * from "./DailyUsagePoint.mjs";
21
21
  export * from "./DailyUsageResponse.mjs";
22
22
  export * from "./DeleteAgentResponse.mjs";
23
23
  export * from "./FieldWarning.mjs";
24
+ export * from "./GroupParticipant.mjs";
24
25
  export * from "./HttpValidationError.mjs";
25
26
  export * from "./MessageInConversation.mjs";
26
27
  export * from "./MessageListResponse.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.12";
1
+ export declare const SDK_VERSION = "1.0.13";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.12";
1
+ export const SDK_VERSION = "1.0.13";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentphone",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",