phonic 0.30.34 → 0.30.36

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 (55) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/Client.d.ts +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.js +8 -6
  4. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +2 -1
  5. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -1
  6. package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -1
  7. package/dist/cjs/api/resources/auth/client/Client.js +5 -3
  8. package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
  9. package/dist/cjs/api/resources/conversations/client/Client.js +5 -3
  10. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
  11. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +5 -3
  12. package/dist/cjs/api/resources/projects/client/Client.d.ts +2 -2
  13. package/dist/cjs/api/resources/projects/client/Client.js +8 -6
  14. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +2 -1
  15. package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
  16. package/dist/cjs/api/resources/tools/client/Client.js +5 -3
  17. package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
  18. package/dist/cjs/api/resources/voices/client/Client.js +5 -3
  19. package/dist/cjs/api/types/AssistantFinishedSpeakingPayload.d.ts +6 -0
  20. package/dist/cjs/api/types/AssistantFinishedSpeakingPayload.js +5 -0
  21. package/dist/cjs/api/types/AssistantStartedSpeakingPayload.d.ts +6 -0
  22. package/dist/cjs/api/types/AssistantStartedSpeakingPayload.js +5 -0
  23. package/dist/cjs/api/types/CreateAgentRequest.d.ts +2 -1
  24. package/dist/cjs/api/types/index.d.ts +2 -0
  25. package/dist/cjs/api/types/index.js +2 -0
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/Client.mjs +2 -2
  29. package/dist/esm/api/resources/agents/client/Client.d.mts +2 -2
  30. package/dist/esm/api/resources/agents/client/Client.mjs +8 -6
  31. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +2 -1
  32. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -1
  33. package/dist/esm/api/resources/auth/client/Client.d.mts +1 -1
  34. package/dist/esm/api/resources/auth/client/Client.mjs +5 -3
  35. package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
  36. package/dist/esm/api/resources/conversations/client/Client.mjs +5 -3
  37. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
  38. package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +5 -3
  39. package/dist/esm/api/resources/projects/client/Client.d.mts +2 -2
  40. package/dist/esm/api/resources/projects/client/Client.mjs +8 -6
  41. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +2 -1
  42. package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
  43. package/dist/esm/api/resources/tools/client/Client.mjs +5 -3
  44. package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
  45. package/dist/esm/api/resources/voices/client/Client.mjs +5 -3
  46. package/dist/esm/api/types/AssistantFinishedSpeakingPayload.d.mts +6 -0
  47. package/dist/esm/api/types/AssistantFinishedSpeakingPayload.mjs +4 -0
  48. package/dist/esm/api/types/AssistantStartedSpeakingPayload.d.mts +6 -0
  49. package/dist/esm/api/types/AssistantStartedSpeakingPayload.mjs +4 -0
  50. package/dist/esm/api/types/CreateAgentRequest.d.mts +2 -1
  51. package/dist/esm/api/types/index.d.mts +2 -0
  52. package/dist/esm/api/types/index.mjs +2 -0
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +1 -1
@@ -51,8 +51,8 @@ class PhonicClient {
51
51
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
52
52
  "X-Fern-Language": "JavaScript",
53
53
  "X-Fern-SDK-Name": "phonic",
54
- "X-Fern-SDK-Version": "0.30.34",
55
- "User-Agent": "phonic/0.30.34",
54
+ "X-Fern-SDK-Version": "0.30.36",
55
+ "User-Agent": "phonic/0.30.36",
56
56
  "X-Fern-Runtime": core.RUNTIME.type,
57
57
  "X-Fern-Runtime-Version": core.RUNTIME.version,
58
58
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -215,7 +215,7 @@ export declare class Agents {
215
215
  * }
216
216
  * })
217
217
  */
218
- update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
218
+ update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
219
219
  private __update;
220
220
  /**
221
221
  * Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
@@ -294,5 +294,5 @@ export declare class Agents {
294
294
  */
295
295
  updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
296
296
  private __updatePhoneNumber;
297
- protected _getAuthorizationHeader(): Promise<string | undefined>;
297
+ protected _getAuthorizationHeader(): Promise<string>;
298
298
  }
@@ -531,11 +531,11 @@ class Agents {
531
531
  * }
532
532
  * })
533
533
  */
534
- update(nameOrId, request, requestOptions) {
534
+ update(nameOrId, request = {}, requestOptions) {
535
535
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
536
536
  }
537
- __update(nameOrId, request, requestOptions) {
538
- return __awaiter(this, void 0, void 0, function* () {
537
+ __update(nameOrId_1) {
538
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
539
539
  var _a, _b, _c, _d;
540
540
  const { project } = request, _body = __rest(request, ["project"]);
541
541
  const _queryParams = {};
@@ -876,10 +876,12 @@ class Agents {
876
876
  return __awaiter(this, void 0, void 0, function* () {
877
877
  var _a;
878
878
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
879
- if (bearer != null) {
880
- return `Bearer ${bearer}`;
879
+ if (bearer == null) {
880
+ throw new errors.PhonicError({
881
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
882
+ });
881
883
  }
882
- return undefined;
884
+ return `Bearer ${bearer}`;
883
885
  });
884
886
  }
885
887
  }
@@ -42,7 +42,8 @@ export interface AgentsCreateRequest {
42
42
  project?: string;
43
43
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
44
  name: string;
45
- phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
45
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
46
+ phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
46
47
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
48
  custom_phone_number?: string | null;
48
49
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -42,7 +42,8 @@ export interface UpdateAgentRequest {
42
42
  project?: string;
43
43
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
44
  name?: string;
45
- phone_number: UpdateAgentRequest.PhoneNumber | null;
45
+ /** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
46
+ phone_number?: UpdateAgentRequest.PhoneNumber | null;
46
47
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
48
  custom_phone_number?: string | null;
48
49
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -48,5 +48,5 @@ export declare class Auth {
48
48
  */
49
49
  createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
50
50
  private __createSessionToken;
51
- protected _getAuthorizationHeader(): Promise<string | undefined>;
51
+ protected _getAuthorizationHeader(): Promise<string>;
52
52
  }
@@ -136,10 +136,12 @@ class Auth {
136
136
  return __awaiter(this, void 0, void 0, function* () {
137
137
  var _a;
138
138
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
139
- if (bearer != null) {
140
- return `Bearer ${bearer}`;
139
+ if (bearer == null) {
140
+ throw new errors.PhonicError({
141
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
142
+ });
141
143
  }
142
- return undefined;
144
+ return `Bearer ${bearer}`;
143
145
  });
144
146
  }
145
147
  }
@@ -233,5 +233,5 @@ export declare class Conversations {
233
233
  sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
234
234
  private __sipOutboundCall;
235
235
  connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
236
- protected _getAuthorizationHeader(): Promise<string | undefined>;
236
+ protected _getAuthorizationHeader(): Promise<string>;
237
237
  }
@@ -886,10 +886,12 @@ class Conversations {
886
886
  return __awaiter(this, void 0, void 0, function* () {
887
887
  var _a;
888
888
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
889
- if (bearer != null) {
890
- return `Bearer ${bearer}`;
889
+ if (bearer == null) {
890
+ throw new errors.PhonicError({
891
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
892
+ });
891
893
  }
892
- return undefined;
894
+ return `Bearer ${bearer}`;
893
895
  });
894
896
  }
895
897
  }
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
138
138
  */
139
139
  update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
140
140
  private __update;
141
- protected _getAuthorizationHeader(): Promise<string | undefined>;
141
+ protected _getAuthorizationHeader(): Promise<string>;
142
142
  }
@@ -461,10 +461,12 @@ class ExtractionSchemas {
461
461
  return __awaiter(this, void 0, void 0, function* () {
462
462
  var _a;
463
463
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
464
- if (bearer != null) {
465
- return `Bearer ${bearer}`;
464
+ if (bearer == null) {
465
+ throw new errors.PhonicError({
466
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
467
+ });
466
468
  }
467
- return undefined;
469
+ return `Bearer ${bearer}`;
468
470
  });
469
471
  }
470
472
  }
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -153,5 +153,5 @@ export declare class Projects {
153
153
  */
154
154
  createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
155
155
  private __createEvalPrompt;
156
- protected _getAuthorizationHeader(): Promise<string | undefined>;
156
+ protected _getAuthorizationHeader(): Promise<string>;
157
157
  }
@@ -349,11 +349,11 @@ class Projects {
349
349
  * default_agent: "another-agent"
350
350
  * })
351
351
  */
352
- update(nameOrId, request, requestOptions) {
352
+ update(nameOrId, request = {}, requestOptions) {
353
353
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
354
354
  }
355
- __update(nameOrId, request, requestOptions) {
356
- return __awaiter(this, void 0, void 0, function* () {
355
+ __update(nameOrId_1) {
356
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
357
357
  var _a, _b, _c, _d;
358
358
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
359
359
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -572,10 +572,12 @@ class Projects {
572
572
  return __awaiter(this, void 0, void 0, function* () {
573
573
  var _a;
574
574
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
575
- if (bearer != null) {
576
- return `Bearer ${bearer}`;
575
+ if (bearer == null) {
576
+ throw new errors.PhonicError({
577
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
578
+ });
577
579
  }
578
- return undefined;
580
+ return `Bearer ${bearer}`;
579
581
  });
580
582
  }
581
583
  }
@@ -11,5 +11,6 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent: string | null;
14
+ /** The name of the new project's default agent. Set to `null` to remove the default agent. */
15
+ default_agent?: string | null;
15
16
  }
@@ -210,5 +210,5 @@ export declare class Tools {
210
210
  */
211
211
  update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
212
212
  private __update;
213
- protected _getAuthorizationHeader(): Promise<string | undefined>;
213
+ protected _getAuthorizationHeader(): Promise<string>;
214
214
  }
@@ -526,10 +526,12 @@ class Tools {
526
526
  return __awaiter(this, void 0, void 0, function* () {
527
527
  var _a;
528
528
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
529
- if (bearer != null) {
530
- return `Bearer ${bearer}`;
529
+ if (bearer == null) {
530
+ throw new errors.PhonicError({
531
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
532
+ });
531
533
  }
532
- return undefined;
534
+ return `Bearer ${bearer}`;
533
535
  });
534
536
  }
535
537
  }
@@ -61,5 +61,5 @@ export declare class Voices {
61
61
  */
62
62
  get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
63
63
  private __get;
64
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
+ protected _getAuthorizationHeader(): Promise<string>;
65
65
  }
@@ -193,10 +193,12 @@ class Voices {
193
193
  return __awaiter(this, void 0, void 0, function* () {
194
194
  var _a;
195
195
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
196
- if (bearer != null) {
197
- return `Bearer ${bearer}`;
196
+ if (bearer == null) {
197
+ throw new errors.PhonicError({
198
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
199
+ });
198
200
  }
199
- return undefined;
201
+ return `Bearer ${bearer}`;
200
202
  });
201
203
  }
202
204
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface AssistantFinishedSpeakingPayload {
5
+ type: "assistant_finished_speaking";
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface AssistantStartedSpeakingPayload {
5
+ type: "assistant_started_speaking";
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,7 +5,8 @@ import * as Phonic from "../index.js";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number: CreateAgentRequest.PhoneNumber | null;
8
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
9
+ phone_number?: CreateAgentRequest.PhoneNumber | null;
9
10
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
10
11
  custom_phone_number?: string | null;
11
12
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.js";
35
35
  export * from "./AudioChunkResponsePayload.js";
36
36
  export * from "./UserStartedSpeakingPayload.js";
37
37
  export * from "./UserFinishedSpeakingPayload.js";
38
+ export * from "./AssistantStartedSpeakingPayload.js";
39
+ export * from "./AssistantFinishedSpeakingPayload.js";
38
40
  export * from "./IsUserSpeakingPayload.js";
39
41
  export * from "./DtmfPayload.js";
40
42
  export * from "./ToolCallPayload.js";
@@ -51,6 +51,8 @@ __exportStar(require("./InputCancelledPayload.js"), exports);
51
51
  __exportStar(require("./AudioChunkResponsePayload.js"), exports);
52
52
  __exportStar(require("./UserStartedSpeakingPayload.js"), exports);
53
53
  __exportStar(require("./UserFinishedSpeakingPayload.js"), exports);
54
+ __exportStar(require("./AssistantStartedSpeakingPayload.js"), exports);
55
+ __exportStar(require("./AssistantFinishedSpeakingPayload.js"), exports);
54
56
  __exportStar(require("./IsUserSpeakingPayload.js"), exports);
55
57
  __exportStar(require("./DtmfPayload.js"), exports);
56
58
  __exportStar(require("./ToolCallPayload.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.34";
1
+ export declare const SDK_VERSION = "0.30.36";
@@ -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 = "0.30.34";
4
+ exports.SDK_VERSION = "0.30.36";
@@ -15,8 +15,8 @@ export class PhonicClient {
15
15
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
16
16
  "X-Fern-Language": "JavaScript",
17
17
  "X-Fern-SDK-Name": "phonic",
18
- "X-Fern-SDK-Version": "0.30.34",
19
- "User-Agent": "phonic/0.30.34",
18
+ "X-Fern-SDK-Version": "0.30.36",
19
+ "User-Agent": "phonic/0.30.36",
20
20
  "X-Fern-Runtime": core.RUNTIME.type,
21
21
  "X-Fern-Runtime-Version": core.RUNTIME.version,
22
22
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -215,7 +215,7 @@ export declare class Agents {
215
215
  * }
216
216
  * })
217
217
  */
218
- update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
218
+ update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
219
219
  private __update;
220
220
  /**
221
221
  * Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
@@ -294,5 +294,5 @@ export declare class Agents {
294
294
  */
295
295
  updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
296
296
  private __updatePhoneNumber;
297
- protected _getAuthorizationHeader(): Promise<string | undefined>;
297
+ protected _getAuthorizationHeader(): Promise<string>;
298
298
  }
@@ -495,11 +495,11 @@ export class Agents {
495
495
  * }
496
496
  * })
497
497
  */
498
- update(nameOrId, request, requestOptions) {
498
+ update(nameOrId, request = {}, requestOptions) {
499
499
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
500
500
  }
501
- __update(nameOrId, request, requestOptions) {
502
- return __awaiter(this, void 0, void 0, function* () {
501
+ __update(nameOrId_1) {
502
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
503
503
  var _a, _b, _c, _d;
504
504
  const { project } = request, _body = __rest(request, ["project"]);
505
505
  const _queryParams = {};
@@ -840,10 +840,12 @@ export class Agents {
840
840
  return __awaiter(this, void 0, void 0, function* () {
841
841
  var _a;
842
842
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
843
- if (bearer != null) {
844
- return `Bearer ${bearer}`;
843
+ if (bearer == null) {
844
+ throw new errors.PhonicError({
845
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
846
+ });
845
847
  }
846
- return undefined;
848
+ return `Bearer ${bearer}`;
847
849
  });
848
850
  }
849
851
  }
@@ -42,7 +42,8 @@ export interface AgentsCreateRequest {
42
42
  project?: string;
43
43
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
44
  name: string;
45
- phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
45
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
46
+ phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
46
47
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
48
  custom_phone_number?: string | null;
48
49
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -42,7 +42,8 @@ export interface UpdateAgentRequest {
42
42
  project?: string;
43
43
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
44
  name?: string;
45
- phone_number: UpdateAgentRequest.PhoneNumber | null;
45
+ /** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
46
+ phone_number?: UpdateAgentRequest.PhoneNumber | null;
46
47
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
48
  custom_phone_number?: string | null;
48
49
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -48,5 +48,5 @@ export declare class Auth {
48
48
  */
49
49
  createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
50
50
  private __createSessionToken;
51
- protected _getAuthorizationHeader(): Promise<string | undefined>;
51
+ protected _getAuthorizationHeader(): Promise<string>;
52
52
  }
@@ -100,10 +100,12 @@ export class Auth {
100
100
  return __awaiter(this, void 0, void 0, function* () {
101
101
  var _a;
102
102
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
103
- if (bearer != null) {
104
- return `Bearer ${bearer}`;
103
+ if (bearer == null) {
104
+ throw new errors.PhonicError({
105
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
106
+ });
105
107
  }
106
- return undefined;
108
+ return `Bearer ${bearer}`;
107
109
  });
108
110
  }
109
111
  }
@@ -233,5 +233,5 @@ export declare class Conversations {
233
233
  sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
234
234
  private __sipOutboundCall;
235
235
  connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
236
- protected _getAuthorizationHeader(): Promise<string | undefined>;
236
+ protected _getAuthorizationHeader(): Promise<string>;
237
237
  }
@@ -850,10 +850,12 @@ export class Conversations {
850
850
  return __awaiter(this, void 0, void 0, function* () {
851
851
  var _a;
852
852
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
853
- if (bearer != null) {
854
- return `Bearer ${bearer}`;
853
+ if (bearer == null) {
854
+ throw new errors.PhonicError({
855
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
856
+ });
855
857
  }
856
- return undefined;
858
+ return `Bearer ${bearer}`;
857
859
  });
858
860
  }
859
861
  }
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
138
138
  */
139
139
  update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
140
140
  private __update;
141
- protected _getAuthorizationHeader(): Promise<string | undefined>;
141
+ protected _getAuthorizationHeader(): Promise<string>;
142
142
  }
@@ -425,10 +425,12 @@ export class ExtractionSchemas {
425
425
  return __awaiter(this, void 0, void 0, function* () {
426
426
  var _a;
427
427
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
428
- if (bearer != null) {
429
- return `Bearer ${bearer}`;
428
+ if (bearer == null) {
429
+ throw new errors.PhonicError({
430
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
431
+ });
430
432
  }
431
- return undefined;
433
+ return `Bearer ${bearer}`;
432
434
  });
433
435
  }
434
436
  }
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -153,5 +153,5 @@ export declare class Projects {
153
153
  */
154
154
  createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
155
155
  private __createEvalPrompt;
156
- protected _getAuthorizationHeader(): Promise<string | undefined>;
156
+ protected _getAuthorizationHeader(): Promise<string>;
157
157
  }
@@ -313,11 +313,11 @@ export class Projects {
313
313
  * default_agent: "another-agent"
314
314
  * })
315
315
  */
316
- update(nameOrId, request, requestOptions) {
316
+ update(nameOrId, request = {}, requestOptions) {
317
317
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
318
318
  }
319
- __update(nameOrId, request, requestOptions) {
320
- return __awaiter(this, void 0, void 0, function* () {
319
+ __update(nameOrId_1) {
320
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
321
321
  var _a, _b, _c, _d;
322
322
  let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
323
323
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -536,10 +536,12 @@ export class Projects {
536
536
  return __awaiter(this, void 0, void 0, function* () {
537
537
  var _a;
538
538
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
539
- if (bearer != null) {
540
- return `Bearer ${bearer}`;
539
+ if (bearer == null) {
540
+ throw new errors.PhonicError({
541
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
542
+ });
541
543
  }
542
- return undefined;
544
+ return `Bearer ${bearer}`;
543
545
  });
544
546
  }
545
547
  }
@@ -11,5 +11,6 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent: string | null;
14
+ /** The name of the new project's default agent. Set to `null` to remove the default agent. */
15
+ default_agent?: string | null;
15
16
  }
@@ -210,5 +210,5 @@ export declare class Tools {
210
210
  */
211
211
  update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
212
212
  private __update;
213
- protected _getAuthorizationHeader(): Promise<string | undefined>;
213
+ protected _getAuthorizationHeader(): Promise<string>;
214
214
  }
@@ -490,10 +490,12 @@ export class Tools {
490
490
  return __awaiter(this, void 0, void 0, function* () {
491
491
  var _a;
492
492
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
493
- if (bearer != null) {
494
- return `Bearer ${bearer}`;
493
+ if (bearer == null) {
494
+ throw new errors.PhonicError({
495
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
496
+ });
495
497
  }
496
- return undefined;
498
+ return `Bearer ${bearer}`;
497
499
  });
498
500
  }
499
501
  }
@@ -61,5 +61,5 @@ export declare class Voices {
61
61
  */
62
62
  get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
63
63
  private __get;
64
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
+ protected _getAuthorizationHeader(): Promise<string>;
65
65
  }
@@ -157,10 +157,12 @@ export class Voices {
157
157
  return __awaiter(this, void 0, void 0, function* () {
158
158
  var _a;
159
159
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
160
- if (bearer != null) {
161
- return `Bearer ${bearer}`;
160
+ if (bearer == null) {
161
+ throw new errors.PhonicError({
162
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
163
+ });
162
164
  }
163
- return undefined;
165
+ return `Bearer ${bearer}`;
164
166
  });
165
167
  }
166
168
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface AssistantFinishedSpeakingPayload {
5
+ type: "assistant_finished_speaking";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface AssistantStartedSpeakingPayload {
5
+ type: "assistant_started_speaking";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -5,7 +5,8 @@ import * as Phonic from "../index.mjs";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number: CreateAgentRequest.PhoneNumber | null;
8
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
9
+ phone_number?: CreateAgentRequest.PhoneNumber | null;
9
10
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
10
11
  custom_phone_number?: string | null;
11
12
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.mjs";
35
35
  export * from "./AudioChunkResponsePayload.mjs";
36
36
  export * from "./UserStartedSpeakingPayload.mjs";
37
37
  export * from "./UserFinishedSpeakingPayload.mjs";
38
+ export * from "./AssistantStartedSpeakingPayload.mjs";
39
+ export * from "./AssistantFinishedSpeakingPayload.mjs";
38
40
  export * from "./IsUserSpeakingPayload.mjs";
39
41
  export * from "./DtmfPayload.mjs";
40
42
  export * from "./ToolCallPayload.mjs";
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.mjs";
35
35
  export * from "./AudioChunkResponsePayload.mjs";
36
36
  export * from "./UserStartedSpeakingPayload.mjs";
37
37
  export * from "./UserFinishedSpeakingPayload.mjs";
38
+ export * from "./AssistantStartedSpeakingPayload.mjs";
39
+ export * from "./AssistantFinishedSpeakingPayload.mjs";
38
40
  export * from "./IsUserSpeakingPayload.mjs";
39
41
  export * from "./DtmfPayload.mjs";
40
42
  export * from "./ToolCallPayload.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.34";
1
+ export declare const SDK_VERSION = "0.30.36";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.34";
1
+ export const SDK_VERSION = "0.30.36";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.34",
3
+ "version": "0.30.36",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",