/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { agentConnectorsCreateAgentConnector } from "../funcs/agentConnectorsCreateAgentConnector.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import * as errors from "../models/errors/index.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKError } from "../models/errors/sdkerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type AgentConnectorsCreateAgentConnectorMutationVariables = { request: operations.CreateAgentConnectorRequest; options?: RequestOptions; }; export type AgentConnectorsCreateAgentConnectorMutationData = components.AgentConnector; export type AgentConnectorsCreateAgentConnectorMutationError = | errors.ErrorEnvelope | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Create a connector * * @remarks * Connects the agent to a Telegram bot or WhatsApp Business phone number, validates the provider credentials, and registers the agent's webhook. WhatsApp connector support is beta. Text, photos, and gateway-supported documents can invoke the agent; inbound media additionally requires write:files. Managed outbound files require read:files, and generated images require both file scopes so their transient provider URLs can be materialized before delivery. The optional write:feedback scope enables native thumbs reaction synchronization to gateway response feedback. These conditional scopes are deliberately not part of x-required-scopes because text-only connectors do not need them. An API key with every listed scope is required; its identity tuple and current scopes are stored as a non-widening ceiling, then revalidated with mk-authentication before every connector run; session and delegated end-user contexts are rejected. The required access policy controls which provider users or chats may invoke the agent. */ export function useAgentConnectorsCreateAgentConnectorMutation( options?: MutationHookOptions< AgentConnectorsCreateAgentConnectorMutationData, AgentConnectorsCreateAgentConnectorMutationError, AgentConnectorsCreateAgentConnectorMutationVariables >, ): UseMutationResult< AgentConnectorsCreateAgentConnectorMutationData, AgentConnectorsCreateAgentConnectorMutationError, AgentConnectorsCreateAgentConnectorMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildAgentConnectorsCreateAgentConnectorMutation(client, options), ...options, }); } export function mutationKeyAgentConnectorsCreateAgentConnector(): MutationKey { return ["@meetkai/mka1", "Agent Connectors", "createAgentConnector"]; } export function buildAgentConnectorsCreateAgentConnectorMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AgentConnectorsCreateAgentConnectorMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyAgentConnectorsCreateAgentConnector(), mutationFn: function agentConnectorsCreateAgentConnectorMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(agentConnectorsCreateAgentConnector( client$, request, mergedOptions, )); }, }; }