/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { budgetsSetCurrency } from "../funcs/budgetsSetCurrency.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 { 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 BudgetsSetCurrencyMutationVariables = { request: operations.SetCurrencyRequestBody; options?: RequestOptions; }; export type BudgetsSetCurrencyMutationData = operations.SetCurrencyResponseBody; export type BudgetsSetCurrencyMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Set display currency * * @remarks * ISO 4217 code used for display on budgets and cost reports. No conversion is performed anywhere. */ export function useBudgetsSetCurrencyMutation( options?: MutationHookOptions< BudgetsSetCurrencyMutationData, BudgetsSetCurrencyMutationError, BudgetsSetCurrencyMutationVariables >, ): UseMutationResult< BudgetsSetCurrencyMutationData, BudgetsSetCurrencyMutationError, BudgetsSetCurrencyMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildBudgetsSetCurrencyMutation(client, options), ...options, }); } export function mutationKeyBudgetsSetCurrency(): MutationKey { return ["@meetkai/mka1", "budgets", "setCurrency"]; } export function buildBudgetsSetCurrencyMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: BudgetsSetCurrencyMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyBudgetsSetCurrency(), mutationFn: function budgetsSetCurrencyMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(budgetsSetCurrency( client$, request, mergedOptions, )); }, }; }