@roarkanalytics/sdk 5.9.0 → 5.11.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 (67) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/analytics.d.mts +29 -20
  10. package/resources/analytics.d.mts.map +1 -1
  11. package/resources/analytics.d.ts +29 -20
  12. package/resources/analytics.d.ts.map +1 -1
  13. package/resources/call.d.mts +187 -1
  14. package/resources/call.d.mts.map +1 -1
  15. package/resources/call.d.ts +187 -1
  16. package/resources/call.d.ts.map +1 -1
  17. package/resources/call.js +52 -0
  18. package/resources/call.js.map +1 -1
  19. package/resources/call.mjs +52 -0
  20. package/resources/call.mjs.map +1 -1
  21. package/resources/config.d.mts +48 -48
  22. package/resources/config.d.mts.map +1 -1
  23. package/resources/config.d.ts +48 -48
  24. package/resources/config.d.ts.map +1 -1
  25. package/resources/dashboard.d.mts +297 -201
  26. package/resources/dashboard.d.mts.map +1 -1
  27. package/resources/dashboard.d.ts +297 -201
  28. package/resources/dashboard.d.ts.map +1 -1
  29. package/resources/index.d.mts +2 -2
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +2 -2
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/simulation-run-plan-job.d.mts +98 -1
  36. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  37. package/resources/simulation-run-plan-job.d.ts +98 -1
  38. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  39. package/resources/simulation-run-plan-job.js +17 -0
  40. package/resources/simulation-run-plan-job.js.map +1 -1
  41. package/resources/simulation-run-plan-job.mjs +17 -0
  42. package/resources/simulation-run-plan-job.mjs.map +1 -1
  43. package/resources/usage.d.mts +4 -2
  44. package/resources/usage.d.mts.map +1 -1
  45. package/resources/usage.d.ts +4 -2
  46. package/resources/usage.d.ts.map +1 -1
  47. package/resources/usage.js +4 -2
  48. package/resources/usage.js.map +1 -1
  49. package/resources/usage.mjs +4 -2
  50. package/resources/usage.mjs.map +1 -1
  51. package/src/client.ts +10 -0
  52. package/src/resources/analytics.ts +41 -22
  53. package/src/resources/call.ts +249 -0
  54. package/src/resources/config.ts +120 -72
  55. package/src/resources/dashboard.ts +411 -233
  56. package/src/resources/index.ts +5 -0
  57. package/src/resources/simulation-run-plan-job.ts +141 -0
  58. package/src/resources/usage.ts +4 -2
  59. package/src/version.ts +1 -1
  60. package/version.d.mts +1 -1
  61. package/version.d.mts.map +1 -1
  62. package/version.d.ts +1 -1
  63. package/version.d.ts.map +1 -1
  64. package/version.js +1 -1
  65. package/version.js.map +1 -1
  66. package/version.mjs +1 -1
  67. package/version.mjs.map +1 -1
@@ -38,6 +38,22 @@ export class Call extends APIResource {
38
38
  return this._client.get('/v1/call', { query, ...options });
39
39
  }
40
40
 
41
+ /**
42
+ * Deletes a call by its ID. The call, its metrics and its analysis are hidden from
43
+ * every read, and any analysis still running on it is cancelled. Returns 404 when
44
+ * the call does not exist in this project or was already deleted.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const call = await client.call.delete(
49
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
50
+ * );
51
+ * ```
52
+ */
53
+ delete(callID: string, options?: RequestOptions): APIPromise<CallDeleteResponse> {
54
+ return this._client.delete(path`/v1/call/${callID}`, options);
55
+ }
56
+
41
57
  /**
42
58
  * Attach tool invocations that fired during a call to an already-existing call,
43
59
  * asynchronously after the call was created. Use this when the tool-call data
@@ -73,6 +89,27 @@ export class Call extends APIResource {
73
89
  return this._client.post(path`/v1/call/${callID}/tool-invocations`, { body, ...options });
74
90
  }
75
91
 
92
+ /**
93
+ * Deletes up to 100 calls by ID in one request. Each deleted call, its metrics and
94
+ * its analysis are hidden from every read, and any analysis still running on it is
95
+ * cancelled. IDs that do not exist in this project, or were already deleted, are
96
+ * returned in notFoundCallIds and left untouched. The request succeeds even when
97
+ * none of the calls are found. IDs are returned lowercase, each once.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const response = await client.call.batchDelete({
102
+ * callIds: [
103
+ * '550e8400-e29b-41d4-a716-446655440000',
104
+ * '660e8400-e29b-41d4-a716-446655440001',
105
+ * ],
106
+ * });
107
+ * ```
108
+ */
109
+ batchDelete(body: CallBatchDeleteParams, options?: RequestOptions): APIPromise<CallBatchDeleteResponse> {
110
+ return this._client.post('/v1/call/batch-delete', { body, ...options });
111
+ }
112
+
76
113
  /**
77
114
  * Retrieve an existing call by its unique identifier
78
115
  *
@@ -87,6 +124,24 @@ export class Call extends APIResource {
87
124
  return this._client.get(path`/v1/call/${callID}`, options);
88
125
  }
89
126
 
127
+ /**
128
+ * The billable spend attributed to one call, split by cost type, with every cost
129
+ * line behind it. Simulated calls include the costs their simulation incurred
130
+ * before the call connected. Amounts are billable spend only, in exact
131
+ * micro-dollars (`\*UsdMicros`) and dollars (`\*Usd`, for display). Requires an
132
+ * API key with the `billing:read` permission.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const response = await client.call.getCost(
137
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
138
+ * );
139
+ * ```
140
+ */
141
+ getCost(callID: string, options?: RequestOptions): APIPromise<CallGetCostResponse> {
142
+ return this._client.get(path`/v1/call/${callID}/cost`, options);
143
+ }
144
+
90
145
  /**
91
146
  * Fetch the full transcript for a specific call. Optionally specify a
92
147
  * transcription source; otherwise the best available source is used automatically.
@@ -428,6 +483,24 @@ export namespace CallListResponse {
428
483
  }
429
484
  }
430
485
 
486
+ export interface CallDeleteResponse {
487
+ data: CallDeleteResponse.Data;
488
+ }
489
+
490
+ export namespace CallDeleteResponse {
491
+ export interface Data {
492
+ /**
493
+ * ID of the deleted call
494
+ */
495
+ id: string;
496
+
497
+ /**
498
+ * Always true when the call was deleted
499
+ */
500
+ deleted: true;
501
+ }
502
+ }
503
+
431
504
  export interface CallAppendToolInvocationsResponse {
432
505
  /**
433
506
  * Result of appending tool invocations to a call.
@@ -539,6 +612,25 @@ export namespace CallAppendToolInvocationsResponse {
539
612
  }
540
613
  }
541
614
 
615
+ export interface CallBatchDeleteResponse {
616
+ data: CallBatchDeleteResponse.Data;
617
+ }
618
+
619
+ export namespace CallBatchDeleteResponse {
620
+ export interface Data {
621
+ /**
622
+ * Calls this request deleted
623
+ */
624
+ deletedCallIds: Array<string>;
625
+
626
+ /**
627
+ * Requested calls that were not deleted because they do not exist in this project
628
+ * or were already deleted
629
+ */
630
+ notFoundCallIds: Array<string>;
631
+ }
632
+ }
633
+
542
634
  export interface CallGetByIDResponse {
543
635
  /**
544
636
  * Response containing call information
@@ -707,6 +799,123 @@ export namespace CallGetByIDResponse {
707
799
  }
708
800
  }
709
801
 
802
+ export interface CallGetCostResponse {
803
+ data: CallGetCostResponse.Data;
804
+ }
805
+
806
+ export namespace CallGetCostResponse {
807
+ export interface Data {
808
+ /**
809
+ * Spend by cost type. Sums to totalUsdMicros.
810
+ */
811
+ breakdown: Array<Data.Breakdown>;
812
+
813
+ callId: string;
814
+
815
+ currency: 'usd';
816
+
817
+ /**
818
+ * Every billable cost line attributed to the call.
819
+ */
820
+ items: Array<Data.Item>;
821
+
822
+ totalUsd: number;
823
+
824
+ /**
825
+ * Total billable spend for this call, in micro-dollars.
826
+ */
827
+ totalUsdMicros: number;
828
+ }
829
+
830
+ export namespace Data {
831
+ export interface Breakdown {
832
+ /**
833
+ * The same figure in US dollars.
834
+ */
835
+ amountUsd: number;
836
+
837
+ /**
838
+ * Billable spend for this type, in micro-dollars.
839
+ */
840
+ amountUsdMicros: number;
841
+
842
+ /**
843
+ * Units billed (see the line items for the unit).
844
+ */
845
+ quantity: number;
846
+
847
+ /**
848
+ * The cost source, e.g. SIM_PLATFORM_FEE, SIM_LLM, METRIC.
849
+ */
850
+ source:
851
+ | 'SIM_PLATFORM_FEE'
852
+ | 'SIM_TTS'
853
+ | 'SIM_STT'
854
+ | 'SIM_LLM'
855
+ | 'SIM_TELEPHONY'
856
+ | 'METRIC'
857
+ | 'TRANSCRIPTION'
858
+ | 'INTERNAL_LLM'
859
+ | 'INTERNAL_STT';
860
+
861
+ /**
862
+ * SIMULATION or POST_CALL.
863
+ */
864
+ surface: 'SIMULATION' | 'POST_CALL';
865
+ }
866
+
867
+ export interface Item {
868
+ amountUsd: number;
869
+
870
+ amountUsdMicros: number;
871
+
872
+ /**
873
+ * Stable id of the cost event. Use it to deduplicate.
874
+ */
875
+ eventId: string;
876
+
877
+ /**
878
+ * The grading pass a METRIC line paid for. A call graded twice carries one line
879
+ * per pass.
880
+ */
881
+ metricCollectionJobId: string | null;
882
+
883
+ /**
884
+ * The metric a METRIC line was charged for.
885
+ */
886
+ metricDefinitionId: string | null;
887
+
888
+ model: string | null;
889
+
890
+ /**
891
+ * When the cost was incurred, ISO 8601.
892
+ */
893
+ occurredAt: string;
894
+
895
+ provider: string | null;
896
+
897
+ quantity: number;
898
+
899
+ quantityUnit: 'MINUTES' | 'INPUT_TOKENS' | 'OUTPUT_TOKENS' | 'CHARACTERS' | 'AUDIO_SECONDS' | 'UNITS';
900
+
901
+ simulationJobId: string | null;
902
+
903
+ source:
904
+ | 'SIM_PLATFORM_FEE'
905
+ | 'SIM_TTS'
906
+ | 'SIM_STT'
907
+ | 'SIM_LLM'
908
+ | 'SIM_TELEPHONY'
909
+ | 'METRIC'
910
+ | 'TRANSCRIPTION'
911
+ | 'INTERNAL_LLM'
912
+ | 'INTERNAL_STT';
913
+
914
+ surface: 'SIMULATION' | 'POST_CALL';
915
+ }
916
+ }
917
+ }
918
+
710
919
  export interface CallGetTranscriptResponse {
711
920
  /**
712
921
  * Call transcript response
@@ -2099,6 +2308,17 @@ export interface CallListParams {
2099
2308
  */
2100
2309
  limit?: number;
2101
2310
 
2311
+ /**
2312
+ * Filter on custom properties, one entry per property name:
2313
+ * properties[<name>][exists]=true keeps calls that have the property set (whatever
2314
+ * the value), properties[<name>][exists]=false keeps calls missing it (never sent,
2315
+ * sent as null, or removed). A property the project has never seen is missing on
2316
+ * every call. Names match the way properties are stored, so planTier and plan_tier
2317
+ * are one property. At most 20 properties; a name taken by a built-in call filter,
2318
+ * such as status, is rejected with 400.
2319
+ */
2320
+ properties?: { [key: string]: CallListParams.Property };
2321
+
2102
2322
  /**
2103
2323
  * Search text to filter calls by title, summary, or transcript
2104
2324
  */
@@ -2137,6 +2357,24 @@ export interface CallListParams {
2137
2357
  status?: 'RINGING' | 'IN_PROGRESS' | 'ENDED';
2138
2358
  }
2139
2359
 
2360
+ export namespace CallListParams {
2361
+ /**
2362
+ * Filter on custom properties, one entry per property name:
2363
+ * properties[<name>][exists]=true keeps calls that have the property set (whatever
2364
+ * the value), properties[<name>][exists]=false keeps calls missing it (never sent,
2365
+ * sent as null, or removed). A property the project has never seen is missing on
2366
+ * every call. Names match the way properties are stored, so planTier and plan_tier
2367
+ * are one property. At most 20 properties; a name taken by a built-in call filter,
2368
+ * such as status, is rejected with 400.
2369
+ */
2370
+ export interface Property {
2371
+ /**
2372
+ * true: the property is set. false: the property is missing.
2373
+ */
2374
+ exists?: boolean;
2375
+ }
2376
+ }
2377
+
2140
2378
  export interface CallAppendToolInvocationsParams {
2141
2379
  /**
2142
2380
  * Tool invocations that fired during the call, to attach to it. Max 500 per
@@ -2225,6 +2463,13 @@ export namespace CallAppendToolInvocationsParams {
2225
2463
  }
2226
2464
  }
2227
2465
 
2466
+ export interface CallBatchDeleteParams {
2467
+ /**
2468
+ * IDs of the calls to delete, at most 100. Repeated IDs are counted once.
2469
+ */
2470
+ callIds: Array<string>;
2471
+ }
2472
+
2228
2473
  export interface CallGetTranscriptParams {
2229
2474
  /**
2230
2475
  * Transcription source to fetch. When omitted, uses the preferred source based on
@@ -2281,8 +2526,11 @@ export declare namespace Call {
2281
2526
  export {
2282
2527
  type CallCreateResponse as CallCreateResponse,
2283
2528
  type CallListResponse as CallListResponse,
2529
+ type CallDeleteResponse as CallDeleteResponse,
2284
2530
  type CallAppendToolInvocationsResponse as CallAppendToolInvocationsResponse,
2531
+ type CallBatchDeleteResponse as CallBatchDeleteResponse,
2285
2532
  type CallGetByIDResponse as CallGetByIDResponse,
2533
+ type CallGetCostResponse as CallGetCostResponse,
2286
2534
  type CallGetTranscriptResponse as CallGetTranscriptResponse,
2287
2535
  type CallListMetricsResponse as CallListMetricsResponse,
2288
2536
  type CallListSentimentRunsResponse as CallListSentimentRunsResponse,
@@ -2290,6 +2538,7 @@ export declare namespace Call {
2290
2538
  type CallCreateParams as CallCreateParams,
2291
2539
  type CallListParams as CallListParams,
2292
2540
  type CallAppendToolInvocationsParams as CallAppendToolInvocationsParams,
2541
+ type CallBatchDeleteParams as CallBatchDeleteParams,
2293
2542
  type CallGetTranscriptParams as CallGetTranscriptParams,
2294
2543
  type CallListMetricsParams as CallListMetricsParams,
2295
2544
  type CallUpdatePropertiesParams as CallUpdatePropertiesParams,