/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { companyAttachmentsGetList } from "../funcs/companyAttachmentsGetList.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1CompaniesAttachmentsHeaderXGustoAPIVersion, GetV1CompaniesAttachmentsRequest, GetV1CompaniesAttachmentsResponse, } from "../models/operations/getv1companiesattachments.js"; import { unwrapAsync } from "../types/fp.js"; export type CompanyAttachmentsGetListQueryData = GetV1CompaniesAttachmentsResponse; export function prefetchCompanyAttachmentsGetList( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1CompaniesAttachmentsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildCompanyAttachmentsGetListQuery( client$, request, options, ), }); } export function buildCompanyAttachmentsGetListQuery( client$: GustoEmbeddedCore, request: GetV1CompaniesAttachmentsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyCompanyAttachmentsGetList(request.companyId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function companyAttachmentsGetListQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(companyAttachmentsGetList( client$, request, mergedOptions, )); }, }; } export function queryKeyCompanyAttachmentsGetList( companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "companyAttachments", "getList", companyId, parameters, ]; }