export type DeleteApiV1FileinfoFilesFileIdLabelsArgs = {fileId: string, labelId: Array, noPropagate?: boolean | undefined, 'x-org-slug': string}; export type DeleteApiV1FileinfoFilesFileIdLabelsOptions = {baseUrl: string, token?: string | undefined, orgSlug?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Labels (DELETE) * * DELETE /v1/fileinfo/files/{fileId}/labels */ export const deleteApiV1FileinfoFilesFileIdLabels = async (args: DeleteApiV1FileinfoFilesFileIdLabelsArgs, options: DeleteApiV1FileinfoFilesFileIdLabelsOptions) => { const {baseUrl, fetch: fetchFn = fetch, token, orgSlug} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") for (const item of args.labelId ?? []) query.append("labelId", String(item)) if (args.noPropagate != null) query.append("noPropagate", String(args.noPropagate)) if (args['x-org-slug'] != null) headers.set("x-org-slug", String(args['x-org-slug'])) if (token !== undefined) headers.set("ts-auth-token", token) if (orgSlug !== undefined) headers.set("x-org-slug", orgSlug) const url = `${baseUrl.replace(/\/+$/, '')}/v1/fileinfo/files/${encodeURIComponent(String(args.fileId))}/labels${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };