/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { authApiKeyGetJwtFromKey } from "../funcs/authApiKeyGetJwtFromKey.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 AuthApiKeyGetJwtFromKeyMutationVariables = { request: operations.GetJwtFromKeyRequest; options?: RequestOptions; }; export type AuthApiKeyGetJwtFromKeyMutationData = operations.GetJwtFromKeyResponseBody; export type AuthApiKeyGetJwtFromKeyMutationError = | errors.GetJwtFromKeyResponseBody | errors.GetJwtFromKeyAuthApiKeyResponseBody | errors.GetJwtFromKeyAuthApiKeyResponseResponseBody | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Exchange API key for a JWT token * * @remarks * Exchange an API key for a JWT token * * @deprecated method: Use auth.apiKeys.exchangeToken() instead. This method will be removed in a future release.. Use exchangeToken instead. */ export function useAuthApiKeyGetJwtFromKeyMutation( options?: MutationHookOptions< AuthApiKeyGetJwtFromKeyMutationData, AuthApiKeyGetJwtFromKeyMutationError, AuthApiKeyGetJwtFromKeyMutationVariables >, ): UseMutationResult< AuthApiKeyGetJwtFromKeyMutationData, AuthApiKeyGetJwtFromKeyMutationError, AuthApiKeyGetJwtFromKeyMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildAuthApiKeyGetJwtFromKeyMutation(client, options), ...options, }); } export function mutationKeyAuthApiKeyGetJwtFromKey(): MutationKey { return ["@meetkai/mka1", "apiKey", "getJwtFromKey"]; } export function buildAuthApiKeyGetJwtFromKeyMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AuthApiKeyGetJwtFromKeyMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyAuthApiKeyGetJwtFromKey(), mutationFn: function authApiKeyGetJwtFromKeyMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(authApiKeyGetJwtFromKey( client$, request, mergedOptions, )); }, }; }