@roarkanalytics/sdk 5.15.0 → 5.17.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/call.d.mts +2 -2
  12. package/resources/call.d.mts.map +1 -1
  13. package/resources/call.d.ts +2 -2
  14. package/resources/call.d.ts.map +1 -1
  15. package/resources/index.d.mts +1 -0
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +1 -0
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +3 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +1 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/metric.d.mts +638 -52
  24. package/resources/metric.d.mts.map +1 -1
  25. package/resources/metric.d.ts +638 -52
  26. package/resources/metric.d.ts.map +1 -1
  27. package/resources/phone-number.d.mts +367 -0
  28. package/resources/phone-number.d.mts.map +1 -0
  29. package/resources/phone-number.d.ts +367 -0
  30. package/resources/phone-number.d.ts.map +1 -0
  31. package/resources/phone-number.js +88 -0
  32. package/resources/phone-number.js.map +1 -0
  33. package/resources/phone-number.mjs +84 -0
  34. package/resources/phone-number.mjs.map +1 -0
  35. package/resources/simulation-run-plan-job.d.mts +2 -2
  36. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  37. package/resources/simulation-run-plan-job.d.ts +2 -2
  38. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  39. package/resources/simulation.d.mts +71 -1
  40. package/resources/simulation.d.mts.map +1 -1
  41. package/resources/simulation.d.ts +71 -1
  42. package/resources/simulation.d.ts.map +1 -1
  43. package/resources/usage.d.mts +1 -1
  44. package/resources/usage.d.mts.map +1 -1
  45. package/resources/usage.d.ts +1 -1
  46. package/resources/usage.d.ts.map +1 -1
  47. package/src/client.ts +29 -0
  48. package/src/resources/call.ts +4 -2
  49. package/src/resources/index.ts +13 -0
  50. package/src/resources/metric.ts +742 -64
  51. package/src/resources/phone-number.ts +472 -0
  52. package/src/resources/simulation-run-plan-job.ts +4 -2
  53. package/src/resources/simulation.ts +76 -0
  54. package/src/resources/usage.ts +2 -1
  55. package/src/version.ts +1 -1
  56. package/version.d.mts +1 -1
  57. package/version.d.ts +1 -1
  58. package/version.js +1 -1
  59. package/version.mjs +1 -1
@@ -0,0 +1,472 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class PhoneNumber extends APIResource {
9
+ /**
10
+ * Buys a number from the carrier for this project. Free inside the plan allowance;
11
+ * past it, the first month of rent is charged now and monthly after that.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const phoneNumber = await client.phoneNumber.create({
16
+ * e164: '+14155550123',
17
+ * });
18
+ * ```
19
+ */
20
+ create(body: PhoneNumberCreateParams, options?: RequestOptions): APIPromise<PhoneNumberCreateResponse> {
21
+ return this._client.post('/v1/phone-number', { body, ...options });
22
+ }
23
+
24
+ /**
25
+ * Relabels a number or changes which agent it is assigned to. A field left out is
26
+ * untouched; null clears it.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const phoneNumber = await client.phoneNumber.update(
31
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
32
+ * );
33
+ * ```
34
+ */
35
+ update(
36
+ phoneNumberID: string,
37
+ body: PhoneNumberUpdateParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): APIPromise<PhoneNumberUpdateResponse> {
40
+ return this._client.put(path`/v1/phone-number/${phoneNumberID}`, { body, ...options });
41
+ }
42
+
43
+ /**
44
+ * Returns the phone numbers the project owns, oldest first, with the agent each is
45
+ * assigned to.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const phoneNumbers = await client.phoneNumber.list();
50
+ * ```
51
+ */
52
+ list(
53
+ query: PhoneNumberListParams | null | undefined = {},
54
+ options?: RequestOptions,
55
+ ): APIPromise<PhoneNumberListResponse> {
56
+ return this._client.get('/v1/phone-number', { query, ...options });
57
+ }
58
+
59
+ /**
60
+ * Gives the number back to the carrier. This cannot be undone: rent stops today
61
+ * and nothing is refunded.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const phoneNumber = await client.phoneNumber.delete(
66
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
67
+ * );
68
+ * ```
69
+ */
70
+ delete(phoneNumberID: string, options?: RequestOptions): APIPromise<PhoneNumberDeleteResponse> {
71
+ return this._client.delete(path`/v1/phone-number/${phoneNumberID}`, options);
72
+ }
73
+
74
+ /**
75
+ * Returns how many numbers the organization gets for free, how many it holds, what
76
+ * a paid number costs a month, and whether a purchase would be admitted right now.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const response = await client.phoneNumber.getAllowance();
81
+ * ```
82
+ */
83
+ getAllowance(options?: RequestOptions): APIPromise<PhoneNumberGetAllowanceResponse> {
84
+ return this._client.get('/v1/phone-number/allowance', options);
85
+ }
86
+
87
+ /**
88
+ * Returns US numbers the carrier has for sale, narrowed by area code or by digits
89
+ * the number must contain. Buy one with POST /v1/phone-number.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const response = await client.phoneNumber.listAvailable();
94
+ * ```
95
+ */
96
+ listAvailable(
97
+ query: PhoneNumberListAvailableParams | null | undefined = {},
98
+ options?: RequestOptions,
99
+ ): APIPromise<PhoneNumberListAvailableResponse> {
100
+ return this._client.get('/v1/phone-number/available', { query, ...options });
101
+ }
102
+ }
103
+
104
+ export interface PhoneNumberCreateResponse {
105
+ /**
106
+ * A phone number the project owns
107
+ */
108
+ data: PhoneNumberCreateResponse.Data;
109
+ }
110
+
111
+ export namespace PhoneNumberCreateResponse {
112
+ /**
113
+ * A phone number the project owns
114
+ */
115
+ export interface Data {
116
+ /**
117
+ * Phone number ID
118
+ */
119
+ id: string;
120
+
121
+ /**
122
+ * The agent the number is assigned to, if any
123
+ */
124
+ agentId: string | null;
125
+
126
+ /**
127
+ * The number in E.164 format
128
+ */
129
+ e164: string;
130
+
131
+ /**
132
+ * Whether the number sits inside the plan free allowance right now
133
+ */
134
+ isFree: boolean;
135
+
136
+ /**
137
+ * ISO 3166-2 code of the region the number is from, when the carrier gave one
138
+ */
139
+ localityCode: string | null;
140
+
141
+ /**
142
+ * What a month of this number costs in micro-dollars; 0 while it is free
143
+ */
144
+ monthlyRentMicros: number;
145
+
146
+ /**
147
+ * Label the project gave the number
148
+ */
149
+ name: string | null;
150
+
151
+ /**
152
+ * When the number was bought (ISO 8601)
153
+ */
154
+ purchasedAt: string;
155
+
156
+ /**
157
+ * When the next month of rent is due (ISO 8601)
158
+ */
159
+ rentNextChargeAt: string;
160
+ }
161
+ }
162
+
163
+ export interface PhoneNumberUpdateResponse {
164
+ /**
165
+ * A phone number the project owns
166
+ */
167
+ data: PhoneNumberUpdateResponse.Data;
168
+ }
169
+
170
+ export namespace PhoneNumberUpdateResponse {
171
+ /**
172
+ * A phone number the project owns
173
+ */
174
+ export interface Data {
175
+ /**
176
+ * Phone number ID
177
+ */
178
+ id: string;
179
+
180
+ /**
181
+ * The agent the number is assigned to, if any
182
+ */
183
+ agentId: string | null;
184
+
185
+ /**
186
+ * The number in E.164 format
187
+ */
188
+ e164: string;
189
+
190
+ /**
191
+ * Whether the number sits inside the plan free allowance right now
192
+ */
193
+ isFree: boolean;
194
+
195
+ /**
196
+ * ISO 3166-2 code of the region the number is from, when the carrier gave one
197
+ */
198
+ localityCode: string | null;
199
+
200
+ /**
201
+ * What a month of this number costs in micro-dollars; 0 while it is free
202
+ */
203
+ monthlyRentMicros: number;
204
+
205
+ /**
206
+ * Label the project gave the number
207
+ */
208
+ name: string | null;
209
+
210
+ /**
211
+ * When the number was bought (ISO 8601)
212
+ */
213
+ purchasedAt: string;
214
+
215
+ /**
216
+ * When the next month of rent is due (ISO 8601)
217
+ */
218
+ rentNextChargeAt: string;
219
+ }
220
+ }
221
+
222
+ export interface PhoneNumberListResponse {
223
+ data: Array<PhoneNumberListResponse.Data>;
224
+ }
225
+
226
+ export namespace PhoneNumberListResponse {
227
+ /**
228
+ * A phone number the project owns
229
+ */
230
+ export interface Data {
231
+ /**
232
+ * Phone number ID
233
+ */
234
+ id: string;
235
+
236
+ /**
237
+ * The agent the number is assigned to, if any
238
+ */
239
+ agentId: string | null;
240
+
241
+ /**
242
+ * The number in E.164 format
243
+ */
244
+ e164: string;
245
+
246
+ /**
247
+ * Whether the number sits inside the plan free allowance right now
248
+ */
249
+ isFree: boolean;
250
+
251
+ /**
252
+ * ISO 3166-2 code of the region the number is from, when the carrier gave one
253
+ */
254
+ localityCode: string | null;
255
+
256
+ /**
257
+ * What a month of this number costs in micro-dollars; 0 while it is free
258
+ */
259
+ monthlyRentMicros: number;
260
+
261
+ /**
262
+ * Label the project gave the number
263
+ */
264
+ name: string | null;
265
+
266
+ /**
267
+ * When the number was bought (ISO 8601)
268
+ */
269
+ purchasedAt: string;
270
+
271
+ /**
272
+ * When the next month of rent is due (ISO 8601)
273
+ */
274
+ rentNextChargeAt: string;
275
+ }
276
+ }
277
+
278
+ export interface PhoneNumberDeleteResponse {
279
+ /**
280
+ * Confirmation that a phone number was released
281
+ */
282
+ data: PhoneNumberDeleteResponse.Data;
283
+ }
284
+
285
+ export namespace PhoneNumberDeleteResponse {
286
+ /**
287
+ * Confirmation that a phone number was released
288
+ */
289
+ export interface Data {
290
+ /**
291
+ * Phone number ID
292
+ */
293
+ id: string;
294
+
295
+ /**
296
+ * Always true; the number is gone and rent has stopped
297
+ */
298
+ released: true;
299
+ }
300
+ }
301
+
302
+ export interface PhoneNumberGetAllowanceResponse {
303
+ /**
304
+ * How many numbers the organization gets for free and whether it may buy the next
305
+ * one
306
+ */
307
+ data: PhoneNumberGetAllowanceResponse.Data;
308
+ }
309
+
310
+ export namespace PhoneNumberGetAllowanceResponse {
311
+ /**
312
+ * How many numbers the organization gets for free and whether it may buy the next
313
+ * one
314
+ */
315
+ export interface Data {
316
+ /**
317
+ * Why a purchase would be refused; null when canPurchase is true
318
+ */
319
+ blockedReason:
320
+ | 'PAYMENT_METHOD_REQUIRED'
321
+ | 'INSUFFICIENT_CREDITS'
322
+ | 'SPEND_CAP_REACHED'
323
+ | 'PLAN_LIMIT_REACHED'
324
+ | null;
325
+
326
+ /**
327
+ * Whether a purchase would be admitted right now
328
+ */
329
+ canPurchase: boolean;
330
+
331
+ /**
332
+ * Numbers included at no charge
333
+ */
334
+ freeLimit: number;
335
+
336
+ /**
337
+ * True when the free allowance comes from a per-organization override
338
+ */
339
+ isOverridden: boolean;
340
+
341
+ /**
342
+ * What one paid number costs a month, in micro-dollars
343
+ */
344
+ monthlyRentMicros: number;
345
+
346
+ /**
347
+ * Whether the next number would be free
348
+ */
349
+ nextIsFree: boolean;
350
+
351
+ /**
352
+ * How many of those sit outside the free allowance
353
+ */
354
+ paidCount: number;
355
+
356
+ /**
357
+ * The billing plan the allowance comes from
358
+ */
359
+ plan: 'PAYG' | 'TEAM' | 'ENTERPRISE';
360
+
361
+ /**
362
+ * Numbers the organization holds right now
363
+ */
364
+ used: number;
365
+ }
366
+ }
367
+
368
+ export interface PhoneNumberListAvailableResponse {
369
+ data: Array<PhoneNumberListAvailableResponse.Data>;
370
+ }
371
+
372
+ export namespace PhoneNumberListAvailableResponse {
373
+ /**
374
+ * A number the carrier has for sale
375
+ */
376
+ export interface Data {
377
+ /**
378
+ * The number in E.164 format
379
+ */
380
+ e164: string;
381
+
382
+ /**
383
+ * Locality the carrier lists, e.g. a city
384
+ */
385
+ locality: string | null;
386
+
387
+ /**
388
+ * Region the carrier lists, e.g. a state code
389
+ */
390
+ region: string | null;
391
+ }
392
+ }
393
+
394
+ export interface PhoneNumberCreateParams {
395
+ /**
396
+ * The number to buy, in E.164 format, from a search result
397
+ */
398
+ e164: string;
399
+
400
+ /**
401
+ * The agent to assign the number to
402
+ */
403
+ agentId?: string;
404
+
405
+ /**
406
+ * Whether you expect this number to be free (from the allowance). The purchase is
407
+ * refused with 409 if that has changed since you checked.
408
+ */
409
+ expectFree?: boolean;
410
+
411
+ /**
412
+ * The monthly rent you expect for a paid number, in micros (from the allowance).
413
+ * The purchase is refused with 409 if that has changed since you checked.
414
+ */
415
+ expectMonthlyRentMicros?: number;
416
+
417
+ /**
418
+ * A label for the number
419
+ */
420
+ name?: string;
421
+ }
422
+
423
+ export interface PhoneNumberUpdateParams {
424
+ /**
425
+ * Agent to assign the number to; null unassigns, omit to leave it alone
426
+ */
427
+ agentId?: string | null;
428
+
429
+ /**
430
+ * New label; null clears it, omit to leave it alone
431
+ */
432
+ name?: string | null;
433
+ }
434
+
435
+ export interface PhoneNumberListParams {
436
+ /**
437
+ * Only the numbers assigned to this agent
438
+ */
439
+ agentId?: string;
440
+ }
441
+
442
+ export interface PhoneNumberListAvailableParams {
443
+ /**
444
+ * Three-digit US area code
445
+ */
446
+ areaCode?: string;
447
+
448
+ /**
449
+ * Digits or letters the number must contain (1 to 7, \* matches any digit)
450
+ */
451
+ contains?: string;
452
+
453
+ /**
454
+ * Maximum number of results (default: 20, max: 50)
455
+ */
456
+ limit?: number;
457
+ }
458
+
459
+ export declare namespace PhoneNumber {
460
+ export {
461
+ type PhoneNumberCreateResponse as PhoneNumberCreateResponse,
462
+ type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse,
463
+ type PhoneNumberListResponse as PhoneNumberListResponse,
464
+ type PhoneNumberDeleteResponse as PhoneNumberDeleteResponse,
465
+ type PhoneNumberGetAllowanceResponse as PhoneNumberGetAllowanceResponse,
466
+ type PhoneNumberListAvailableResponse as PhoneNumberListAvailableResponse,
467
+ type PhoneNumberCreateParams as PhoneNumberCreateParams,
468
+ type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
469
+ type PhoneNumberListParams as PhoneNumberListParams,
470
+ type PhoneNumberListAvailableParams as PhoneNumberListAvailableParams,
471
+ };
472
+ }
@@ -1627,7 +1627,8 @@ export namespace SimulationRunPlanJobGetCostResponse {
1627
1627
  | 'METRIC'
1628
1628
  | 'TRANSCRIPTION'
1629
1629
  | 'INTERNAL_LLM'
1630
- | 'INTERNAL_STT';
1630
+ | 'INTERNAL_STT'
1631
+ | 'PHONE_NUMBER';
1631
1632
 
1632
1633
  /**
1633
1634
  * SIMULATION or POST_CALL.
@@ -1681,7 +1682,8 @@ export namespace SimulationRunPlanJobGetCostResponse {
1681
1682
  | 'METRIC'
1682
1683
  | 'TRANSCRIPTION'
1683
1684
  | 'INTERNAL_LLM'
1684
- | 'INTERNAL_STT';
1685
+ | 'INTERNAL_STT'
1686
+ | 'PHONE_NUMBER';
1685
1687
 
1686
1688
  /**
1687
1689
  * SIMULATION or POST_CALL.
@@ -198,6 +198,7 @@ export interface SimulationMockToolParams {
198
198
  export type SimulationRunParams =
199
199
  | SimulationRunParams.RunSimulationFromConfig
200
200
  | SimulationRunParams.RunSimulationFromPlanID
201
+ | SimulationRunParams.RunSimulationFromConfigKey
201
202
  | SimulationRunParams.RunSimulationFromTemplate;
202
203
 
203
204
  export declare namespace SimulationRunParams {
@@ -784,6 +785,81 @@ export declare namespace SimulationRunParams {
784
785
  }
785
786
  }
786
787
 
788
+ export interface RunSimulationFromConfigKey {
789
+ /**
790
+ * The config key of a plan to run, as applied from config as code
791
+ * (`simulationPlan/<name>`). Runs a config-managed plan by name, with no id
792
+ * lookup. Unique per project.
793
+ */
794
+ planConfigKey: string;
795
+
796
+ /**
797
+ * Values for the {{variables}} the run resolves, overriding whatever the plan has
798
+ * pinned.
799
+ *
800
+ * An object applies them to the whole run:
801
+ *
802
+ * { "orderNumber": "12345", "tier": "gold" }
803
+ *
804
+ * An array applies them per flow, or to just its happy path or one of its edge
805
+ * cases, when a single set will not do. Each entry carries what it applies to:
806
+ *
807
+ * [ { "flowId": "550e8400-...", "variables": { "orderNumber": "12345" } }, {
808
+ * "flowId": "550e8400-...", "happyPath": true, "variables": { "orderNumber":
809
+ * "55555" } }, { "flowId": "550e8400-...", "edgeCaseId": "7a3d2e1f-...",
810
+ * "variables": { "orderNumber": "67890" } } ]
811
+ *
812
+ * An entry that narrows to neither covers everything that flow resolves. A flow
813
+ * this plan does not attach, or an edge case that does not belong to the flow, is
814
+ * rejected rather than ignored.
815
+ *
816
+ * A plan built on scenarios rather than customer flows targets them the same way,
817
+ * with `scenarioId` in place of `flowId`. That form is deprecated alongside
818
+ * scenarios themselves, and still accepted so runs against those plans keep
819
+ * working.
820
+ */
821
+ variables?:
822
+ | { [key: string]: string }
823
+ | Array<RunSimulationFromConfigKey.UnionMember1>
824
+ | Array<RunSimulationFromConfigKey.UnionMember2>;
825
+ }
826
+
827
+ export namespace RunSimulationFromConfigKey {
828
+ export interface UnionMember1 {
829
+ /**
830
+ * A customer flow this plan runs.
831
+ */
832
+ flowId: string;
833
+
834
+ /**
835
+ * The values to apply.
836
+ */
837
+ variables: { [key: string]: string };
838
+
839
+ /**
840
+ * Narrow to one edge case of that flow.
841
+ */
842
+ edgeCaseId?: string;
843
+
844
+ /**
845
+ * Narrow to the flow's happy path.
846
+ */
847
+ happyPath?: true;
848
+ }
849
+
850
+ export interface UnionMember2 {
851
+ /**
852
+ * ID of the scenario to apply variables to
853
+ */
854
+ scenarioId: string;
855
+
856
+ /**
857
+ * Key-value pairs for this scenario
858
+ */
859
+ variables: { [key: string]: string };
860
+ }
861
+ }
862
+
787
863
  export interface RunSimulationFromTemplate {
788
864
  /**
789
865
  * The agent endpoints to call. No template can know these.
@@ -115,7 +115,8 @@ export namespace UsageGetResponse {
115
115
  | 'METRIC'
116
116
  | 'TRANSCRIPTION'
117
117
  | 'INTERNAL_LLM'
118
- | 'INTERNAL_STT';
118
+ | 'INTERNAL_STT'
119
+ | 'PHONE_NUMBER';
119
120
 
120
121
  /**
121
122
  * Whether this cost came from a SIMULATION or a production call (POST_CALL).
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '5.15.0'; // x-release-please-version
1
+ export const VERSION = '5.17.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.15.0";
1
+ export declare const VERSION = "5.17.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.15.0";
1
+ export declare const VERSION = "5.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '5.15.0'; // x-release-please-version
4
+ exports.VERSION = '5.17.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '5.15.0'; // x-release-please-version
1
+ export const VERSION = '5.17.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map