phonic 0.27.0 → 0.28.0

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.
package/dist/index.d.mts CHANGED
@@ -284,11 +284,11 @@ declare class Agents {
284
284
  private getTemplateVariablesForBody;
285
285
  private getConfigurationEndpointForBody;
286
286
  list(params?: ListAgentsParams): DataOrError<ListAgentsSuccessResponse>;
287
- get(name: string, params?: GetAgentParams): DataOrError<GetAgentSuccessResponse>;
287
+ get(nameOrId: string, params?: GetAgentParams): DataOrError<GetAgentSuccessResponse>;
288
288
  create(params: CreateAgentParams): DataOrError<CreateAgentSuccessResponse>;
289
- update(name: string, params: UpdateAgentParams): DataOrError<UpdateAgentSuccessResponse>;
289
+ update(nameOrId: string, params: UpdateAgentParams): DataOrError<UpdateAgentSuccessResponse>;
290
290
  upsert(params: UpsertAgentParams): DataOrError<UpsertAgentSuccessResponse>;
291
- delete(name: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
291
+ delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
292
292
  }
293
293
 
294
294
  type ISODateTime = `${string}Z`;
@@ -369,6 +369,48 @@ declare class Conversations {
369
369
  outboundCall(toPhoneNumber: string, config: OutboundCallConfig): DataOrError<OutboundCallSuccessResponse>;
370
370
  }
371
371
 
372
+ type Project = {
373
+ id: string;
374
+ name: string;
375
+ default_agent: {
376
+ id: string;
377
+ name: string;
378
+ } | null;
379
+ };
380
+ type ListProjectsSuccessResponse = {
381
+ projects: Array<Project>;
382
+ };
383
+ type GetProjectSuccessResponse = {
384
+ project: Project;
385
+ };
386
+ type CreateProjectParams = {
387
+ name: string;
388
+ };
389
+ type CreateProjectSuccessResponse = {
390
+ id: string;
391
+ name: string;
392
+ };
393
+ type UpdateProjectParams = {
394
+ name?: string;
395
+ defaultAgent?: string;
396
+ };
397
+ type UpdateProjectSuccessResponse = {
398
+ success: true;
399
+ };
400
+ type DeleteProjectSuccessResponse = {
401
+ success: true;
402
+ };
403
+
404
+ declare class Projects {
405
+ private readonly phonic;
406
+ constructor(phonic: Phonic);
407
+ list(): DataOrError<ListProjectsSuccessResponse>;
408
+ get(nameOrId: string): DataOrError<GetProjectSuccessResponse>;
409
+ create(params: CreateProjectParams): DataOrError<CreateProjectSuccessResponse>;
410
+ update(nameOrId: string, params: UpdateProjectParams): DataOrError<UpdateProjectSuccessResponse>;
411
+ delete(nameOrId: string): DataOrError<DeleteProjectSuccessResponse>;
412
+ }
413
+
372
414
  declare class PhonicSTSWebSocket {
373
415
  private readonly ws;
374
416
  private readonly config;
@@ -489,10 +531,10 @@ declare class Tools {
489
531
  constructor(phonic: Phonic);
490
532
  private getParametersForBody;
491
533
  list(): DataOrError<ListToolsSuccessResponse>;
492
- get(name: string): DataOrError<GetToolSuccessResponse>;
534
+ get(nameOrId: string): DataOrError<GetToolSuccessResponse>;
493
535
  create(params: CreateToolParams): DataOrError<CreateToolSuccessResponse>;
494
- update(name: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
495
- delete(name: string): DataOrError<DeleteToolSuccessResponse>;
536
+ update(nameOrId: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
537
+ delete(nameOrId: string): DataOrError<DeleteToolSuccessResponse>;
496
538
  }
497
539
 
498
540
  type Voice = {
@@ -522,6 +564,7 @@ declare class Phonic {
522
564
  readonly headers: Record<string, string>;
523
565
  readonly agents: Agents;
524
566
  readonly conversations: Conversations;
567
+ readonly projects: Projects;
525
568
  readonly tools: Tools;
526
569
  readonly voices: Voices;
527
570
  readonly sts: SpeechToSpeech;
package/dist/index.d.ts CHANGED
@@ -284,11 +284,11 @@ declare class Agents {
284
284
  private getTemplateVariablesForBody;
285
285
  private getConfigurationEndpointForBody;
286
286
  list(params?: ListAgentsParams): DataOrError<ListAgentsSuccessResponse>;
287
- get(name: string, params?: GetAgentParams): DataOrError<GetAgentSuccessResponse>;
287
+ get(nameOrId: string, params?: GetAgentParams): DataOrError<GetAgentSuccessResponse>;
288
288
  create(params: CreateAgentParams): DataOrError<CreateAgentSuccessResponse>;
289
- update(name: string, params: UpdateAgentParams): DataOrError<UpdateAgentSuccessResponse>;
289
+ update(nameOrId: string, params: UpdateAgentParams): DataOrError<UpdateAgentSuccessResponse>;
290
290
  upsert(params: UpsertAgentParams): DataOrError<UpsertAgentSuccessResponse>;
291
- delete(name: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
291
+ delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
292
292
  }
293
293
 
294
294
  type ISODateTime = `${string}Z`;
@@ -369,6 +369,48 @@ declare class Conversations {
369
369
  outboundCall(toPhoneNumber: string, config: OutboundCallConfig): DataOrError<OutboundCallSuccessResponse>;
370
370
  }
371
371
 
372
+ type Project = {
373
+ id: string;
374
+ name: string;
375
+ default_agent: {
376
+ id: string;
377
+ name: string;
378
+ } | null;
379
+ };
380
+ type ListProjectsSuccessResponse = {
381
+ projects: Array<Project>;
382
+ };
383
+ type GetProjectSuccessResponse = {
384
+ project: Project;
385
+ };
386
+ type CreateProjectParams = {
387
+ name: string;
388
+ };
389
+ type CreateProjectSuccessResponse = {
390
+ id: string;
391
+ name: string;
392
+ };
393
+ type UpdateProjectParams = {
394
+ name?: string;
395
+ defaultAgent?: string;
396
+ };
397
+ type UpdateProjectSuccessResponse = {
398
+ success: true;
399
+ };
400
+ type DeleteProjectSuccessResponse = {
401
+ success: true;
402
+ };
403
+
404
+ declare class Projects {
405
+ private readonly phonic;
406
+ constructor(phonic: Phonic);
407
+ list(): DataOrError<ListProjectsSuccessResponse>;
408
+ get(nameOrId: string): DataOrError<GetProjectSuccessResponse>;
409
+ create(params: CreateProjectParams): DataOrError<CreateProjectSuccessResponse>;
410
+ update(nameOrId: string, params: UpdateProjectParams): DataOrError<UpdateProjectSuccessResponse>;
411
+ delete(nameOrId: string): DataOrError<DeleteProjectSuccessResponse>;
412
+ }
413
+
372
414
  declare class PhonicSTSWebSocket {
373
415
  private readonly ws;
374
416
  private readonly config;
@@ -489,10 +531,10 @@ declare class Tools {
489
531
  constructor(phonic: Phonic);
490
532
  private getParametersForBody;
491
533
  list(): DataOrError<ListToolsSuccessResponse>;
492
- get(name: string): DataOrError<GetToolSuccessResponse>;
534
+ get(nameOrId: string): DataOrError<GetToolSuccessResponse>;
493
535
  create(params: CreateToolParams): DataOrError<CreateToolSuccessResponse>;
494
- update(name: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
495
- delete(name: string): DataOrError<DeleteToolSuccessResponse>;
536
+ update(nameOrId: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
537
+ delete(nameOrId: string): DataOrError<DeleteToolSuccessResponse>;
496
538
  }
497
539
 
498
540
  type Voice = {
@@ -522,6 +564,7 @@ declare class Phonic {
522
564
  readonly headers: Record<string, string>;
523
565
  readonly agents: Agents;
524
566
  readonly conversations: Conversations;
567
+ readonly projects: Projects;
525
568
  readonly tools: Tools;
526
569
  readonly voices: Voices;
527
570
  readonly sts: SpeechToSpeech;
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // package.json
38
- var version = "0.27.0";
38
+ var version = "0.28.0";
39
39
 
40
40
  // src/agents/index.ts
41
41
  var Agents = class {
@@ -78,9 +78,9 @@ var Agents = class {
78
78
  );
79
79
  return response;
80
80
  }
81
- async get(name, params) {
81
+ async get(nameOrId, params) {
82
82
  const response = await this.phonic.get(
83
- `/agents/${name}?${this.getQueryString(params)}`
83
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
84
84
  );
85
85
  return response;
86
86
  }
@@ -110,9 +110,9 @@ var Agents = class {
110
110
  );
111
111
  return response;
112
112
  }
113
- async update(name, params) {
113
+ async update(nameOrId, params) {
114
114
  const response = await this.phonic.patch(
115
- `/agents/${name}?${this.getQueryString(params)}`,
115
+ `/agents/${nameOrId}?${this.getQueryString(params)}`,
116
116
  {
117
117
  name: params.name,
118
118
  phone_number: params.phoneNumber,
@@ -162,9 +162,9 @@ var Agents = class {
162
162
  );
163
163
  return response;
164
164
  }
165
- async delete(name, params) {
165
+ async delete(nameOrId, params) {
166
166
  const response = await this.phonic.delete(
167
- `/agents/${name}?${this.getQueryString(params)}`
167
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
168
168
  );
169
169
  return response;
170
170
  }
@@ -250,6 +250,48 @@ var Conversations = class {
250
250
  }
251
251
  };
252
252
 
253
+ // src/projects/index.ts
254
+ var Projects = class {
255
+ constructor(phonic) {
256
+ this.phonic = phonic;
257
+ }
258
+ async list() {
259
+ const response = await this.phonic.get("/projects");
260
+ return response;
261
+ }
262
+ async get(nameOrId) {
263
+ const response = await this.phonic.get(
264
+ `/projects/${nameOrId}`
265
+ );
266
+ return response;
267
+ }
268
+ async create(params) {
269
+ const response = await this.phonic.post(
270
+ "/projects",
271
+ {
272
+ name: params.name
273
+ }
274
+ );
275
+ return response;
276
+ }
277
+ async update(nameOrId, params) {
278
+ const response = await this.phonic.patch(
279
+ `/projects/${nameOrId}`,
280
+ {
281
+ name: params.name,
282
+ default_agent: params.defaultAgent
283
+ }
284
+ );
285
+ return response;
286
+ }
287
+ async delete(nameOrId) {
288
+ const response = await this.phonic.delete(
289
+ `/projects/${nameOrId}`
290
+ );
291
+ return response;
292
+ }
293
+ };
294
+
253
295
  // src/sts/index.ts
254
296
  var import_ws = __toESM(require("ws"));
255
297
 
@@ -403,9 +445,9 @@ var Tools = class {
403
445
  const response = await this.phonic.get("/tools");
404
446
  return response;
405
447
  }
406
- async get(name) {
448
+ async get(nameOrId) {
407
449
  const response = await this.phonic.get(
408
- `/tools/${name}`
450
+ `/tools/${nameOrId}`
409
451
  );
410
452
  return response;
411
453
  }
@@ -432,9 +474,9 @@ var Tools = class {
432
474
  );
433
475
  return response;
434
476
  }
435
- async update(name, params) {
477
+ async update(nameOrId, params) {
436
478
  const response = await this.phonic.patch(
437
- `/tools/${name}`,
479
+ `/tools/${nameOrId}`,
438
480
  {
439
481
  name: params.name,
440
482
  description: params.description,
@@ -450,9 +492,9 @@ var Tools = class {
450
492
  );
451
493
  return response;
452
494
  }
453
- async delete(name) {
495
+ async delete(nameOrId) {
454
496
  const response = await this.phonic.delete(
455
- `/tools/${name}`
497
+ `/tools/${nameOrId}`
456
498
  );
457
499
  return response;
458
500
  }
@@ -507,6 +549,7 @@ var Phonic = class {
507
549
  headers;
508
550
  agents = new Agents(this);
509
551
  conversations = new Conversations(this);
552
+ projects = new Projects(this);
510
553
  tools = new Tools(this);
511
554
  voices = new Voices(this);
512
555
  sts = new SpeechToSpeech(this);
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.27.0";
2
+ var version = "0.28.0";
3
3
 
4
4
  // src/agents/index.ts
5
5
  var Agents = class {
@@ -42,9 +42,9 @@ var Agents = class {
42
42
  );
43
43
  return response;
44
44
  }
45
- async get(name, params) {
45
+ async get(nameOrId, params) {
46
46
  const response = await this.phonic.get(
47
- `/agents/${name}?${this.getQueryString(params)}`
47
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
48
48
  );
49
49
  return response;
50
50
  }
@@ -74,9 +74,9 @@ var Agents = class {
74
74
  );
75
75
  return response;
76
76
  }
77
- async update(name, params) {
77
+ async update(nameOrId, params) {
78
78
  const response = await this.phonic.patch(
79
- `/agents/${name}?${this.getQueryString(params)}`,
79
+ `/agents/${nameOrId}?${this.getQueryString(params)}`,
80
80
  {
81
81
  name: params.name,
82
82
  phone_number: params.phoneNumber,
@@ -126,9 +126,9 @@ var Agents = class {
126
126
  );
127
127
  return response;
128
128
  }
129
- async delete(name, params) {
129
+ async delete(nameOrId, params) {
130
130
  const response = await this.phonic.delete(
131
- `/agents/${name}?${this.getQueryString(params)}`
131
+ `/agents/${nameOrId}?${this.getQueryString(params)}`
132
132
  );
133
133
  return response;
134
134
  }
@@ -214,6 +214,48 @@ var Conversations = class {
214
214
  }
215
215
  };
216
216
 
217
+ // src/projects/index.ts
218
+ var Projects = class {
219
+ constructor(phonic) {
220
+ this.phonic = phonic;
221
+ }
222
+ async list() {
223
+ const response = await this.phonic.get("/projects");
224
+ return response;
225
+ }
226
+ async get(nameOrId) {
227
+ const response = await this.phonic.get(
228
+ `/projects/${nameOrId}`
229
+ );
230
+ return response;
231
+ }
232
+ async create(params) {
233
+ const response = await this.phonic.post(
234
+ "/projects",
235
+ {
236
+ name: params.name
237
+ }
238
+ );
239
+ return response;
240
+ }
241
+ async update(nameOrId, params) {
242
+ const response = await this.phonic.patch(
243
+ `/projects/${nameOrId}`,
244
+ {
245
+ name: params.name,
246
+ default_agent: params.defaultAgent
247
+ }
248
+ );
249
+ return response;
250
+ }
251
+ async delete(nameOrId) {
252
+ const response = await this.phonic.delete(
253
+ `/projects/${nameOrId}`
254
+ );
255
+ return response;
256
+ }
257
+ };
258
+
217
259
  // src/sts/index.ts
218
260
  import WebSocket from "ws";
219
261
 
@@ -367,9 +409,9 @@ var Tools = class {
367
409
  const response = await this.phonic.get("/tools");
368
410
  return response;
369
411
  }
370
- async get(name) {
412
+ async get(nameOrId) {
371
413
  const response = await this.phonic.get(
372
- `/tools/${name}`
414
+ `/tools/${nameOrId}`
373
415
  );
374
416
  return response;
375
417
  }
@@ -396,9 +438,9 @@ var Tools = class {
396
438
  );
397
439
  return response;
398
440
  }
399
- async update(name, params) {
441
+ async update(nameOrId, params) {
400
442
  const response = await this.phonic.patch(
401
- `/tools/${name}`,
443
+ `/tools/${nameOrId}`,
402
444
  {
403
445
  name: params.name,
404
446
  description: params.description,
@@ -414,9 +456,9 @@ var Tools = class {
414
456
  );
415
457
  return response;
416
458
  }
417
- async delete(name) {
459
+ async delete(nameOrId) {
418
460
  const response = await this.phonic.delete(
419
- `/tools/${name}`
461
+ `/tools/${nameOrId}`
420
462
  );
421
463
  return response;
422
464
  }
@@ -471,6 +513,7 @@ var Phonic = class {
471
513
  headers;
472
514
  agents = new Agents(this);
473
515
  conversations = new Conversations(this);
516
+ projects = new Projects(this);
474
517
  tools = new Tools(this);
475
518
  voices = new Voices(this);
476
519
  sts = new SpeechToSpeech(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Phonic Node.js SDK",
5
5
  "scripts": {
6
6
  "build": "tsup",