@talqing/sdk 0.3.0 → 0.4.1

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { client } from './client.gen.js';
4
4
  import { buildClientParams, type Client, type ClientMeta, type Options as Options2, type RequestResult, type ServerSentEventsResult, type TDataShape } from './client/index.js';
5
- import type { AddRecipientsRequest, AddVoiceRequest, AgentsCreateErrors, AgentsCreateResults, AgentsDeleteErrors, AgentsDeleteResults, AgentsGetErrors, AgentsGetResults, AgentsListErrors, AgentsListResults, AgentsPublishErrors, AgentsPublishResults, AgentsUpdateErrors, AgentsUpdateResults, AgentsValidateErrors, AgentsValidateResults, AgentsVersionsGetErrors, AgentsVersionsGetResults, AgentsVersionsRollbackErrors, AgentsVersionsRollbackResults, AssignPhoneNumberRequest, BackfillAnalysisRequest, BillingCreditsCheckoutErrors, BillingCreditsCheckoutResults, BillingCreditsGetErrors, BillingCreditsGetResults, BillingCreditsLedgerErrors, BillingCreditsLedgerResults, BuildKBRequest, CallsAnalysisBackfillErrors, CallsAnalysisBackfillResults, CallsAnalysisPreviewErrors, CallsAnalysisPreviewResults, CallsBatchesCancelErrors, CallsBatchesCancelResults, CallsBatchesCreateErrors, CallsBatchesCreateResults, CallsBatchesGetErrors, CallsBatchesGetResults, CallsBatchesListErrors, CallsBatchesListResults, CallsBatchesPauseErrors, CallsBatchesPauseResults, CallsBatchesRecipientsAddErrors, CallsBatchesRecipientsAddResults, CallsBatchesRecipientsListErrors, CallsBatchesRecipientsListResults, CallsBatchesResumeErrors, CallsBatchesResumeResults, CallsBatchesUpdateErrors, CallsBatchesUpdateResults, CallsDeleteErrors, CallsDeleteResults, CallsGetErrors, CallsGetResults, CallsListErrors, CallsListResults, CallsOutboundErrors, CallsOutboundResults, CallsRecordingDeleteErrors, CallsRecordingDeleteResults, CallsRecordingGetErrors, CallsRecordingGetResults, CallsScreenRecordingGetErrors, CallsScreenRecordingGetResults, CallsStatsErrors, CallsStatsResults, CallsTokenErrors, CallsTokenResults, CatalogAvatarsListErrors, CatalogAvatarsListResults, CatalogGetErrors, CatalogGetResults, CatalogVoicesElevenlabsAddErrors, CatalogVoicesElevenlabsAddResults, CatalogVoicesElevenlabsSettingsErrors, CatalogVoicesElevenlabsSettingsResults, CatalogVoicesListErrors, CatalogVoicesListResults, ConversationsCreateErrors, ConversationsCreateResults, ConversationsEventsErrors, ConversationsEventsResult, ConversationsEventsResults, ConversationsGetErrors, ConversationsGetResults, ConversationsItemsListErrors, ConversationsItemsListResults, ConversationsListErrors, ConversationsListResults, ConversationsMessagesCreateErrors, ConversationsMessagesCreateResults, ConversationsSessionsListErrors, ConversationsSessionsListResults, ConversationsSnapshotErrors, ConversationsSnapshotResults, ConversationsUpdateErrors, ConversationsUpdateResults, CopilotAgentsSendErrors, CopilotAgentsSendResults, CopilotAgentsStreamErrors, CopilotAgentsStreamResult, CopilotAgentsStreamResults, CopilotKnowledgeSendErrors, CopilotKnowledgeSendResults, CopilotKnowledgeStreamErrors, CopilotKnowledgeStreamResult, CopilotKnowledgeStreamResults, CopilotTasksSendErrors, CopilotTasksSendResults, CopilotTasksStreamErrors, CopilotTasksStreamResult, CopilotTasksStreamResults, CopilotToolsSendErrors, CopilotToolsSendResults, CopilotToolsStreamErrors, CopilotToolsStreamResult, CopilotToolsStreamResults, CreateAgentRequest, CreateCallBatchRequest, CreateEmailBatchRequest, CreateIntegrationRequest, CreateIntegrationTriggerRequest, CreateKBRequest, CreateSecretRequest, CreateTaskRequest, CreateTelephonyAccountRequest, CreateTextConversationRequest, CreateToolRequest, CreateWebhookRequest, CreditCheckoutRequest, EmailBatchesCancelErrors, EmailBatchesCancelResults, EmailBatchesCreateErrors, EmailBatchesCreateResults, EmailBatchesGetErrors, EmailBatchesGetResults, EmailBatchesListErrors, EmailBatchesListResults, EmailBatchesPauseErrors, EmailBatchesPauseResults, EmailBatchesRecipientsListErrors, EmailBatchesRecipientsListResults, EmailBatchesRecipientsRestoreErrors, EmailBatchesRecipientsRestoreResults, EmailBatchesRecipientsRetryErrors, EmailBatchesRecipientsRetryResults, EmailBatchesRecipientsSendErrors, EmailBatchesRecipientsSendResults, EmailBatchesRecipientsSkipErrors, EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsUpdateErrors, EmailBatchesRecipientsUpdateResults, EmailBatchesResumeErrors, EmailBatchesResumeResults, EmailBatchesUpdateErrors, EmailBatchesUpdateResults, EmailSendersListErrors, EmailSendersListResults, HealthErrors, HealthResults, ImportPhoneNumbersRequest, IntegrationsCatalogErrors, IntegrationsCatalogResults, IntegrationsCreateErrors, IntegrationsCreateResults, IntegrationsDeleteErrors, IntegrationsDeleteResults, IntegrationsGetErrors, IntegrationsGetResults, IntegrationsListErrors, IntegrationsListResults, IntegrationsMcpToolsListErrors, IntegrationsMcpToolsListResults, IntegrationsTriggersCreateErrors, IntegrationsTriggersCreateResults, IntegrationsTriggersDeleteErrors, IntegrationsTriggersDeleteResults, IntegrationsTriggersListErrors, IntegrationsTriggersListResults, IntegrationsTriggersUpdateErrors, IntegrationsTriggersUpdateResults, IntegrationsUpdateErrors, IntegrationsUpdateResults, KnowledgeBuildErrors, KnowledgeBuildResults, KnowledgeCreateErrors, KnowledgeCreateResults, KnowledgeDeleteErrors, KnowledgeDeleteResults, KnowledgeEventsErrors, KnowledgeEventsResult, KnowledgeEventsResults, KnowledgeGetErrors, KnowledgeGetResults, KnowledgeListErrors, KnowledgeListResults, KnowledgeNodesDeleteErrors, KnowledgeNodesDeleteResults, KnowledgeNodesGetErrors, KnowledgeNodesGetResults, KnowledgeNodesUpdateErrors, KnowledgeNodesUpdateResults, KnowledgePagesListErrors, KnowledgePagesListResults, KnowledgePromptErrors, KnowledgePromptResults, KnowledgeRegenerateTocErrors, KnowledgeRegenerateTocResults, ObservabilityGetErrors, ObservabilityGetResults, OutboundCallRequest, PatchCallBatchRequest, PatchConversationRequest, PatchEmailBatchRequest, PatchEmailRecipientRequest, PatchIntegrationRequest, PatchIntegrationTriggerRequest, PatchNodeRequest, PatchPhoneNumberRequest, PatchTaskRequest, PatchTelephonyAccountRequest, PatchToolRequest, PatchWebhookRequest, PreviewAnalysisRequest, ProviderKeysDeleteErrors, ProviderKeysDeleteResults, ProviderKeysListErrors, ProviderKeysListResults, ProviderKeysSetErrors, ProviderKeysSetResults, PublishToolRequest, RunTaskRequest, RunToolRequest, SchemasGetErrors, SchemasGetResults, SecretsCreateErrors, SecretsCreateResults, SecretsDeleteErrors, SecretsDeleteResults, SecretsListErrors, SecretsListResults, SelectRecipientsRequest, SendEmailBatchRequest, SendMessageRequest, SetProviderKeyRequest, TasksCreateErrors, TasksCreateResults, TasksDeleteErrors, TasksDeleteResults, TasksGetErrors, TasksGetResults, TasksListErrors, TasksListResults, TasksRunsCreateErrors, TasksRunsCreateResults, TasksRunsGetErrors, TasksRunsGetResults, TasksRunsListErrors, TasksRunsListResults, TasksUpdateErrors, TasksUpdateResults, TelephonyAccountsCreateErrors, TelephonyAccountsCreateResults, TelephonyAccountsDeleteErrors, TelephonyAccountsDeleteResults, TelephonyAccountsGetErrors, TelephonyAccountsGetResults, TelephonyAccountsListErrors, TelephonyAccountsListResults, TelephonyAccountsProvisionErrors, TelephonyAccountsProvisionResults, TelephonyAccountsRemoteNumbersErrors, TelephonyAccountsRemoteNumbersResults, TelephonyAccountsUpdateErrors, TelephonyAccountsUpdateResults, TelephonyPhoneNumbersAssignErrors, TelephonyPhoneNumbersAssignResults, TelephonyPhoneNumbersGetErrors, TelephonyPhoneNumbersGetResults, TelephonyPhoneNumbersImportErrors, TelephonyPhoneNumbersImportResults, TelephonyPhoneNumbersListErrors, TelephonyPhoneNumbersListResults, TelephonyPhoneNumbersProvisionErrors, TelephonyPhoneNumbersProvisionResults, TelephonyPhoneNumbersUnassignErrors, TelephonyPhoneNumbersUnassignResults, TelephonyPhoneNumbersUpdateErrors, TelephonyPhoneNumbersUpdateResults, TelephonyProvidersListErrors, TelephonyProvidersListResults, TextMessageRequest, TokenRequest, ToolsCreateErrors, ToolsCreateResults, ToolsDeleteErrors, ToolsDeleteResults, ToolsGetErrors, ToolsGetResults, ToolsListErrors, ToolsListResults, ToolsPublishErrors, ToolsPublishResults, ToolsRunErrors, ToolsRunResults, ToolsUpdateErrors, ToolsUpdateResults, ToolsValidateErrors, ToolsValidateResults, ToolsVersionsGetErrors, ToolsVersionsGetResults, ToolsVersionsRollbackErrors, ToolsVersionsRollbackResults, UpdateAgentRequest, WebhooksCreateErrors, WebhooksCreateResults, WebhooksDeleteErrors, WebhooksDeleteResults, WebhooksDeliveriesErrors, WebhooksDeliveriesResults, WebhooksEventTypesErrors, WebhooksEventTypesResults, WebhooksListErrors, WebhooksListResults, WebhooksRotateSecretErrors, WebhooksRotateSecretResults, WebhooksTestErrors, WebhooksTestResults, WebhooksUpdateErrors, WebhooksUpdateResults } from './types.gen.js';
5
+ import type { AddRecipientsRequest, AddVoiceRequest, AgentsCreateErrors, AgentsCreateResults, AgentsDeleteErrors, AgentsDeleteResults, AgentsGetErrors, AgentsGetResults, AgentsListErrors, AgentsListResults, AgentsPublishErrors, AgentsPublishResults, AgentsUpdateErrors, AgentsUpdateResults, AgentsValidateErrors, AgentsValidateResults, AgentsVersionsGetErrors, AgentsVersionsGetResults, AgentsVersionsRollbackErrors, AgentsVersionsRollbackResults, AssignPhoneNumberRequest, BackfillAnalysisRequest, BillingCreditsCheckoutErrors, BillingCreditsCheckoutResults, BillingCreditsGetErrors, BillingCreditsGetResults, BillingCreditsLedgerErrors, BillingCreditsLedgerResults, BuildKBRequest, CallsAnalysisBackfillErrors, CallsAnalysisBackfillResults, CallsAnalysisPreviewErrors, CallsAnalysisPreviewResults, CallsBatchesCancelErrors, CallsBatchesCancelResults, CallsBatchesCreateErrors, CallsBatchesCreateResults, CallsBatchesGetErrors, CallsBatchesGetResults, CallsBatchesListErrors, CallsBatchesListResults, CallsBatchesPauseErrors, CallsBatchesPauseResults, CallsBatchesRecipientsAddErrors, CallsBatchesRecipientsAddResults, CallsBatchesRecipientsListErrors, CallsBatchesRecipientsListResults, CallsBatchesResumeErrors, CallsBatchesResumeResults, CallsBatchesUpdateErrors, CallsBatchesUpdateResults, CallsDeleteErrors, CallsDeleteResults, CallsGetErrors, CallsGetResults, CallsListErrors, CallsListResults, CallsOutboundErrors, CallsOutboundResults, CallsRecordingDeleteErrors, CallsRecordingDeleteResults, CallsRecordingGetErrors, CallsRecordingGetResults, CallsScreenRecordingGetErrors, CallsScreenRecordingGetResults, CallsStatsErrors, CallsStatsResults, CallsTokenErrors, CallsTokenResults, CatalogAvatarsListErrors, CatalogAvatarsListResults, CatalogGetErrors, CatalogGetResults, CatalogVoicesElevenlabsAddErrors, CatalogVoicesElevenlabsAddResults, CatalogVoicesElevenlabsSettingsErrors, CatalogVoicesElevenlabsSettingsResults, CatalogVoicesListErrors, CatalogVoicesListResults, ConversationsCreateErrors, ConversationsCreateResults, ConversationsEventsErrors, ConversationsEventsResult, ConversationsEventsResults, ConversationsGetErrors, ConversationsGetResults, ConversationsItemsListErrors, ConversationsItemsListResults, ConversationsListErrors, ConversationsListResults, ConversationsMessagesCreateErrors, ConversationsMessagesCreateResults, ConversationsSessionsListErrors, ConversationsSessionsListResults, ConversationsSnapshotErrors, ConversationsSnapshotResults, ConversationsUpdateErrors, ConversationsUpdateResults, CopilotAgentsSendErrors, CopilotAgentsSendResults, CopilotAgentsStreamErrors, CopilotAgentsStreamResult, CopilotAgentsStreamResults, CopilotKnowledgeSendErrors, CopilotKnowledgeSendResults, CopilotKnowledgeStreamErrors, CopilotKnowledgeStreamResult, CopilotKnowledgeStreamResults, CopilotTasksSendErrors, CopilotTasksSendResults, CopilotTasksStreamErrors, CopilotTasksStreamResult, CopilotTasksStreamResults, CopilotToolsSendErrors, CopilotToolsSendResults, CopilotToolsStreamErrors, CopilotToolsStreamResult, CopilotToolsStreamResults, CreateAgentRequest, CreateCallBatchRequest, CreateEmailBatchRequest, CreateEmailSendRequest, CreateIntegrationRequest, CreateIntegrationTriggerRequest, CreateKBRequest, CreateSecretRequest, CreateTaskRequest, CreateTelephonyAccountRequest, CreateTextConversationRequest, CreateToolRequest, CreateWebhookRequest, CreditCheckoutRequest, EmailBatchesCancelErrors, EmailBatchesCancelResults, EmailBatchesCreateErrors, EmailBatchesCreateResults, EmailBatchesGetErrors, EmailBatchesGetResults, EmailBatchesListErrors, EmailBatchesListResults, EmailBatchesPauseErrors, EmailBatchesPauseResults, EmailBatchesRecipientsListErrors, EmailBatchesRecipientsListResults, EmailBatchesRecipientsRedraftErrors, EmailBatchesRecipientsRedraftResults, EmailBatchesRecipientsRestoreErrors, EmailBatchesRecipientsRestoreResults, EmailBatchesRecipientsSkipErrors, EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsUpdateErrors, EmailBatchesRecipientsUpdateResults, EmailBatchesResumeErrors, EmailBatchesResumeResults, EmailBatchesSendsCancelErrors, EmailBatchesSendsCancelResults, EmailBatchesSendsCreateErrors, EmailBatchesSendsCreateResults, EmailBatchesSendsGetErrors, EmailBatchesSendsGetResults, EmailBatchesSendsListErrors, EmailBatchesSendsListResults, EmailBatchesSendsPauseErrors, EmailBatchesSendsPauseResults, EmailBatchesSendsResumeErrors, EmailBatchesSendsResumeResults, EmailBatchesSendsUpdateErrors, EmailBatchesSendsUpdateResults, EmailBatchesUpdateErrors, EmailBatchesUpdateResults, EmailSendersListErrors, EmailSendersListResults, HealthErrors, HealthResults, ImportPhoneNumbersRequest, IntegrationsCatalogErrors, IntegrationsCatalogResults, IntegrationsCreateErrors, IntegrationsCreateResults, IntegrationsDeleteErrors, IntegrationsDeleteResults, IntegrationsGetErrors, IntegrationsGetResults, IntegrationsListErrors, IntegrationsListResults, IntegrationsMcpToolsListErrors, IntegrationsMcpToolsListResults, IntegrationsTriggersCreateErrors, IntegrationsTriggersCreateResults, IntegrationsTriggersDeleteErrors, IntegrationsTriggersDeleteResults, IntegrationsTriggersListErrors, IntegrationsTriggersListResults, IntegrationsTriggersUpdateErrors, IntegrationsTriggersUpdateResults, IntegrationsUpdateErrors, IntegrationsUpdateResults, KnowledgeBuildErrors, KnowledgeBuildResults, KnowledgeCreateErrors, KnowledgeCreateResults, KnowledgeDeleteErrors, KnowledgeDeleteResults, KnowledgeEventsErrors, KnowledgeEventsResult, KnowledgeEventsResults, KnowledgeGetErrors, KnowledgeGetResults, KnowledgeListErrors, KnowledgeListResults, KnowledgeNodesDeleteErrors, KnowledgeNodesDeleteResults, KnowledgeNodesGetErrors, KnowledgeNodesGetResults, KnowledgeNodesUpdateErrors, KnowledgeNodesUpdateResults, KnowledgePagesListErrors, KnowledgePagesListResults, KnowledgePromptErrors, KnowledgePromptResults, KnowledgeRegenerateTocErrors, KnowledgeRegenerateTocResults, ObservabilityGetErrors, ObservabilityGetResults, OutboundCallRequest, PatchCallBatchRequest, PatchConversationRequest, PatchEmailBatchRequest, PatchEmailRecipientRequest, PatchEmailSendRequest, PatchIntegrationRequest, PatchIntegrationTriggerRequest, PatchNodeRequest, PatchPhoneNumberRequest, PatchTaskRequest, PatchTelephonyAccountRequest, PatchToolRequest, PatchWebhookRequest, PreviewAnalysisRequest, ProviderKeysDeleteErrors, ProviderKeysDeleteResults, ProviderKeysListErrors, ProviderKeysListResults, ProviderKeysSetErrors, ProviderKeysSetResults, PublishToolRequest, RedraftRequest, RunTaskRequest, RunToolRequest, SchemasFunctionsGetErrors, SchemasFunctionsGetResults, SchemasGetErrors, SchemasGetResults, SecretsCreateErrors, SecretsCreateResults, SecretsDeleteErrors, SecretsDeleteResults, SecretsListErrors, SecretsListResults, SelectRecipientsRequest, SendMessageRequest, SetProviderKeyRequest, TasksCreateErrors, TasksCreateResults, TasksDeleteErrors, TasksDeleteResults, TasksGetErrors, TasksGetResults, TasksListErrors, TasksListResults, TasksPublishErrors, TasksPublishResults, TasksRunsCreateErrors, TasksRunsCreateResults, TasksRunsGetErrors, TasksRunsGetResults, TasksRunsListErrors, TasksRunsListResults, TasksUpdateErrors, TasksUpdateResults, TasksValidateErrors, TasksValidateResults, TasksVersionsGetErrors, TasksVersionsGetResults, TasksVersionsRollbackErrors, TasksVersionsRollbackResults, TelephonyAccountsCreateErrors, TelephonyAccountsCreateResults, TelephonyAccountsDeleteErrors, TelephonyAccountsDeleteResults, TelephonyAccountsGetErrors, TelephonyAccountsGetResults, TelephonyAccountsListErrors, TelephonyAccountsListResults, TelephonyAccountsProvisionErrors, TelephonyAccountsProvisionResults, TelephonyAccountsRemoteNumbersErrors, TelephonyAccountsRemoteNumbersResults, TelephonyAccountsUpdateErrors, TelephonyAccountsUpdateResults, TelephonyPhoneNumbersAssignErrors, TelephonyPhoneNumbersAssignResults, TelephonyPhoneNumbersGetErrors, TelephonyPhoneNumbersGetResults, TelephonyPhoneNumbersImportErrors, TelephonyPhoneNumbersImportResults, TelephonyPhoneNumbersListErrors, TelephonyPhoneNumbersListResults, TelephonyPhoneNumbersProvisionErrors, TelephonyPhoneNumbersProvisionResults, TelephonyPhoneNumbersUnassignErrors, TelephonyPhoneNumbersUnassignResults, TelephonyPhoneNumbersUpdateErrors, TelephonyPhoneNumbersUpdateResults, TelephonyProvidersListErrors, TelephonyProvidersListResults, TextMessageRequest, TokenRequest, ToolsCreateErrors, ToolsCreateResults, ToolsDeleteErrors, ToolsDeleteResults, ToolsGetErrors, ToolsGetResults, ToolsListErrors, ToolsListResults, ToolsPublishErrors, ToolsPublishResults, ToolsRunErrors, ToolsRunResults, ToolsUpdateErrors, ToolsUpdateResults, ToolsValidateErrors, ToolsValidateResults, ToolsVersionsGetErrors, ToolsVersionsGetResults, ToolsVersionsRollbackErrors, ToolsVersionsRollbackResults, UpdateAgentRequest, WebhooksCreateErrors, WebhooksCreateResults, WebhooksDeleteErrors, WebhooksDeleteResults, WebhooksDeliveriesErrors, WebhooksDeliveriesResults, WebhooksEventTypesErrors, WebhooksEventTypesResults, WebhooksListErrors, WebhooksListResults, WebhooksRotateSecretErrors, WebhooksRotateSecretResults, WebhooksTestErrors, WebhooksTestResults, WebhooksUpdateErrors, WebhooksUpdateResults } from './types.gen.js';
6
6
 
7
7
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
8
8
  /**
@@ -2054,6 +2054,41 @@ export class Recipients2 extends HeyApiClient {
2054
2054
  });
2055
2055
  }
2056
2056
 
2057
+ /**
2058
+ * Redraft Email Batch Recipients
2059
+ *
2060
+ * Draft rows again from scratch. **Each one runs the task and is billed again.**
2061
+ *
2062
+ * `selection` is `failed` (drafting failed), `stale_version` (drafted by an
2063
+ * older published version of the task), `not_sent`, or `all` — which names
2064
+ * every row it refuses. Rows already sent or queued are never redrafted.
2065
+ *
2066
+ * This revives a batch that had finished drafting, and a person's edited cells
2067
+ * survive unless you pass `clear_overrides`.
2068
+ */
2069
+ public redraft<ThrowOnError extends boolean = false>(parameters: {
2070
+ batch_id: string;
2071
+ redraftRequest: RedraftRequest;
2072
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesRecipientsRedraftResults, EmailBatchesRecipientsRedraftErrors, ThrowOnError, 'data'> {
2073
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'redraftRequest', map: 'body' }] }]);
2074
+ return (options?.client ?? this.client).post<EmailBatchesRecipientsRedraftResults, EmailBatchesRecipientsRedraftErrors, ThrowOnError, 'data'>({
2075
+ responseStyle: 'data',
2076
+ security: [{ scheme: 'bearer', type: 'http' }, {
2077
+ in: 'cookie',
2078
+ name: 'talqing_session',
2079
+ type: 'apiKey'
2080
+ }],
2081
+ url: '/v1/email/batches/{batch_id}/redraft',
2082
+ ...options,
2083
+ ...params,
2084
+ headers: {
2085
+ 'Content-Type': 'application/json',
2086
+ ...options?.headers,
2087
+ ...params.headers
2088
+ }
2089
+ });
2090
+ }
2091
+
2057
2092
  /**
2058
2093
  * Restore Email Batch Recipients
2059
2094
  *
@@ -2083,29 +2118,27 @@ export class Recipients2 extends HeyApiClient {
2083
2118
  }
2084
2119
 
2085
2120
  /**
2086
- * Retry Email Batch Recipients
2121
+ * Skip Email Batch Recipients
2087
2122
  *
2088
- * Draft rows whose first attempt failed, again.
2123
+ * Take drafted rows out of consideration. Reversible with `restore`.
2089
2124
  *
2090
- * `selection: "all_eligible"` means every row whose drafting failed. This is
2091
- * the one action that revives a batch that has already finished drafting: it
2092
- * goes back to `drafting` and picks up exactly the rows you retried the
2093
- * alternative would be telling you that twelve failed rows are unrecoverable
2094
- * because the other 4 988 finished first.
2125
+ * Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
2126
+ * every row that has a draft. The reversible verbs keep that shorthand while
2127
+ * `send` does not, because the rule is about irreversibility rather than bulk.
2095
2128
  */
2096
- public retry<ThrowOnError extends boolean = false>(parameters: {
2129
+ public skip<ThrowOnError extends boolean = false>(parameters: {
2097
2130
  batch_id: string;
2098
2131
  selectRecipientsRequest: SelectRecipientsRequest;
2099
- }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesRecipientsRetryResults, EmailBatchesRecipientsRetryErrors, ThrowOnError, 'data'> {
2132
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsSkipErrors, ThrowOnError, 'data'> {
2100
2133
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
2101
- return (options?.client ?? this.client).post<EmailBatchesRecipientsRetryResults, EmailBatchesRecipientsRetryErrors, ThrowOnError, 'data'>({
2134
+ return (options?.client ?? this.client).post<EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsSkipErrors, ThrowOnError, 'data'>({
2102
2135
  responseStyle: 'data',
2103
2136
  security: [{ scheme: 'bearer', type: 'http' }, {
2104
2137
  in: 'cookie',
2105
2138
  name: 'talqing_session',
2106
2139
  type: 'apiKey'
2107
2140
  }],
2108
- url: '/v1/email/batches/{batch_id}/retry',
2141
+ url: '/v1/email/batches/{batch_id}/skip',
2109
2142
  ...options,
2110
2143
  ...params,
2111
2144
  headers: {
@@ -2115,33 +2148,64 @@ export class Recipients2 extends HeyApiClient {
2115
2148
  }
2116
2149
  });
2117
2150
  }
2151
+ }
2152
+
2153
+ export class Sends extends HeyApiClient {
2154
+ /**
2155
+ * List Email Sends
2156
+ *
2157
+ * Every send on this batch, newest first, with its counts and its schedule.
2158
+ */
2159
+ public list<ThrowOnError extends boolean = false>(parameters: {
2160
+ batch_id: string;
2161
+ limit?: number;
2162
+ offset?: number;
2163
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsListResults, EmailBatchesSendsListErrors, ThrowOnError, 'data'> {
2164
+ const params = buildClientParams([parameters], [{ args: [
2165
+ { in: 'path', key: 'batch_id' },
2166
+ { in: 'query', key: 'limit' },
2167
+ { in: 'query', key: 'offset' }
2168
+ ] }]);
2169
+ return (options?.client ?? this.client).get<EmailBatchesSendsListResults, EmailBatchesSendsListErrors, ThrowOnError, 'data'>({
2170
+ responseStyle: 'data',
2171
+ security: [{ scheme: 'bearer', type: 'http' }, {
2172
+ in: 'cookie',
2173
+ name: 'talqing_session',
2174
+ type: 'apiKey'
2175
+ }],
2176
+ url: '/v1/email/batches/{batch_id}/sends',
2177
+ ...options,
2178
+ ...params
2179
+ });
2180
+ }
2118
2181
 
2119
2182
  /**
2120
- * Send Email Batch Recipients
2183
+ * Create Email Send
2121
2184
  *
2122
- * Send the rows you name. **This mails real people and cannot be undone.**
2185
+ * Send these rows. **This mails real people and cannot be undone.**
2123
2186
  *
2124
- * At most 50 rows per call, named one by one — there is no "select all" and no
2125
- * bulk form of this. A row whose `to`, `subject` or `body` does not resolve
2126
- * comes back in `rejected` and stays a draft; fix it with
2127
- * `patch_email_batch_recipient` and try again.
2187
+ * Name `recipient_ids`, or pass `selection: "all_drafts"` for every reviewed
2188
+ * draft. A row whose `to`, `subject` or `body` does not resolve comes back in
2189
+ * `rejected` and stays a draft; fix it with `patch_email_batch_recipient`.
2128
2190
  *
2129
- * `from_email`, `from_name` and `reply_to` override the sender for this call
2130
- * only, and must be on a domain verified on the same Resend account.
2191
+ * The send is a row you can steer: `start_at` schedules it, `window` holds it
2192
+ * to business hours, `send_gap_seconds` paces it and `send_daily_cap` bounds
2193
+ * how many leave per day. Everything omitted comes from the batch. Cancel it
2194
+ * and every unsent row comes back as a draft.
2131
2195
  */
2132
- public send<ThrowOnError extends boolean = false>(parameters: {
2196
+ public create<ThrowOnError extends boolean = false>(parameters: {
2133
2197
  batch_id: string;
2134
- sendEmailBatchRequest: SendEmailBatchRequest;
2135
- }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesRecipientsSendResults, EmailBatchesRecipientsSendErrors, ThrowOnError, 'data'> {
2136
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendEmailBatchRequest', map: 'body' }] }]);
2137
- return (options?.client ?? this.client).post<EmailBatchesRecipientsSendResults, EmailBatchesRecipientsSendErrors, ThrowOnError, 'data'>({
2198
+ createEmailSendRequest: CreateEmailSendRequest;
2199
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsCreateResults, EmailBatchesSendsCreateErrors, ThrowOnError, 'data'> {
2200
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'createEmailSendRequest', map: 'body' }] }]);
2201
+ return (options?.client ?? this.client).post<EmailBatchesSendsCreateResults, EmailBatchesSendsCreateErrors, ThrowOnError, 'data'>({
2138
2202
  responseStyle: 'data',
2139
2203
  security: [{ scheme: 'bearer', type: 'http' }, {
2140
2204
  in: 'cookie',
2141
2205
  name: 'talqing_session',
2142
2206
  type: 'apiKey'
2143
2207
  }],
2144
- url: '/v1/email/batches/{batch_id}/send',
2208
+ url: '/v1/email/batches/{batch_id}/sends',
2145
2209
  ...options,
2146
2210
  ...params,
2147
2211
  headers: {
@@ -2153,27 +2217,57 @@ export class Recipients2 extends HeyApiClient {
2153
2217
  }
2154
2218
 
2155
2219
  /**
2156
- * Skip Email Batch Recipients
2220
+ * Get Email Send
2157
2221
  *
2158
- * Take drafted rows out of consideration. Reversible with `restore`.
2222
+ * One send: where its rows are, and when it next does something.
2159
2223
  *
2160
- * Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
2161
- * every row that has a draft. The reversible verbs keep that shorthand while
2162
- * `send` does not, because the rule is about irreversibility rather than bulk.
2224
+ * `next_send_at` covers all three reasons a send waits — a start time, a closed
2225
+ * window, and a daily cap already spent.
2163
2226
  */
2164
- public skip<ThrowOnError extends boolean = false>(parameters: {
2227
+ public get<ThrowOnError extends boolean = false>(parameters: {
2165
2228
  batch_id: string;
2166
- selectRecipientsRequest: SelectRecipientsRequest;
2167
- }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsSkipErrors, ThrowOnError, 'data'> {
2168
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
2169
- return (options?.client ?? this.client).post<EmailBatchesRecipientsSkipResults, EmailBatchesRecipientsSkipErrors, ThrowOnError, 'data'>({
2229
+ send_id: string;
2230
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsGetResults, EmailBatchesSendsGetErrors, ThrowOnError, 'data'> {
2231
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2232
+ return (options?.client ?? this.client).get<EmailBatchesSendsGetResults, EmailBatchesSendsGetErrors, ThrowOnError, 'data'>({
2170
2233
  responseStyle: 'data',
2171
2234
  security: [{ scheme: 'bearer', type: 'http' }, {
2172
2235
  in: 'cookie',
2173
2236
  name: 'talqing_session',
2174
2237
  type: 'apiKey'
2175
2238
  }],
2176
- url: '/v1/email/batches/{batch_id}/skip',
2239
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
2240
+ ...options,
2241
+ ...params
2242
+ });
2243
+ }
2244
+
2245
+ /**
2246
+ * Patch Email Send
2247
+ *
2248
+ * Re-steer one send: its pace, its hours, its daily cap, its start time.
2249
+ *
2250
+ * Never its sender, and never which rows it holds — to change that, cancel it
2251
+ * and create another. `start_at` moves only before the send has begun.
2252
+ */
2253
+ public update<ThrowOnError extends boolean = false>(parameters: {
2254
+ batch_id: string;
2255
+ send_id: string;
2256
+ patchEmailSendRequest: PatchEmailSendRequest;
2257
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsUpdateResults, EmailBatchesSendsUpdateErrors, ThrowOnError, 'data'> {
2258
+ const params = buildClientParams([parameters], [{ args: [
2259
+ { in: 'path', key: 'batch_id' },
2260
+ { in: 'path', key: 'send_id' },
2261
+ { key: 'patchEmailSendRequest', map: 'body' }
2262
+ ] }]);
2263
+ return (options?.client ?? this.client).patch<EmailBatchesSendsUpdateResults, EmailBatchesSendsUpdateErrors, ThrowOnError, 'data'>({
2264
+ responseStyle: 'data',
2265
+ security: [{ scheme: 'bearer', type: 'http' }, {
2266
+ in: 'cookie',
2267
+ name: 'talqing_session',
2268
+ type: 'apiKey'
2269
+ }],
2270
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
2177
2271
  ...options,
2178
2272
  ...params,
2179
2273
  headers: {
@@ -2183,6 +2277,80 @@ export class Recipients2 extends HeyApiClient {
2183
2277
  }
2184
2278
  });
2185
2279
  }
2280
+
2281
+ /**
2282
+ * Cancel Email Send
2283
+ *
2284
+ * Stop this send, and give every row it has not sent back as a draft.
2285
+ *
2286
+ * Not a destructive action: the drafts come back exactly as they were, ready
2287
+ * for another send. It is also the only way to change what a scheduled send
2288
+ * contains — a send's rows are fixed once it exists.
2289
+ */
2290
+ public cancel<ThrowOnError extends boolean = false>(parameters: {
2291
+ batch_id: string;
2292
+ send_id: string;
2293
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsCancelResults, EmailBatchesSendsCancelErrors, ThrowOnError, 'data'> {
2294
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2295
+ return (options?.client ?? this.client).post<EmailBatchesSendsCancelResults, EmailBatchesSendsCancelErrors, ThrowOnError, 'data'>({
2296
+ responseStyle: 'data',
2297
+ security: [{ scheme: 'bearer', type: 'http' }, {
2298
+ in: 'cookie',
2299
+ name: 'talqing_session',
2300
+ type: 'apiKey'
2301
+ }],
2302
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/cancel',
2303
+ ...options,
2304
+ ...params
2305
+ });
2306
+ }
2307
+
2308
+ /**
2309
+ * Pause Email Send
2310
+ *
2311
+ * Stop sending. It takes hold on the next email, and nothing is lost —
2312
+ * the rows stay queued for whenever you resume.
2313
+ */
2314
+ public pause<ThrowOnError extends boolean = false>(parameters: {
2315
+ batch_id: string;
2316
+ send_id: string;
2317
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsPauseResults, EmailBatchesSendsPauseErrors, ThrowOnError, 'data'> {
2318
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2319
+ return (options?.client ?? this.client).post<EmailBatchesSendsPauseResults, EmailBatchesSendsPauseErrors, ThrowOnError, 'data'>({
2320
+ responseStyle: 'data',
2321
+ security: [{ scheme: 'bearer', type: 'http' }, {
2322
+ in: 'cookie',
2323
+ name: 'talqing_session',
2324
+ type: 'apiKey'
2325
+ }],
2326
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/pause',
2327
+ ...options,
2328
+ ...params
2329
+ });
2330
+ }
2331
+
2332
+ /**
2333
+ * Resume Email Send
2334
+ *
2335
+ * Undo a pause and carry on from where it stopped.
2336
+ */
2337
+ public resume<ThrowOnError extends boolean = false>(parameters: {
2338
+ batch_id: string;
2339
+ send_id: string;
2340
+ }, options?: Options<never, ThrowOnError>): RequestResult<EmailBatchesSendsResumeResults, EmailBatchesSendsResumeErrors, ThrowOnError, 'data'> {
2341
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2342
+ return (options?.client ?? this.client).post<EmailBatchesSendsResumeResults, EmailBatchesSendsResumeErrors, ThrowOnError, 'data'>({
2343
+ responseStyle: 'data',
2344
+ security: [{ scheme: 'bearer', type: 'http' }, {
2345
+ in: 'cookie',
2346
+ name: 'talqing_session',
2347
+ type: 'apiKey'
2348
+ }],
2349
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/resume',
2350
+ ...options,
2351
+ ...params
2352
+ });
2353
+ }
2186
2354
  }
2187
2355
 
2188
2356
  export class Batches2 extends HeyApiClient {
@@ -2230,13 +2398,16 @@ export class Batches2 extends HeyApiClient {
2230
2398
  * scraped contacts — and this runs on your account under your agreement.
2231
2399
  *
2232
2400
  * **Nothing is sent that a person has not selected.** Creating a batch only
2233
- * starts drafting; sending is a separate call over at most 50 named rows.
2401
+ * starts drafting; sending is a separate call that creates a send you can
2402
+ * schedule, pace, pause and cancel.
2234
2403
  *
2235
- * **Every row runs your task as it stands right now** — a task has no
2236
- * versions, so editing it mid-batch changes every row drafted after that.
2404
+ * **Every row runs the task's CURRENT published version**, re-read every pass,
2405
+ * so publishing a better prompt mid-batch changes every row drafted after it.
2237
2406
  *
2238
2407
  * `field_map` points `to`, `subject` and `body` at a column of your list or at
2239
- * a field the task produces. An invalid batch is a 400 listing every problem.
2408
+ * a field the task produces. `window` is when email may LEAVE, inherited by
2409
+ * every send; drafting is not restricted by hours. An invalid batch is a 400
2410
+ * listing every problem.
2240
2411
  *
2241
2412
  * There is no spend cap: every row runs the task and is billed, so a 5 000-row
2242
2413
  * batch doing research costs 5 000 task runs whether or not anything is sent.
@@ -2266,9 +2437,10 @@ export class Batches2 extends HeyApiClient {
2266
2437
  /**
2267
2438
  * Get Email Batch
2268
2439
  *
2269
- * One batch: its policy, its per-status counts, what drafting has cost so
2270
- * far, and — while it is waiting on a start time or a closed window —
2271
- * `next_draft_at`.
2440
+ * One batch: its policy, its per-status counts and what drafting has cost.
2441
+ *
2442
+ * `drafted_versions` says which published version of the task wrote how many
2443
+ * rows, and `sent_today` how much of `send_daily_cap` is left today.
2272
2444
  */
2273
2445
  public get<ThrowOnError extends boolean = false>(parameters: {
2274
2446
  batch_id: string;
@@ -2292,10 +2464,12 @@ export class Batches2 extends HeyApiClient {
2292
2464
  *
2293
2465
  * Edit a batch's policy. The next drafting pass reads the new row.
2294
2466
  *
2295
- * Pacing and the calling window are editable at any time. The sender, the body
2296
- * format and the field map freeze once the batch has sent anything changing
2297
- * them then would make the rows already delivered no longer describe what they
2298
- * were sent as. `start_at` moves only while the batch is still scheduled.
2467
+ * Pacing, the window and the daily cap are editable at any time; the sending
2468
+ * half is the DEFAULT for the next send, and a send already created carries its
2469
+ * own copy. The sender, the body format and the field map freeze once the batch
2470
+ * has sent anything changing them then would make the rows already delivered
2471
+ * no longer describe what they were sent as. `start_at` moves only while the
2472
+ * batch is still scheduled.
2299
2473
  */
2300
2474
  public update<ThrowOnError extends boolean = false>(parameters: {
2301
2475
  batch_id: string;
@@ -2323,12 +2497,12 @@ export class Batches2 extends HeyApiClient {
2323
2497
  /**
2324
2498
  * Cancel Email Batch
2325
2499
  *
2326
- * Stop drafting for good. This is the only terminal action a batch cannot
2327
- * be deleted, because it is the record of what was sent to whom.
2500
+ * Stop drafting for good. A batch cannot be deleted, because it is the
2501
+ * record of what was sent to whom.
2328
2502
  *
2329
- * Rows already drafted are **not** touched: cancelling stops drafting, and
2330
- * drafts already produced are still worth reviewing and sending. Rows never
2331
- * reached report as `canceled`.
2503
+ * Rows already drafted are **not** touched and neither is any send: cancelling
2504
+ * stops drafting, and drafts already produced are still worth reviewing and
2505
+ * sending. Rows never reached report as `canceled`.
2332
2506
  */
2333
2507
  public cancel<ThrowOnError extends boolean = false>(parameters: {
2334
2508
  batch_id: string;
@@ -2398,6 +2572,11 @@ export class Batches2 extends HeyApiClient {
2398
2572
  get recipients(): Recipients2 {
2399
2573
  return this._recipients ??= new Recipients2({ client: this.client });
2400
2574
  }
2575
+
2576
+ private _sends?: Sends;
2577
+ get sends(): Sends {
2578
+ return this._sends ??= new Sends({ client: this.client });
2579
+ }
2401
2580
  }
2402
2581
 
2403
2582
  export class Senders extends HeyApiClient {
@@ -2565,8 +2744,10 @@ export class Triggers extends HeyApiClient {
2565
2744
  * Patch Integration Trigger
2566
2745
  *
2567
2746
  * Update a trigger: reassign the agent, change reply mode, enable or
2568
- * disable it. Omitted fields are left unchanged. The same checks as creation
2569
- * run when enabling.
2747
+ * disable it.
2748
+ *
2749
+ * Omitted fields are left unchanged, and enabling one runs the same checks
2750
+ * creating it did.
2570
2751
  */
2571
2752
  public update<ThrowOnError extends boolean = false>(parameters: {
2572
2753
  integration_id: string;
@@ -3188,6 +3369,35 @@ export class Observability extends HeyApiClient {
3188
3369
  }
3189
3370
  }
3190
3371
 
3372
+ export class Functions extends HeyApiClient {
3373
+ /**
3374
+ * Describe Function
3375
+ *
3376
+ * The full argument schema of one function, by name.
3377
+ *
3378
+ * Every function's arguments are fetched here rather than shown up front, so
3379
+ * call this before the first time you use one. Two exceptions, which carry
3380
+ * their own shape because they would otherwise be uncallable: this function
3381
+ * and `describe_schema`.
3382
+ */
3383
+ public get<ThrowOnError extends boolean = false>(parameters: {
3384
+ name: string;
3385
+ }, options?: Options<never, ThrowOnError>): RequestResult<SchemasFunctionsGetResults, SchemasFunctionsGetErrors, ThrowOnError, 'data'> {
3386
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }] }]);
3387
+ return (options?.client ?? this.client).get<SchemasFunctionsGetResults, SchemasFunctionsGetErrors, ThrowOnError, 'data'>({
3388
+ responseStyle: 'data',
3389
+ security: [{ scheme: 'bearer', type: 'http' }, {
3390
+ in: 'cookie',
3391
+ name: 'talqing_session',
3392
+ type: 'apiKey'
3393
+ }],
3394
+ url: '/v1/schemas/functions/{name}',
3395
+ ...options,
3396
+ ...params
3397
+ });
3398
+ }
3399
+ }
3400
+
3191
3401
  export class Schemas extends HeyApiClient {
3192
3402
  /**
3193
3403
  * Describe Schema
@@ -3221,6 +3431,11 @@ export class Schemas extends HeyApiClient {
3221
3431
  ...params
3222
3432
  });
3223
3433
  }
3434
+
3435
+ private _functions?: Functions;
3436
+ get functions(): Functions {
3437
+ return this._functions ??= new Functions({ client: this.client });
3438
+ }
3224
3439
  }
3225
3440
 
3226
3441
  export class Secrets extends HeyApiClient {
@@ -3310,8 +3525,8 @@ export class Runs extends HeyApiClient {
3310
3525
  *
3311
3526
  * This task's runs, newest first, each with its output, trace and cost.
3312
3527
  *
3313
- * A run records the task's *name* and nothing else about the definition it ran
3314
- * under, so two runs either side of an edit are indistinguishable here.
3528
+ * `task_version` says which published definition each one ran, and is null for
3529
+ * a run of the draft.
3315
3530
  */
3316
3531
  public list<ThrowOnError extends boolean = false>(parameters: {
3317
3532
  task_id: string;
@@ -3345,10 +3560,12 @@ export class Runs extends HeyApiClient {
3345
3560
  * the MCP servers spend your credits, and the model spends your tokens. A task
3346
3561
  * that books a slot, charges a card or sends a message will do so.
3347
3562
  *
3348
- * `vars` must match what the task declares an unknown name is refused rather
3349
- * than dropped. The response is the whole run: the structured `output`, a
3350
- * `trace` of every tool call, the steps used and what the tokens cost. On
3351
- * failure `error.type` says whose problem it is. Secrets are redacted.
3563
+ * Runs the published version unless `version` names another one, or `"draft"`
3564
+ * to run the unpublished config. `vars` must match what that version declares
3565
+ * an unknown name is refused rather than dropped. The response is the whole
3566
+ * run: the structured `output`, a `trace` of every tool call, the steps used
3567
+ * and what the tokens cost. On failure `error.type` says whose problem it is.
3568
+ * Secrets are redacted.
3352
3569
  */
3353
3570
  public create<ThrowOnError extends boolean = false>(parameters: {
3354
3571
  task_id: string;
@@ -3402,6 +3619,63 @@ export class Runs extends HeyApiClient {
3402
3619
  }
3403
3620
  }
3404
3621
 
3622
+ export class Versions2 extends HeyApiClient {
3623
+ /**
3624
+ * Get Task Version
3625
+ *
3626
+ * Fetch what one published version of a task actually contains.
3627
+ *
3628
+ * `get_task` lists the versions and when each was published; this returns the
3629
+ * frozen definition itself — prompt, model, output fields and the tool
3630
+ * versions it pinned, exactly as they were at that publish.
3631
+ */
3632
+ public get<ThrowOnError extends boolean = false>(parameters: {
3633
+ task_id: string;
3634
+ version: number;
3635
+ }, options?: Options<never, ThrowOnError>): RequestResult<TasksVersionsGetResults, TasksVersionsGetErrors, ThrowOnError, 'data'> {
3636
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3637
+ return (options?.client ?? this.client).get<TasksVersionsGetResults, TasksVersionsGetErrors, ThrowOnError, 'data'>({
3638
+ responseStyle: 'data',
3639
+ security: [{ scheme: 'bearer', type: 'http' }, {
3640
+ in: 'cookie',
3641
+ name: 'talqing_session',
3642
+ type: 'apiKey'
3643
+ }],
3644
+ url: '/v1/tasks/{task_id}/versions/{version}',
3645
+ ...options,
3646
+ ...params
3647
+ });
3648
+ }
3649
+
3650
+ /**
3651
+ * Rollback Task Version
3652
+ *
3653
+ * Put an earlier published version of a task back into production.
3654
+ *
3655
+ * That version becomes live **immediately** and **replaces the current draft**,
3656
+ * so any unpublished edits are lost. No new version is created. The restored
3657
+ * draft tracks each tool's latest published version, not the ones this version
3658
+ * pinned.
3659
+ */
3660
+ public rollback<ThrowOnError extends boolean = false>(parameters: {
3661
+ task_id: string;
3662
+ version: number;
3663
+ }, options?: Options<never, ThrowOnError>): RequestResult<TasksVersionsRollbackResults, TasksVersionsRollbackErrors, ThrowOnError, 'data'> {
3664
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3665
+ return (options?.client ?? this.client).post<TasksVersionsRollbackResults, TasksVersionsRollbackErrors, ThrowOnError, 'data'>({
3666
+ responseStyle: 'data',
3667
+ security: [{ scheme: 'bearer', type: 'http' }, {
3668
+ in: 'cookie',
3669
+ name: 'talqing_session',
3670
+ type: 'apiKey'
3671
+ }],
3672
+ url: '/v1/tasks/{task_id}/versions/{version}/rollback',
3673
+ ...options,
3674
+ ...params
3675
+ });
3676
+ }
3677
+ }
3678
+
3405
3679
  export class Tasks2 extends HeyApiClient {
3406
3680
  /**
3407
3681
  * List Tasks
@@ -3410,9 +3684,8 @@ export class Tasks2 extends HeyApiClient {
3410
3684
  *
3411
3685
  * A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
3412
3686
  * servers, the variables it takes as input, and the typed result it must
3413
- * produce. `last_run` says how the most recent run of each one went, so a
3414
- * task whose prompt stopped calling `submit_result` is visible here rather
3415
- * than only in its own history.
3687
+ * produce. Each item carries the full draft config, the published version
3688
+ * number (null while it has never been published), and `last_run`.
3416
3689
  */
3417
3690
  public list<ThrowOnError extends boolean = false>(parameters?: {
3418
3691
  limit?: number;
@@ -3435,18 +3708,13 @@ export class Tasks2 extends HeyApiClient {
3435
3708
  /**
3436
3709
  * Create Task
3437
3710
  *
3438
- * Create an agent task.
3439
- *
3440
- * A task has no draft and no publish step: it is valid the moment it saves and
3441
- * callable immediately. An invalid config is a 400 listing every problem and
3442
- * nothing is stored.
3711
+ * Create an agent task: an agent nobody talks to, which takes named inputs
3712
+ * and returns a typed result.
3443
3713
  *
3444
3714
  * `output` is what makes this a task rather than a chat agent — declare the
3445
3715
  * fields the model must produce and it is given a `submit_result` tool built
3446
- * from them. `vars` are its inputs, read as `{{vars.name}}`.
3447
- *
3448
- * `warnings` reports the non-fatal problems. There is no publish screen to
3449
- * show them on, so read them here.
3716
+ * from them. `vars` are its inputs, read as `{{vars.name}}`. The task starts
3717
+ * unpublished; publish it before running it.
3450
3718
  */
3451
3719
  public create<ThrowOnError extends boolean = false>(parameters: {
3452
3720
  createTaskRequest: CreateTaskRequest;
@@ -3473,7 +3741,8 @@ export class Tasks2 extends HeyApiClient {
3473
3741
  /**
3474
3742
  * Delete Task
3475
3743
  *
3476
- * Delete a task. Its run history survives, still named after it.
3744
+ * Delete a task and its published versions. Its runs survive, still named
3745
+ * after it.
3477
3746
  */
3478
3747
  public delete<ThrowOnError extends boolean = false>(parameters: {
3479
3748
  task_id: string;
@@ -3495,7 +3764,7 @@ export class Tasks2 extends HeyApiClient {
3495
3764
  /**
3496
3765
  * Get Task
3497
3766
  *
3498
- * Fetch one task's config and how its last run went.
3767
+ * Fetch one task's draft config, published version, history and last run.
3499
3768
  */
3500
3769
  public get<ThrowOnError extends boolean = false>(parameters: {
3501
3770
  task_id: string;
@@ -3517,12 +3786,11 @@ export class Tasks2 extends HeyApiClient {
3517
3786
  /**
3518
3787
  * Update Task
3519
3788
  *
3520
- * Replace a task's config.
3789
+ * Replace the task's draft config with the one supplied.
3521
3790
  *
3522
- * The whole config is sent, so include every field you mean to keep, and it is
3523
- * validated exactly as `create_task` is. The edit takes effect on the next run
3524
- * a task has no versions, so there is no old wording to go back to and no
3525
- * record of which definition produced an earlier run.
3791
+ * The whole config is sent, so include every field you mean to keep. Writes
3792
+ * land on the draft only runs and email batches keep using the published
3793
+ * version until you publish again.
3526
3794
  */
3527
3795
  public update<ThrowOnError extends boolean = false>(parameters: {
3528
3796
  task_id: string;
@@ -3547,10 +3815,68 @@ export class Tasks2 extends HeyApiClient {
3547
3815
  });
3548
3816
  }
3549
3817
 
3818
+ /**
3819
+ * Publish Task
3820
+ *
3821
+ * Freeze the current draft as a new immutable version and make it live.
3822
+ *
3823
+ * Validation must pass. Publishing pins every attached tool to the tool
3824
+ * version live right now, so republishing a tool does not change this task
3825
+ * until the task is published again.
3826
+ */
3827
+ public publish<ThrowOnError extends boolean = false>(parameters: {
3828
+ task_id: string;
3829
+ }, options?: Options<never, ThrowOnError>): RequestResult<TasksPublishResults, TasksPublishErrors, ThrowOnError, 'data'> {
3830
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3831
+ return (options?.client ?? this.client).post<TasksPublishResults, TasksPublishErrors, ThrowOnError, 'data'>({
3832
+ responseStyle: 'data',
3833
+ security: [{ scheme: 'bearer', type: 'http' }, {
3834
+ in: 'cookie',
3835
+ name: 'talqing_session',
3836
+ type: 'apiKey'
3837
+ }],
3838
+ url: '/v1/tasks/{task_id}/publish',
3839
+ ...options,
3840
+ ...params
3841
+ });
3842
+ }
3843
+
3844
+ /**
3845
+ * Validate Task
3846
+ *
3847
+ * Run publish-grade validation on the draft without publishing it.
3848
+ *
3849
+ * Covers everything a draft write checks plus what publishing adds: a
3850
+ * workspace API key for the model, at least one output field, the operation
3851
+ * trees of the attached tools, and the email batches already drafting with
3852
+ * this task. Returns errors (blocking) and warnings (advisory).
3853
+ */
3854
+ public validate<ThrowOnError extends boolean = false>(parameters: {
3855
+ task_id: string;
3856
+ }, options?: Options<never, ThrowOnError>): RequestResult<TasksValidateResults, TasksValidateErrors, ThrowOnError, 'data'> {
3857
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3858
+ return (options?.client ?? this.client).post<TasksValidateResults, TasksValidateErrors, ThrowOnError, 'data'>({
3859
+ responseStyle: 'data',
3860
+ security: [{ scheme: 'bearer', type: 'http' }, {
3861
+ in: 'cookie',
3862
+ name: 'talqing_session',
3863
+ type: 'apiKey'
3864
+ }],
3865
+ url: '/v1/tasks/{task_id}/validate',
3866
+ ...options,
3867
+ ...params
3868
+ });
3869
+ }
3870
+
3550
3871
  private _runs?: Runs;
3551
3872
  get runs(): Runs {
3552
3873
  return this._runs ??= new Runs({ client: this.client });
3553
3874
  }
3875
+
3876
+ private _versions?: Versions2;
3877
+ get versions(): Versions2 {
3878
+ return this._versions ??= new Versions2({ client: this.client });
3879
+ }
3554
3880
  }
3555
3881
 
3556
3882
  export class Accounts extends HeyApiClient {
@@ -4013,7 +4339,7 @@ export class Telephony extends HeyApiClient {
4013
4339
  }
4014
4340
  }
4015
4341
 
4016
- export class Versions2 extends HeyApiClient {
4342
+ export class Versions3 extends HeyApiClient {
4017
4343
  /**
4018
4344
  * Get Tool Version
4019
4345
  *
@@ -4304,9 +4630,9 @@ export class Tools2 extends HeyApiClient {
4304
4630
  });
4305
4631
  }
4306
4632
 
4307
- private _versions?: Versions2;
4308
- get versions(): Versions2 {
4309
- return this._versions ??= new Versions2({ client: this.client });
4633
+ private _versions?: Versions3;
4634
+ get versions(): Versions3 {
4635
+ return this._versions ??= new Versions3({ client: this.client });
4310
4636
  }
4311
4637
  }
4312
4638