export type GetApiFilesIdVersionsVersionIdContentsPathArgs = {id: string, version_id: string, path: string}; export type GetApiFilesIdVersionsVersionIdContentsPathOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get contents of a file version within a package. * * GET /files/{id}/versions/{version_id}/contents/{path} */ export const getApiFilesIdVersionsVersionIdContentsPath = async (args: GetApiFilesIdVersionsVersionIdContentsPathArgs, options?: GetApiFilesIdVersionsVersionIdContentsPathOptions) => { const {baseUrl = "https://api.webscale.com/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/files/${encodeURIComponent(String(args.id))}/versions/${encodeURIComponent(String(args.version_id))}/contents/${encodeURIComponent(String(args.path))}${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 };