@talqing/sdk 0.11.0 → 0.13.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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // This file is auto-generated by @hey-api/openapi-ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Tasks2 = exports.Versions2 = exports.Runs = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Streams = exports.Secrets = exports.Schemas = exports.Functions = exports.Observability = exports.Integrations = exports.Triggers = exports.McpTools = exports.Faqs = exports.Entries = exports.Email = exports.Senders = exports.Batches2 = exports.Sends = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items2 = exports.Chats = exports.Tokens = exports.Messages = exports.Items = exports.Analysis2 = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Models = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
5
- exports.TalqingApi = exports.Whatsapp = exports.TwilioSenders = exports.Templates = exports.Batches3 = exports.Recipients3 = exports.Webhooks = exports.Tools2 = exports.Versions3 = void 0;
4
+ exports.Versions2 = exports.TaskRuns = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Streams = exports.Secrets = exports.Schemas = exports.Functions = exports.Observability = exports.Integrations = exports.Triggers = exports.McpTools = exports.InboundWebhook = exports.Faqs = exports.Entries = exports.Email = exports.Senders = exports.Batches2 = exports.Sends = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items2 = exports.Chats = exports.Tokens = exports.Messages = exports.Items = exports.Analysis2 = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Models = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
5
+ exports.TalqingApi = exports.Whatsapp = exports.TwilioSenders = exports.Templates = exports.Batches3 = exports.Recipients3 = exports.Webhooks = exports.Tools2 = exports.Versions3 = exports.Tasks2 = void 0;
6
6
  const client_gen_js_1 = require("./client.gen.js");
7
7
  const index_js_1 = require("./client/index.js");
8
8
  class HeyApiClient {
@@ -899,7 +899,8 @@ class Calls extends HeyApiClient {
899
899
  { in: 'query', key: 'outcome' },
900
900
  { in: 'query', key: 'contact_key' },
901
901
  { in: 'query', key: 'close_reason' },
902
- { in: 'query', key: 'batch_id' }
902
+ { in: 'query', key: 'batch_id' },
903
+ { in: 'query', key: 'metadata' }
903
904
  ] }]);
904
905
  return (options?.client ?? this.client).get({
905
906
  responseStyle: 'data',
@@ -1087,8 +1088,9 @@ class Calls extends HeyApiClient {
1087
1088
  *
1088
1089
  * Mint a token for a new web call that continues one that ended.
1089
1090
  *
1090
- * It answers with the agent that held the floor, with the context it had. 409
1091
- * if the call is not a web call, is still ending, or was already resumed.
1091
+ * It answers with the agent that held the floor, with the context it had, in the
1092
+ * dropped call's region unless you pass `region`. 409 if the call is not a web
1093
+ * call, is still ending, or was already resumed.
1092
1094
  */
1093
1095
  resume(parameters, options) {
1094
1096
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'session_id' }, { key: 'resumeCallRequest', map: 'body' }] }]);
@@ -1492,7 +1494,8 @@ class Chats extends HeyApiClient {
1492
1494
  { in: 'query', key: 'offset' },
1493
1495
  { in: 'query', key: 'agent_id' },
1494
1496
  { in: 'query', key: 'contact_key' },
1495
- { in: 'query', key: 'status' }
1497
+ { in: 'query', key: 'status' },
1498
+ { in: 'query', key: 'metadata' }
1496
1499
  ] }]);
1497
1500
  return (options?.client ?? this.client).get({
1498
1501
  responseStyle: 'data',
@@ -1624,6 +1627,30 @@ class Chats extends HeyApiClient {
1624
1627
  }
1625
1628
  exports.Chats = Chats;
1626
1629
  class Items2 extends HeyApiClient {
1630
+ /**
1631
+ * Create Conversation Item
1632
+ *
1633
+ * Post a template, agent text, note or instruction into a conversation, or start one with a person.
1634
+ */
1635
+ create(parameters, options) {
1636
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'postItemRequest', map: 'body' }] }]);
1637
+ return (options?.client ?? this.client).post({
1638
+ responseStyle: 'data',
1639
+ security: [{ scheme: 'bearer', type: 'http' }, {
1640
+ in: 'cookie',
1641
+ name: 'talqing_sid',
1642
+ type: 'apiKey'
1643
+ }],
1644
+ url: '/v1/conversations/items',
1645
+ ...options,
1646
+ ...params,
1647
+ headers: {
1648
+ 'Content-Type': 'application/json',
1649
+ ...options?.headers,
1650
+ ...params.headers
1651
+ }
1652
+ });
1653
+ }
1627
1654
  /**
1628
1655
  * List Conversation Items
1629
1656
  *
@@ -2787,6 +2814,108 @@ class Faqs extends HeyApiClient {
2787
2814
  }
2788
2815
  }
2789
2816
  exports.Faqs = Faqs;
2817
+ class InboundWebhook extends HeyApiClient {
2818
+ /**
2819
+ * Delete Inbound Webhook
2820
+ *
2821
+ * Remove the inbound session webhook.
2822
+ */
2823
+ delete(options) {
2824
+ return (options?.client ?? this.client).delete({
2825
+ responseStyle: 'data',
2826
+ security: [{ scheme: 'bearer', type: 'http' }, {
2827
+ in: 'cookie',
2828
+ name: 'talqing_sid',
2829
+ type: 'apiKey'
2830
+ }],
2831
+ url: '/v1/inbound-webhook',
2832
+ ...options
2833
+ });
2834
+ }
2835
+ /**
2836
+ * Get Inbound Webhook
2837
+ *
2838
+ * Get the workspace's inbound session webhook.
2839
+ */
2840
+ get(options) {
2841
+ return (options?.client ?? this.client).get({
2842
+ responseStyle: 'data',
2843
+ security: [{ scheme: 'bearer', type: 'http' }, {
2844
+ in: 'cookie',
2845
+ name: 'talqing_sid',
2846
+ type: 'apiKey'
2847
+ }],
2848
+ url: '/v1/inbound-webhook',
2849
+ ...options
2850
+ });
2851
+ }
2852
+ /**
2853
+ * Set Inbound Webhook
2854
+ *
2855
+ * Set the URL asked for an inbound session's configuration.
2856
+ */
2857
+ set(parameters, options) {
2858
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'setInboundWebhookRequest', map: 'body' }] }]);
2859
+ return (options?.client ?? this.client).put({
2860
+ responseStyle: 'data',
2861
+ security: [{ scheme: 'bearer', type: 'http' }, {
2862
+ in: 'cookie',
2863
+ name: 'talqing_sid',
2864
+ type: 'apiKey'
2865
+ }],
2866
+ url: '/v1/inbound-webhook',
2867
+ ...options,
2868
+ ...params,
2869
+ headers: {
2870
+ 'Content-Type': 'application/json',
2871
+ ...options?.headers,
2872
+ ...params.headers
2873
+ }
2874
+ });
2875
+ }
2876
+ /**
2877
+ * Rotate Inbound Webhook Secret
2878
+ *
2879
+ * Issue a new signing secret; the old one stops working at once.
2880
+ */
2881
+ rotateSecret(options) {
2882
+ return (options?.client ?? this.client).post({
2883
+ responseStyle: 'data',
2884
+ security: [{ scheme: 'bearer', type: 'http' }, {
2885
+ in: 'cookie',
2886
+ name: 'talqing_sid',
2887
+ type: 'apiKey'
2888
+ }],
2889
+ url: '/v1/inbound-webhook/rotate-secret',
2890
+ ...options
2891
+ });
2892
+ }
2893
+ /**
2894
+ * Test Inbound Webhook
2895
+ *
2896
+ * Send a sample request and check the reply against the response schema.
2897
+ */
2898
+ test(parameters, options) {
2899
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'testInboundWebhookRequest', map: 'body' }] }]);
2900
+ return (options?.client ?? this.client).post({
2901
+ responseStyle: 'data',
2902
+ security: [{ scheme: 'bearer', type: 'http' }, {
2903
+ in: 'cookie',
2904
+ name: 'talqing_sid',
2905
+ type: 'apiKey'
2906
+ }],
2907
+ url: '/v1/inbound-webhook/test',
2908
+ ...options,
2909
+ ...params,
2910
+ headers: {
2911
+ 'Content-Type': 'application/json',
2912
+ ...options?.headers,
2913
+ ...params.headers
2914
+ }
2915
+ });
2916
+ }
2917
+ }
2918
+ exports.InboundWebhook = InboundWebhook;
2790
2919
  class McpTools extends HeyApiClient {
2791
2920
  /**
2792
2921
  * List Integration Mcp Tools
@@ -3787,18 +3916,19 @@ class Telephony extends HeyApiClient {
3787
3916
  }
3788
3917
  }
3789
3918
  exports.Telephony = Telephony;
3790
- class Runs extends HeyApiClient {
3919
+ class TaskRuns extends HeyApiClient {
3791
3920
  /**
3792
3921
  * List Task Runs
3793
3922
  *
3794
- * This task's runs, newest first, each with its output, trace and cost.
3795
- *
3796
- * `task_version` says which published definition each one ran, and is null for
3797
- * a run of the draft.
3923
+ * Task runs, newest first, without traces or inputs.
3798
3924
  */
3799
3925
  list(parameters, options) {
3800
3926
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
3801
- { in: 'path', key: 'task_id' },
3927
+ { in: 'query', key: 'task_id' },
3928
+ { in: 'query', key: 'status' },
3929
+ { in: 'query', key: 'metadata' },
3930
+ { in: 'query', key: 'created_after' },
3931
+ { in: 'query', key: 'created_before' },
3802
3932
  { in: 'query', key: 'limit' },
3803
3933
  { in: 'query', key: 'offset' }
3804
3934
  ] }]);
@@ -3809,7 +3939,7 @@ class Runs extends HeyApiClient {
3809
3939
  name: 'talqing_sid',
3810
3940
  type: 'apiKey'
3811
3941
  }],
3812
- url: '/v1/tasks/{task_id}/runs',
3942
+ url: '/v1/task-runs',
3813
3943
  ...options,
3814
3944
  ...params
3815
3945
  });
@@ -3817,21 +3947,12 @@ class Runs extends HeyApiClient {
3817
3947
  /**
3818
3948
  * Run Task
3819
3949
  *
3820
- * Run the task once with the variables you supply, and wait for the result.
3821
- *
3822
- * **This executes for real**: the tools call your endpoints with your secrets,
3823
- * the MCP servers spend your credits, and the model spends your tokens. A task
3824
- * that books a slot, charges a card or sends a message will do so.
3950
+ * Run a task for real: its tools, MCP servers and model all act and spend.
3825
3951
  *
3826
- * Runs the published version unless `version` names another one, or `"draft"`
3827
- * to run the unpublished config. `vars` must match what that version declares
3828
- * — an unknown name is refused rather than dropped. The response is the whole
3829
- * run: the structured `output`, a `trace` of every tool call, the steps used
3830
- * and what the tokens cost. On failure `error.type` says whose problem it is.
3831
- * Secrets are redacted.
3952
+ * Waits and returns the finished run, or with `background: true` queues it and returns 202.
3832
3953
  */
3833
3954
  create(parameters, options) {
3834
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
3955
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTaskRunRequest', map: 'body' }] }]);
3835
3956
  return (options?.client ?? this.client).post({
3836
3957
  responseStyle: 'data',
3837
3958
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3839,7 +3960,7 @@ class Runs extends HeyApiClient {
3839
3960
  name: 'talqing_sid',
3840
3961
  type: 'apiKey'
3841
3962
  }],
3842
- url: '/v1/tasks/{task_id}/runs',
3963
+ url: '/v1/task-runs',
3843
3964
  ...options,
3844
3965
  ...params,
3845
3966
  headers: {
@@ -3850,17 +3971,79 @@ class Runs extends HeyApiClient {
3850
3971
  });
3851
3972
  }
3852
3973
  /**
3853
- * Get Task Run
3974
+ * Run Task Batch
3854
3975
  *
3855
- * One run in full: what it produced, every tool it called on the way, and
3856
- * what it cost.
3976
+ * Queue up to 1000 runs of one task, in the background. One invalid item refuses all.
3977
+ */
3978
+ createBatch(parameters, options) {
3979
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTaskRunBatchRequest', map: 'body' }] }]);
3980
+ return (options?.client ?? this.client).post({
3981
+ responseStyle: 'data',
3982
+ security: [{ scheme: 'bearer', type: 'http' }, {
3983
+ in: 'cookie',
3984
+ name: 'talqing_sid',
3985
+ type: 'apiKey'
3986
+ }],
3987
+ url: '/v1/task-runs/batch',
3988
+ ...options,
3989
+ ...params,
3990
+ headers: {
3991
+ 'Content-Type': 'application/json',
3992
+ ...options?.headers,
3993
+ ...params.headers
3994
+ }
3995
+ });
3996
+ }
3997
+ /**
3998
+ * Delete Task Runs
3857
3999
  *
3858
- * This is what answers "why did it write that" for a caller holding one run id
3859
- * — an email batch's review table links each drafted row here. Secret values
3860
- * are redacted from the trace, and a trace that was cut reports it.
4000
+ * Delete the content of every run whose metadata matches, as `delete_task_run` does.
4001
+ */
4002
+ deleteMany(parameters, options) {
4003
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'deleteTaskRunsRequest', map: 'body' }] }]);
4004
+ return (options?.client ?? this.client).post({
4005
+ responseStyle: 'data',
4006
+ security: [{ scheme: 'bearer', type: 'http' }, {
4007
+ in: 'cookie',
4008
+ name: 'talqing_sid',
4009
+ type: 'apiKey'
4010
+ }],
4011
+ url: '/v1/task-runs/delete',
4012
+ ...options,
4013
+ ...params,
4014
+ headers: {
4015
+ 'Content-Type': 'application/json',
4016
+ ...options?.headers,
4017
+ ...params.headers
4018
+ }
4019
+ });
4020
+ }
4021
+ /**
4022
+ * Delete Task Run
4023
+ *
4024
+ * Delete a run's inputs, files, output and trace; its cost and metadata stay.
4025
+ */
4026
+ delete(parameters, options) {
4027
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
4028
+ return (options?.client ?? this.client).delete({
4029
+ responseStyle: 'data',
4030
+ security: [{ scheme: 'bearer', type: 'http' }, {
4031
+ in: 'cookie',
4032
+ name: 'talqing_sid',
4033
+ type: 'apiKey'
4034
+ }],
4035
+ url: '/v1/task-runs/{run_id}',
4036
+ ...options,
4037
+ ...params
4038
+ });
4039
+ }
4040
+ /**
4041
+ * Get Task Run
4042
+ *
4043
+ * One run in full: its config, inputs, output, trace and cost. Secrets are redacted.
3861
4044
  */
3862
4045
  get(parameters, options) {
3863
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'run_id' }] }]);
4046
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
3864
4047
  return (options?.client ?? this.client).get({
3865
4048
  responseStyle: 'data',
3866
4049
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3868,13 +4051,32 @@ class Runs extends HeyApiClient {
3868
4051
  name: 'talqing_sid',
3869
4052
  type: 'apiKey'
3870
4053
  }],
3871
- url: '/v1/tasks/{task_id}/runs/{run_id}',
4054
+ url: '/v1/task-runs/{run_id}',
4055
+ ...options,
4056
+ ...params
4057
+ });
4058
+ }
4059
+ /**
4060
+ * Cancel Task Run
4061
+ *
4062
+ * Cancel a queued or background run. A running one stops within seconds.
4063
+ */
4064
+ cancel(parameters, options) {
4065
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
4066
+ return (options?.client ?? this.client).post({
4067
+ responseStyle: 'data',
4068
+ security: [{ scheme: 'bearer', type: 'http' }, {
4069
+ in: 'cookie',
4070
+ name: 'talqing_sid',
4071
+ type: 'apiKey'
4072
+ }],
4073
+ url: '/v1/task-runs/{run_id}/cancel',
3872
4074
  ...options,
3873
4075
  ...params
3874
4076
  });
3875
4077
  }
3876
4078
  }
3877
- exports.Runs = Runs;
4079
+ exports.TaskRuns = TaskRuns;
3878
4080
  class Versions2 extends HeyApiClient {
3879
4081
  /**
3880
4082
  * Get Task Version
@@ -3959,7 +4161,7 @@ class Tasks2 extends HeyApiClient {
3959
4161
  * `output` is what makes this a task rather than a chat agent — declare the
3960
4162
  * fields the model must produce and it is given a `submit_result` tool built
3961
4163
  * from them. `vars` are its inputs, read as `{{vars.name}}`. The task starts
3962
- * unpublished; publish it before running it.
4164
+ * unpublished; publish it before running it with `POST /task-runs`.
3963
4165
  */
3964
4166
  create(parameters, options) {
3965
4167
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
@@ -4094,9 +4296,6 @@ class Tasks2 extends HeyApiClient {
4094
4296
  ...params
4095
4297
  });
4096
4298
  }
4097
- get runs() {
4098
- return this._runs ?? (this._runs = new Runs({ client: this.client }));
4099
- }
4100
4299
  get versions() {
4101
4300
  return this._versions ?? (this._versions = new Versions2({ client: this.client }));
4102
4301
  }
@@ -4973,6 +5172,9 @@ class TalqingApi extends HeyApiClient {
4973
5172
  get faqs() {
4974
5173
  return this._faqs ?? (this._faqs = new Faqs({ client: this.client }));
4975
5174
  }
5175
+ get inboundWebhook() {
5176
+ return this._inboundWebhook ?? (this._inboundWebhook = new InboundWebhook({ client: this.client }));
5177
+ }
4976
5178
  get integrations() {
4977
5179
  return this._integrations ?? (this._integrations = new Integrations({ client: this.client }));
4978
5180
  }
@@ -4988,6 +5190,9 @@ class TalqingApi extends HeyApiClient {
4988
5190
  get telephony() {
4989
5191
  return this._telephony ?? (this._telephony = new Telephony({ client: this.client }));
4990
5192
  }
5193
+ get taskRuns() {
5194
+ return this._taskRuns ?? (this._taskRuns = new TaskRuns({ client: this.client }));
5195
+ }
4991
5196
  get tasks() {
4992
5197
  return this._tasks ?? (this._tasks = new Tasks2({ client: this.client }));
4993
5198
  }