export type GetApiV1ProjectsProjectIDDisksDiskNameServeArgs = {projectID: string, diskName: string, path: string, type: string, token: string}; export type GetApiV1ProjectsProjectIDDisksDiskNameServeOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Serve file from FileBrowser * * GET /v1/projects/{projectID}/disks/{diskName}/serve * * Also accepts auth: bearerAuth */ export const getApiV1ProjectsProjectIDDisksDiskNameServe = async (args: GetApiV1ProjectsProjectIDDisksDiskNameServeArgs, options?: GetApiV1ProjectsProjectIDDisksDiskNameServeOptions) => { const {baseUrl = "https://Example", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.path != null) query.append("path", String(args.path)) if (args.type != null) query.append("type", String(args.type)) if (args.token != null) query.append("token", String(args.token)) if (jwt !== undefined) headers.set("Authorization", jwt) const url = `${baseUrl.replace(/\/+$/, '')}/v1/projects/${encodeURIComponent(String(args.projectID))}/disks/${encodeURIComponent(String(args.diskName))}/serve${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };