/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { llmImagesCreate } from "../funcs/llmImagesCreate.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 { 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 LlmImagesCreateMutationVariables = { request: operations.CreateImageRequest; options?: RequestOptions; }; export type LlmImagesCreateMutationData = components.ImageGenerationResponse; export type LlmImagesCreateMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Generate images from text descriptions * * @remarks * Creates AI-generated images from text descriptions. */ export function useLlmImagesCreateMutation( options?: MutationHookOptions< LlmImagesCreateMutationData, LlmImagesCreateMutationError, LlmImagesCreateMutationVariables >, ): UseMutationResult< LlmImagesCreateMutationData, LlmImagesCreateMutationError, LlmImagesCreateMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildLlmImagesCreateMutation(client, options), ...options, }); } export function mutationKeyLlmImagesCreate(): MutationKey { return ["@meetkai/mka1", "images", "create"]; } export function buildLlmImagesCreateMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: LlmImagesCreateMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyLlmImagesCreate(), mutationFn: function llmImagesCreateMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(llmImagesCreate( client$, request, mergedOptions, )); }, }; }