export type GetApiV1FileinfoFileFileIdVersionsArgs = {fileId: string}; export type GetApiV1FileinfoFileFileIdVersionsOptions = {baseUrl: string, token?: string | undefined, orgSlug?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get File Versions * * GET /v1/fileinfo/file/{fileId}/versions */ export const getApiV1FileinfoFileFileIdVersions = async (args: GetApiV1FileinfoFileFileIdVersionsArgs, options: GetApiV1FileinfoFileFileIdVersionsOptions) => { const {baseUrl, fetch: fetchFn = fetch, token, orgSlug} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (token !== undefined) headers.set("ts-auth-token", token) if (orgSlug !== undefined) headers.set("x-org-slug", orgSlug) const url = `${baseUrl.replace(/\/+$/, '')}/v1/fileinfo/file/${encodeURIComponent(String(args.fileId))}/versions${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 (await res.json()) as unknown };