export type GetApiApiV1ProjectsProjectIdExportsArgs = {locale: string, format: string, projectId: string}; export type GetApiApiV1ProjectsProjectIdExportsOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export all translated terms for a project's locale * * GET /api/v1/projects/{projectId}/exports */ export const getApiApiV1ProjectsProjectIdExports = async (args: GetApiApiV1ProjectsProjectIdExportsArgs, options: GetApiApiV1ProjectsProjectIdExportsOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.locale != null) query.append("locale", String(args.locale)) if (args.format != null) query.append("format", String(args.format)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.projectId))}/exports${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 };