/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { NotFoundErrorObject } from "../models/errors/notfounderrorobject.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetV1TimeOffRequestsTimeOffRequestUuidHeaderXGustoAPIVersion, GetV1TimeOffRequestsTimeOffRequestUuidRequest, } from "../models/operations/getv1timeoffrequeststimeoffrequestuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQuery, prefetchTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid, queryKeyTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid, TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, } from "./timeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid.core.js"; export { buildTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQuery, prefetchTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid, queryKeyTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid, type TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, }; export type TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a time off request * * @remarks * Get a single time off request by UUID * * scope: `time_off_requests:read` */ export function useTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid( request: GetV1TimeOffRequestsTimeOffRequestUuidRequest, options?: QueryHookOptions< TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryError >, ): UseQueryResult< TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQuery( client, request, options, ), ...options, }); } /** * Get a time off request * * @remarks * Get a single time off request by UUID * * scope: `time_off_requests:read` */ export function useTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidSuspense( request: GetV1TimeOffRequestsTimeOffRequestUuidRequest, options?: SuspenseQueryHookOptions< TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryError >, ): UseSuspenseQueryResult< TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQuery( client, request, options, ), ...options, }); } export function setTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidData( client: QueryClient, queryKeyBase: [ timeOffRequestUuid: string, parameters: { xGustoAPIVersion?: | GetV1TimeOffRequestsTimeOffRequestUuidHeaderXGustoAPIVersion | undefined; }, ], data: TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData, ): TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData | undefined { const key = queryKeyTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid( ...queryKeyBase, ); return client.setQueryData< TimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuidQueryData >(key, data); } export function invalidateTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid( client: QueryClient, queryKeyBase: TupleToPrefixes< [ timeOffRequestUuid: string, parameters: { xGustoAPIVersion?: | GetV1TimeOffRequestsTimeOffRequestUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Time Off Requests", "getV1TimeOffRequestsTimeOffRequestUuid", ...queryKeyBase, ], }); } export function invalidateAllTimeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Time Off Requests", "getV1TimeOffRequestsTimeOffRequestUuid", ], }); }