/* * 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 { GetV1EmployeesEmployeeIdHomeAddressesHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdHomeAddressesRequest, } from "../models/operations/getv1employeesemployeeidhomeaddresses.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeeAddressesGetQuery, EmployeeAddressesGetQueryData, prefetchEmployeeAddressesGet, queryKeyEmployeeAddressesGet, } from "./employeeAddressesGet.core.js"; export { buildEmployeeAddressesGetQuery, type EmployeeAddressesGetQueryData, prefetchEmployeeAddressesGet, queryKeyEmployeeAddressesGet, }; export type EmployeeAddressesGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee's home addresses * * @remarks * The home address of an employee is used to determine certain tax information about them. Addresses are geocoded on create and update to ensure validity. * * Supports home address effective dating and courtesy withholding. * * scope: `employees:read` */ export function useEmployeeAddressesGet( request: GetV1EmployeesEmployeeIdHomeAddressesRequest, options?: QueryHookOptions< EmployeeAddressesGetQueryData, EmployeeAddressesGetQueryError >, ): UseQueryResult< EmployeeAddressesGetQueryData, EmployeeAddressesGetQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeeAddressesGetQuery( client, request, options, ), ...options, }); } /** * Get an employee's home addresses * * @remarks * The home address of an employee is used to determine certain tax information about them. Addresses are geocoded on create and update to ensure validity. * * Supports home address effective dating and courtesy withholding. * * scope: `employees:read` */ export function useEmployeeAddressesGetSuspense( request: GetV1EmployeesEmployeeIdHomeAddressesRequest, options?: SuspenseQueryHookOptions< EmployeeAddressesGetQueryData, EmployeeAddressesGetQueryError >, ): UseSuspenseQueryResult< EmployeeAddressesGetQueryData, EmployeeAddressesGetQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeeAddressesGetQuery( client, request, options, ), ...options, }); } export function setEmployeeAddressesGetData( client: QueryClient, queryKeyBase: [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdHomeAddressesHeaderXGustoAPIVersion | undefined; }, ], data: EmployeeAddressesGetQueryData, ): EmployeeAddressesGetQueryData | undefined { const key = queryKeyEmployeeAddressesGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateEmployeeAddressesGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdHomeAddressesHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "employeeAddresses", "get", ...queryKeyBase, ], }); } export function invalidateAllEmployeeAddressesGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "employeeAddresses", "get"], }); }