/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { sandboxDownloadFile } from "../funcs/sandboxDownloadFile.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export type SandboxDownloadFileQueryData = ReadableStream; export function prefetchSandboxDownloadFile( queryClient: QueryClient, client$: SDKCore, request: operations.DownloadWorkspaceFileRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildSandboxDownloadFileQuery( client$, request, options, ), }); } export function buildSandboxDownloadFileQuery( client$: SDKCore, request: operations.DownloadWorkspaceFileRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeySandboxDownloadFile(request.sessionId, request.filePath, { sessionToken: request.sessionToken, xOnBehalfOf: request.xOnBehalfOf, }), queryFn: async function sandboxDownloadFileQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(sandboxDownloadFile( client$, request, mergedOptions, )); }, }; } export function queryKeySandboxDownloadFile( sessionId: string, filePath: string, parameters: { sessionToken?: string | null | undefined; xOnBehalfOf?: string | undefined; }, ): QueryKey { return [ "@meetkai/mka1", "sandbox", "downloadFile", sessionId, filePath, parameters, ]; }