/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { agentConnectorsSetupWhatsAppAppWebhook } from "../funcs/agentConnectorsSetupWhatsAppAppWebhook.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.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 AgentConnectorsSetupWhatsAppAppWebhookMutationVariables = { request: operations.SetupWhatsAppAppWebhookRequest; options?: RequestOptions; }; export type AgentConnectorsSetupWhatsAppAppWebhookMutationData = operations.SetupWhatsAppAppWebhookResponse; export type AgentConnectorsSetupWhatsAppAppWebhookMutationError = | errors.ErrorEnvelope | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Set up a WhatsApp app webhook (Beta) * * @remarks * Beta. Returns the app-level callback URL and verification token that must be saved in Meta before the first WhatsApp phone connector is created. The caller must be allowed to manage the agent. The stable verification token is returned only in this no-store response and is not a Meta access token. */ export function useAgentConnectorsSetupWhatsAppAppWebhookMutation( options?: MutationHookOptions< AgentConnectorsSetupWhatsAppAppWebhookMutationData, AgentConnectorsSetupWhatsAppAppWebhookMutationError, AgentConnectorsSetupWhatsAppAppWebhookMutationVariables >, ): UseMutationResult< AgentConnectorsSetupWhatsAppAppWebhookMutationData, AgentConnectorsSetupWhatsAppAppWebhookMutationError, AgentConnectorsSetupWhatsAppAppWebhookMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildAgentConnectorsSetupWhatsAppAppWebhookMutation(client, options), ...options, }); } export function mutationKeyAgentConnectorsSetupWhatsAppAppWebhook(): MutationKey { return ["@meetkai/mka1", "Agent Connectors", "setupWhatsAppAppWebhook"]; } export function buildAgentConnectorsSetupWhatsAppAppWebhookMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AgentConnectorsSetupWhatsAppAppWebhookMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyAgentConnectorsSetupWhatsAppAppWebhook(), mutationFn: function agentConnectorsSetupWhatsAppAppWebhookMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(agentConnectorsSetupWhatsAppAppWebhook( client$, request, mergedOptions, )); }, }; }