agentphone 1.0.10 → 1.0.11

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 (84) 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 +13 -8
  4. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/agents/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +6 -0
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +6 -0
  8. package/dist/cjs/api/resources/calls/client/Client.d.ts +4 -4
  9. package/dist/cjs/api/resources/calls/client/Client.js +4 -4
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +39 -1
  11. package/dist/cjs/api/resources/conversations/client/Client.js +114 -1
  12. package/dist/cjs/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.d.ts +9 -0
  13. package/dist/cjs/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.js +3 -0
  14. package/dist/cjs/api/resources/conversations/client/requests/SetBackgroundRequest.d.ts +12 -0
  15. package/dist/cjs/api/resources/conversations/client/requests/SetBackgroundRequest.js +3 -0
  16. package/dist/cjs/api/resources/conversations/client/requests/index.d.ts +2 -0
  17. package/dist/cjs/api/resources/index.d.ts +2 -0
  18. package/dist/cjs/api/resources/index.js +3 -1
  19. package/dist/cjs/api/resources/integrations/client/Client.d.ts +64 -0
  20. package/dist/cjs/api/resources/integrations/client/Client.js +268 -0
  21. package/dist/cjs/api/resources/integrations/client/index.d.ts +1 -0
  22. package/dist/cjs/api/resources/integrations/client/index.js +17 -0
  23. package/dist/cjs/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.d.ts +9 -0
  24. package/dist/cjs/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.js +3 -0
  25. package/dist/cjs/api/resources/integrations/client/requests/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/integrations/client/requests/index.js +2 -0
  27. package/dist/cjs/api/resources/integrations/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/integrations/index.js +17 -0
  29. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +2 -0
  30. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.d.ts +2 -14
  31. package/dist/cjs/api/resources/messages/client/requests/SendReactionRequest.js +0 -13
  32. package/dist/cjs/api/resources/messages/client/requests/index.d.ts +1 -1
  33. package/dist/cjs/api/resources/messages/client/requests/index.js +1 -3
  34. package/dist/cjs/api/types/AgentResponse.d.ts +6 -0
  35. package/dist/cjs/api/types/SendMessageResponse.d.ts +2 -0
  36. package/dist/cjs/api/types/SetBackgroundResponse.d.ts +8 -0
  37. package/dist/cjs/api/types/SetBackgroundResponse.js +3 -0
  38. package/dist/cjs/api/types/index.d.ts +1 -0
  39. package/dist/cjs/api/types/index.js +1 -0
  40. package/dist/cjs/version.d.ts +1 -1
  41. package/dist/cjs/version.js +1 -1
  42. package/dist/esm/BaseClient.mjs +2 -2
  43. package/dist/esm/Client.d.mts +3 -0
  44. package/dist/esm/Client.mjs +5 -0
  45. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  46. package/dist/esm/api/resources/agents/client/Client.mjs +1 -1
  47. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +6 -0
  48. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +6 -0
  49. package/dist/esm/api/resources/calls/client/Client.d.mts +4 -4
  50. package/dist/esm/api/resources/calls/client/Client.mjs +4 -4
  51. package/dist/esm/api/resources/conversations/client/Client.d.mts +39 -1
  52. package/dist/esm/api/resources/conversations/client/Client.mjs +114 -1
  53. package/dist/esm/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.d.mts +9 -0
  54. package/dist/esm/api/resources/conversations/client/requests/RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.mjs +2 -0
  55. package/dist/esm/api/resources/conversations/client/requests/SetBackgroundRequest.d.mts +12 -0
  56. package/dist/esm/api/resources/conversations/client/requests/SetBackgroundRequest.mjs +2 -0
  57. package/dist/esm/api/resources/conversations/client/requests/index.d.mts +2 -0
  58. package/dist/esm/api/resources/index.d.mts +2 -0
  59. package/dist/esm/api/resources/index.mjs +2 -0
  60. package/dist/esm/api/resources/integrations/client/Client.d.mts +64 -0
  61. package/dist/esm/api/resources/integrations/client/Client.mjs +231 -0
  62. package/dist/esm/api/resources/integrations/client/index.d.mts +1 -0
  63. package/dist/esm/api/resources/integrations/client/index.mjs +1 -0
  64. package/dist/esm/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.d.mts +9 -0
  65. package/dist/esm/api/resources/integrations/client/requests/SupabaseConnectIntegrationsSupabaseConnectGetRequest.mjs +2 -0
  66. package/dist/esm/api/resources/integrations/client/requests/index.d.mts +1 -0
  67. package/dist/esm/api/resources/integrations/client/requests/index.mjs +1 -0
  68. package/dist/esm/api/resources/integrations/index.d.mts +1 -0
  69. package/dist/esm/api/resources/integrations/index.mjs +1 -0
  70. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +2 -0
  71. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.d.mts +2 -14
  72. package/dist/esm/api/resources/messages/client/requests/SendReactionRequest.mjs +1 -12
  73. package/dist/esm/api/resources/messages/client/requests/index.d.mts +1 -1
  74. package/dist/esm/api/resources/messages/client/requests/index.mjs +0 -1
  75. package/dist/esm/api/types/AgentResponse.d.mts +6 -0
  76. package/dist/esm/api/types/SendMessageResponse.d.mts +2 -0
  77. package/dist/esm/api/types/SetBackgroundResponse.d.mts +8 -0
  78. package/dist/esm/api/types/SetBackgroundResponse.mjs +2 -0
  79. package/dist/esm/api/types/index.d.mts +1 -0
  80. package/dist/esm/api/types/index.mjs +1 -0
  81. package/dist/esm/version.d.mts +1 -1
  82. package/dist/esm/version.mjs +1 -1
  83. package/package.json +1 -1
  84. package/reference.md +402 -6
@@ -14,7 +14,7 @@ export declare class ConversationsClient {
14
14
  * List all conversations for this account.
15
15
  *
16
16
  * Sorted by most recent activity (lastMessageAt desc).
17
- * Also includes conversations on shared lines owned by this account.
17
+ * Sorted by most recent activity.
18
18
  *
19
19
  * @param {AgentPhone.ListConversationsV1ConversationsGetRequest} request
20
20
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -99,4 +99,42 @@ export declare class ConversationsClient {
99
99
  */
100
100
  sendTypingIndicator(request: AgentPhone.SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.SendTypingResponse>;
101
101
  private __sendTypingIndicator;
102
+ /**
103
+ * Set a custom wallpaper for the chat (iMessage only).
104
+ *
105
+ * Customer sends `image_url`; we fetch (≤10MB, JPEG/PNG/GIF/WebP/HEIC),
106
+ * validate, and forward as multipart to the iMessage provider. Idempotent —
107
+ * re-setting replaces. Recipients on iOS < 18 fall back to the default
108
+ * silently.
109
+ *
110
+ * @param {AgentPhone.SetBackgroundRequest} request
111
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link AgentPhone.UnprocessableEntityError}
114
+ *
115
+ * @example
116
+ * await client.conversations.setChatBackground({
117
+ * conversation_id: "conversation_id",
118
+ * image_url: "https://example.com/wallpaper.jpg"
119
+ * })
120
+ */
121
+ setChatBackground(request: AgentPhone.SetBackgroundRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.SetBackgroundResponse>;
122
+ private __setChatBackground;
123
+ /**
124
+ * Clear the custom wallpaper for the chat (iMessage only).
125
+ *
126
+ * Idempotent: deleting a default-background chat returns 204 (no-op).
127
+ *
128
+ * @param {AgentPhone.RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest} request
129
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
130
+ *
131
+ * @throws {@link AgentPhone.UnprocessableEntityError}
132
+ *
133
+ * @example
134
+ * await client.conversations.removeChatBackground({
135
+ * conversation_id: "conversation_id"
136
+ * })
137
+ */
138
+ removeChatBackground(request: AgentPhone.RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<void>;
139
+ private __removeChatBackground;
102
140
  }
@@ -34,7 +34,7 @@ export class ConversationsClient {
34
34
  * List all conversations for this account.
35
35
  *
36
36
  * Sorted by most recent activity (lastMessageAt desc).
37
- * Also includes conversations on shared lines owned by this account.
37
+ * Sorted by most recent activity.
38
38
  *
39
39
  * @param {AgentPhone.ListConversationsV1ConversationsGetRequest} request
40
40
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -317,4 +317,117 @@ export class ConversationsClient {
317
317
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/conversations/{conversation_id}/typing");
318
318
  });
319
319
  }
320
+ /**
321
+ * Set a custom wallpaper for the chat (iMessage only).
322
+ *
323
+ * Customer sends `image_url`; we fetch (≤10MB, JPEG/PNG/GIF/WebP/HEIC),
324
+ * validate, and forward as multipart to the iMessage provider. Idempotent —
325
+ * re-setting replaces. Recipients on iOS < 18 fall back to the default
326
+ * silently.
327
+ *
328
+ * @param {AgentPhone.SetBackgroundRequest} request
329
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
330
+ *
331
+ * @throws {@link AgentPhone.UnprocessableEntityError}
332
+ *
333
+ * @example
334
+ * await client.conversations.setChatBackground({
335
+ * conversation_id: "conversation_id",
336
+ * image_url: "https://example.com/wallpaper.jpg"
337
+ * })
338
+ */
339
+ setChatBackground(request, requestOptions) {
340
+ return core.HttpResponsePromise.fromPromise(this.__setChatBackground(request, requestOptions));
341
+ }
342
+ __setChatBackground(request, requestOptions) {
343
+ return __awaiter(this, void 0, void 0, function* () {
344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
345
+ const { conversation_id: conversationId } = request, _body = __rest(request, ["conversation_id"]);
346
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
347
+ 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);
348
+ const _response = yield core.fetcher({
349
+ 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/conversations/${core.url.encodePathParam(conversationId)}/background`),
350
+ method: "POST",
351
+ headers: _headers,
352
+ contentType: "application/json",
353
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
354
+ requestType: "json",
355
+ body: _body,
356
+ 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,
357
+ 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,
358
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
359
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
360
+ logging: this._options.logging,
361
+ });
362
+ if (_response.ok) {
363
+ return { data: _response.body, rawResponse: _response.rawResponse };
364
+ }
365
+ if (_response.error.reason === "status-code") {
366
+ switch (_response.error.statusCode) {
367
+ case 422:
368
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
369
+ default:
370
+ throw new errors.AgentPhoneError({
371
+ statusCode: _response.error.statusCode,
372
+ body: _response.error.body,
373
+ rawResponse: _response.rawResponse,
374
+ });
375
+ }
376
+ }
377
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/conversations/{conversation_id}/background");
378
+ });
379
+ }
380
+ /**
381
+ * Clear the custom wallpaper for the chat (iMessage only).
382
+ *
383
+ * Idempotent: deleting a default-background chat returns 204 (no-op).
384
+ *
385
+ * @param {AgentPhone.RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest} request
386
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
387
+ *
388
+ * @throws {@link AgentPhone.UnprocessableEntityError}
389
+ *
390
+ * @example
391
+ * await client.conversations.removeChatBackground({
392
+ * conversation_id: "conversation_id"
393
+ * })
394
+ */
395
+ removeChatBackground(request, requestOptions) {
396
+ return core.HttpResponsePromise.fromPromise(this.__removeChatBackground(request, requestOptions));
397
+ }
398
+ __removeChatBackground(request, requestOptions) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
401
+ const { conversation_id: conversationId } = request;
402
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
403
+ 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);
404
+ const _response = yield core.fetcher({
405
+ 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/conversations/${core.url.encodePathParam(conversationId)}/background`),
406
+ method: "DELETE",
407
+ headers: _headers,
408
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
409
+ 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,
410
+ 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,
411
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
412
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
413
+ logging: this._options.logging,
414
+ });
415
+ if (_response.ok) {
416
+ return { data: undefined, rawResponse: _response.rawResponse };
417
+ }
418
+ if (_response.error.reason === "status-code") {
419
+ switch (_response.error.statusCode) {
420
+ case 422:
421
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
422
+ default:
423
+ throw new errors.AgentPhoneError({
424
+ statusCode: _response.error.statusCode,
425
+ body: _response.error.body,
426
+ rawResponse: _response.rawResponse,
427
+ });
428
+ }
429
+ }
430
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/conversations/{conversation_id}/background");
431
+ });
432
+ }
320
433
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * conversation_id: "conversation_id"
5
+ * }
6
+ */
7
+ export interface RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest {
8
+ conversation_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * conversation_id: "conversation_id",
5
+ * image_url: "https://example.com/wallpaper.jpg"
6
+ * }
7
+ */
8
+ export interface SetBackgroundRequest {
9
+ conversation_id: string;
10
+ /** HTTPS URL of the background image. JPEG/PNG/GIF/WebP/HEIC, max 10MB. Recipients on iOS < 18 see the default background; no error is raised. */
11
+ image_url: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,7 @@
1
1
  export type { GetConversationMessagesV1ConversationsConversationIdMessagesGetRequest } from "./GetConversationMessagesV1ConversationsConversationIdMessagesGetRequest.mjs";
2
2
  export type { GetConversationV1ConversationsConversationIdGetRequest } from "./GetConversationV1ConversationsConversationIdGetRequest.mjs";
3
3
  export type { ListConversationsV1ConversationsGetRequest } from "./ListConversationsV1ConversationsGetRequest.mjs";
4
+ export type { RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest } from "./RemoveChatBackgroundV1ConversationsConversationIdBackgroundDeleteRequest.mjs";
4
5
  export type { SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest } from "./SendTypingIndicatorV1ConversationsConversationIdTypingPostRequest.mjs";
6
+ export type { SetBackgroundRequest } from "./SetBackgroundRequest.mjs";
5
7
  export type { UpdateConversationRequest } from "./UpdateConversationRequest.mjs";
@@ -12,6 +12,8 @@ export * from "./contacts/client/requests/index.mjs";
12
12
  export * as contacts from "./contacts/index.mjs";
13
13
  export * from "./conversations/client/requests/index.mjs";
14
14
  export * as conversations from "./conversations/index.mjs";
15
+ export * from "./integrations/client/requests/index.mjs";
16
+ export * as integrations from "./integrations/index.mjs";
15
17
  export * from "./messages/client/requests/index.mjs";
16
18
  export * as messages from "./messages/index.mjs";
17
19
  export * from "./numbers/client/requests/index.mjs";
@@ -12,6 +12,8 @@ export * from "./contacts/client/requests/index.mjs";
12
12
  export * as contacts from "./contacts/index.mjs";
13
13
  export * from "./conversations/client/requests/index.mjs";
14
14
  export * as conversations from "./conversations/index.mjs";
15
+ export * from "./integrations/client/requests/index.mjs";
16
+ export * as integrations from "./integrations/index.mjs";
15
17
  export * from "./messages/client/requests/index.mjs";
16
18
  export * as messages from "./messages/index.mjs";
17
19
  export * from "./numbers/client/requests/index.mjs";
@@ -0,0 +1,64 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as AgentPhone from "../../../index.mjs";
5
+ export declare namespace IntegrationsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class IntegrationsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<IntegrationsClient.Options>;
12
+ constructor(options?: IntegrationsClient.Options);
13
+ /**
14
+ * Exchange a one-time connect code and redirect to Supabase OAuth.
15
+ *
16
+ * @param {AgentPhone.SupabaseConnectIntegrationsSupabaseConnectGetRequest} request
17
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link AgentPhone.UnprocessableEntityError}
20
+ *
21
+ * @example
22
+ * await client.integrations.supabaseConnect({
23
+ * code: "code"
24
+ * })
25
+ */
26
+ supabaseConnect(request: AgentPhone.SupabaseConnectIntegrationsSupabaseConnectGetRequest, requestOptions?: IntegrationsClient.RequestOptions): core.HttpResponsePromise<unknown>;
27
+ private __supabaseConnect;
28
+ /**
29
+ * Create a short-lived one-time code for initiating the Supabase OAuth flow.
30
+ *
31
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @example
34
+ * await client.integrations.supabaseConnectCode()
35
+ */
36
+ supabaseConnectCode(requestOptions?: IntegrationsClient.RequestOptions): core.HttpResponsePromise<unknown>;
37
+ private __supabaseConnectCode;
38
+ /**
39
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
40
+ *
41
+ * @example
42
+ * await client.integrations.supabaseStatus()
43
+ */
44
+ supabaseStatus(requestOptions?: IntegrationsClient.RequestOptions): core.HttpResponsePromise<unknown>;
45
+ private __supabaseStatus;
46
+ /**
47
+ * Get a valid Supabase access token, auto-refreshing if expired.
48
+ *
49
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
50
+ *
51
+ * @example
52
+ * await client.integrations.supabaseToken()
53
+ */
54
+ supabaseToken(requestOptions?: IntegrationsClient.RequestOptions): core.HttpResponsePromise<unknown>;
55
+ private __supabaseToken;
56
+ /**
57
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
58
+ *
59
+ * @example
60
+ * await client.integrations.supabaseDisconnect()
61
+ */
62
+ supabaseDisconnect(requestOptions?: IntegrationsClient.RequestOptions): core.HttpResponsePromise<unknown>;
63
+ private __supabaseDisconnect;
64
+ }
@@ -0,0 +1,231 @@
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 { normalizeClientOptionsWithAuth } 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 IntegrationsClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Exchange a one-time connect code and redirect to Supabase OAuth.
24
+ *
25
+ * @param {AgentPhone.SupabaseConnectIntegrationsSupabaseConnectGetRequest} request
26
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link AgentPhone.UnprocessableEntityError}
29
+ *
30
+ * @example
31
+ * await client.integrations.supabaseConnect({
32
+ * code: "code"
33
+ * })
34
+ */
35
+ supabaseConnect(request, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__supabaseConnect(request, requestOptions));
37
+ }
38
+ __supabaseConnect(request, requestOptions) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ const { code } = request;
42
+ const _queryParams = {
43
+ code,
44
+ };
45
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
46
+ const _response = yield core.fetcher({
47
+ 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, "integrations/supabase/connect"),
48
+ method: "GET",
49
+ headers: _headers,
50
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
51
+ 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,
52
+ 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,
53
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
54
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
55
+ logging: this._options.logging,
56
+ });
57
+ if (_response.ok) {
58
+ return { data: _response.body, rawResponse: _response.rawResponse };
59
+ }
60
+ if (_response.error.reason === "status-code") {
61
+ switch (_response.error.statusCode) {
62
+ case 422:
63
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
64
+ default:
65
+ throw new errors.AgentPhoneError({
66
+ statusCode: _response.error.statusCode,
67
+ body: _response.error.body,
68
+ rawResponse: _response.rawResponse,
69
+ });
70
+ }
71
+ }
72
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/integrations/supabase/connect");
73
+ });
74
+ }
75
+ /**
76
+ * Create a short-lived one-time code for initiating the Supabase OAuth flow.
77
+ *
78
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
79
+ *
80
+ * @example
81
+ * await client.integrations.supabaseConnectCode()
82
+ */
83
+ supabaseConnectCode(requestOptions) {
84
+ return core.HttpResponsePromise.fromPromise(this.__supabaseConnectCode(requestOptions));
85
+ }
86
+ __supabaseConnectCode(requestOptions) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
90
+ 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);
91
+ const _response = yield core.fetcher({
92
+ 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, "integrations/supabase/connect"),
93
+ method: "POST",
94
+ headers: _headers,
95
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
96
+ 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,
97
+ 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,
98
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
99
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
100
+ logging: this._options.logging,
101
+ });
102
+ if (_response.ok) {
103
+ return { data: _response.body, rawResponse: _response.rawResponse };
104
+ }
105
+ if (_response.error.reason === "status-code") {
106
+ throw new errors.AgentPhoneError({
107
+ statusCode: _response.error.statusCode,
108
+ body: _response.error.body,
109
+ rawResponse: _response.rawResponse,
110
+ });
111
+ }
112
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/integrations/supabase/connect");
113
+ });
114
+ }
115
+ /**
116
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
117
+ *
118
+ * @example
119
+ * await client.integrations.supabaseStatus()
120
+ */
121
+ supabaseStatus(requestOptions) {
122
+ return core.HttpResponsePromise.fromPromise(this.__supabaseStatus(requestOptions));
123
+ }
124
+ __supabaseStatus(requestOptions) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
127
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
128
+ 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);
129
+ const _response = yield core.fetcher({
130
+ 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, "integrations/supabase/status"),
131
+ method: "GET",
132
+ headers: _headers,
133
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
134
+ 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,
135
+ 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,
136
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
137
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
138
+ logging: this._options.logging,
139
+ });
140
+ if (_response.ok) {
141
+ return { data: _response.body, rawResponse: _response.rawResponse };
142
+ }
143
+ if (_response.error.reason === "status-code") {
144
+ throw new errors.AgentPhoneError({
145
+ statusCode: _response.error.statusCode,
146
+ body: _response.error.body,
147
+ rawResponse: _response.rawResponse,
148
+ });
149
+ }
150
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/integrations/supabase/status");
151
+ });
152
+ }
153
+ /**
154
+ * Get a valid Supabase access token, auto-refreshing if expired.
155
+ *
156
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
157
+ *
158
+ * @example
159
+ * await client.integrations.supabaseToken()
160
+ */
161
+ supabaseToken(requestOptions) {
162
+ return core.HttpResponsePromise.fromPromise(this.__supabaseToken(requestOptions));
163
+ }
164
+ __supabaseToken(requestOptions) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
167
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
168
+ 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);
169
+ const _response = yield core.fetcher({
170
+ 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, "integrations/supabase/token"),
171
+ method: "GET",
172
+ headers: _headers,
173
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
174
+ 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,
175
+ 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,
176
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
177
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
178
+ logging: this._options.logging,
179
+ });
180
+ if (_response.ok) {
181
+ return { data: _response.body, rawResponse: _response.rawResponse };
182
+ }
183
+ if (_response.error.reason === "status-code") {
184
+ throw new errors.AgentPhoneError({
185
+ statusCode: _response.error.statusCode,
186
+ body: _response.error.body,
187
+ rawResponse: _response.rawResponse,
188
+ });
189
+ }
190
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/integrations/supabase/token");
191
+ });
192
+ }
193
+ /**
194
+ * @param {IntegrationsClient.RequestOptions} requestOptions - Request-specific configuration.
195
+ *
196
+ * @example
197
+ * await client.integrations.supabaseDisconnect()
198
+ */
199
+ supabaseDisconnect(requestOptions) {
200
+ return core.HttpResponsePromise.fromPromise(this.__supabaseDisconnect(requestOptions));
201
+ }
202
+ __supabaseDisconnect(requestOptions) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
205
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
206
+ 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);
207
+ const _response = yield core.fetcher({
208
+ 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, "integrations/supabase"),
209
+ method: "DELETE",
210
+ headers: _headers,
211
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
212
+ 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,
213
+ 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,
214
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
215
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
216
+ logging: this._options.logging,
217
+ });
218
+ if (_response.ok) {
219
+ return { data: _response.body, rawResponse: _response.rawResponse };
220
+ }
221
+ if (_response.error.reason === "status-code") {
222
+ throw new errors.AgentPhoneError({
223
+ statusCode: _response.error.statusCode,
224
+ body: _response.error.body,
225
+ rawResponse: _response.rawResponse,
226
+ });
227
+ }
228
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/integrations/supabase");
229
+ });
230
+ }
231
+ }
@@ -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
+ * code: "code"
5
+ * }
6
+ */
7
+ export interface SupabaseConnectIntegrationsSupabaseConnectGetRequest {
8
+ code: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { SupabaseConnectIntegrationsSupabaseConnectGetRequest } from "./SupabaseConnectIntegrationsSupabaseConnectGetRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -15,6 +15,8 @@ export interface SendMessageRequest {
15
15
  number_id?: string | null;
16
16
  /** Optional iMessage expressive effect. Only valid on iMessage-capable numbers. Supported values: celebration, fireworks, lasers, love, confetti, balloons, spotlight, echo, invisible, gentle, loud, slam. */
17
17
  send_style?: SendMessageRequest.SendStyle;
18
+ /** Optional parent message ID (AgentPhone Message.id) to send this message as an inline reply in iMessage. */
19
+ reply_to_message_id?: string | null;
18
20
  }
19
21
  export declare namespace SendMessageRequest {
20
22
  /** Optional iMessage expressive effect. Only valid on iMessage-capable numbers. Supported values: celebration, fireworks, lasers, love, confetti, balloons, spotlight, echo, invisible, gentle, loud, slam. */
@@ -7,18 +7,6 @@
7
7
  */
8
8
  export interface SendReactionRequest {
9
9
  message_id: string;
10
- /** iMessage tapback reaction to send. Supported values are: love, like, dislike, laugh, emphasize, question. */
11
- reaction: SendReactionRequest.Reaction;
12
- }
13
- export declare namespace SendReactionRequest {
14
- /** iMessage tapback reaction to send. Supported values are: love, like, dislike, laugh, emphasize, question. */
15
- const Reaction: {
16
- readonly Love: "love";
17
- readonly Like: "like";
18
- readonly Dislike: "dislike";
19
- readonly Laugh: "laugh";
20
- readonly Emphasize: "emphasize";
21
- readonly Question: "question";
22
- };
23
- type Reaction = (typeof Reaction)[keyof typeof Reaction];
10
+ /** iMessage reaction to send. Classic tapbacks (love, like, dislike, laugh, emphasize, question) are supported on every iMessage line. Custom emoji reactions (e.g. "🔥", "😂", "👍") are supported on newer lines only; lines that don't support them return a 400 with upgrade instructions. Custom emoji also require the recipient to be on macOS 14 / iOS 17 or later. */
11
+ reaction: string;
24
12
  }
@@ -1,13 +1,2 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export var SendReactionRequest;
3
- (function (SendReactionRequest) {
4
- /** iMessage tapback reaction to send. Supported values are: love, like, dislike, laugh, emphasize, question. */
5
- SendReactionRequest.Reaction = {
6
- Love: "love",
7
- Like: "like",
8
- Dislike: "dislike",
9
- Laugh: "laugh",
10
- Emphasize: "emphasize",
11
- Question: "question",
12
- };
13
- })(SendReactionRequest || (SendReactionRequest = {}));
2
+ export {};
@@ -1,2 +1,2 @@
1
1
  export { SendMessageRequest } from "./SendMessageRequest.mjs";
2
- export { SendReactionRequest } from "./SendReactionRequest.mjs";
2
+ export type { SendReactionRequest } from "./SendReactionRequest.mjs";
@@ -1,2 +1 @@
1
1
  export { SendMessageRequest } from "./SendMessageRequest.mjs";
2
- export { SendReactionRequest } from "./SendReactionRequest.mjs";