/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { companyAttachmentGetDownloadUrl } from "../funcs/companyAttachmentGetDownloadUrl.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1CompaniesAttachmentUrlHeaderXGustoAPIVersion, GetV1CompaniesAttachmentUrlRequest, GetV1CompaniesAttachmentUrlResponse, } from "../models/operations/getv1companiesattachmenturl.js"; import { unwrapAsync } from "../types/fp.js"; export type CompanyAttachmentGetDownloadUrlQueryData = GetV1CompaniesAttachmentUrlResponse; export function prefetchCompanyAttachmentGetDownloadUrl( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1CompaniesAttachmentUrlRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildCompanyAttachmentGetDownloadUrlQuery( client$, request, options, ), }); } export function buildCompanyAttachmentGetDownloadUrlQuery( client$: GustoEmbeddedCore, request: GetV1CompaniesAttachmentUrlRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyCompanyAttachmentGetDownloadUrl( request.companyId, request.companyAttachmentUuid, { xGustoAPIVersion: request.xGustoAPIVersion }, ), queryFn: async function companyAttachmentGetDownloadUrlQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(companyAttachmentGetDownloadUrl( client$, request, mergedOptions, )); }, }; } export function queryKeyCompanyAttachmentGetDownloadUrl( companyId: string, companyAttachmentUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentUrlHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "companyAttachment", "getDownloadUrl", companyId, companyAttachmentUuid, parameters, ]; }