export type GetApiProjectsProjectIdLocalesIdDownloadArgs = {'X-PhraseApp-OTP'?: string | undefined, 'If-Modified-Since'?: string | undefined, 'If-None-Match'?: string | undefined, project_id: string, id: string, branch?: string | undefined, file_format?: string | undefined, tags?: string | undefined, tag?: string | undefined, include_empty_translations?: boolean | undefined, exclude_empty_zero_forms?: boolean | undefined, include_translated_keys?: boolean | undefined, keep_notranslate_tags?: boolean | undefined, convert_emoji?: boolean | undefined, format_options?: Record | undefined, encoding?: string | undefined, skip_unverified_translations?: boolean | undefined, include_unverified_translations?: boolean | undefined, use_last_reviewed_version?: boolean | undefined, fallback_locale_id?: string | undefined, use_locale_fallback?: boolean | undefined, fallback_for_unverified_translations?: boolean | undefined, source_locale_id?: string | undefined, translation_key_prefix?: string | undefined, filter_by_prefix?: boolean | undefined, custom_metadata_filters?: Record | undefined, locale_ids?: Array | undefined, updated_since?: string | undefined}; export type GetApiProjectsProjectIdLocalesIdDownloadOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a locale * * GET /projects/{project_id}/locales/{id}/download */ export const getApiProjectsProjectIdLocalesIdDownload = async (args: GetApiProjectsProjectIdLocalesIdDownloadArgs, options?: GetApiProjectsProjectIdLocalesIdDownloadOptions) => { const {baseUrl = "https://eu.phrase.com/control-hub", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*") if (args['X-PhraseApp-OTP'] != null) headers.set("X-PhraseApp-OTP", String(args['X-PhraseApp-OTP'])) if (args['If-Modified-Since'] != null) headers.set("If-Modified-Since", String(args['If-Modified-Since'])) if (args['If-None-Match'] != null) headers.set("If-None-Match", String(args['If-None-Match'])) if (args.branch != null) query.append("branch", String(args.branch)) if (args.file_format != null) query.append("file_format", String(args.file_format)) if (args.tags != null) query.append("tags", String(args.tags)) if (args.tag != null) query.append("tag", String(args.tag)) if (args.include_empty_translations != null) query.append("include_empty_translations", String(args.include_empty_translations)) if (args.exclude_empty_zero_forms != null) query.append("exclude_empty_zero_forms", String(args.exclude_empty_zero_forms)) if (args.include_translated_keys != null) query.append("include_translated_keys", String(args.include_translated_keys)) if (args.keep_notranslate_tags != null) query.append("keep_notranslate_tags", String(args.keep_notranslate_tags)) if (args.convert_emoji != null) query.append("convert_emoji", String(args.convert_emoji)) if (args.format_options != null) query.append("format_options", JSON.stringify(args.format_options)) if (args.encoding != null) query.append("encoding", String(args.encoding)) if (args.skip_unverified_translations != null) query.append("skip_unverified_translations", String(args.skip_unverified_translations)) if (args.include_unverified_translations != null) query.append("include_unverified_translations", String(args.include_unverified_translations)) if (args.use_last_reviewed_version != null) query.append("use_last_reviewed_version", String(args.use_last_reviewed_version)) if (args.fallback_locale_id != null) query.append("fallback_locale_id", String(args.fallback_locale_id)) if (args.use_locale_fallback != null) query.append("use_locale_fallback", String(args.use_locale_fallback)) if (args.fallback_for_unverified_translations != null) query.append("fallback_for_unverified_translations", String(args.fallback_for_unverified_translations)) if (args.source_locale_id != null) query.append("source_locale_id", String(args.source_locale_id)) if (args.translation_key_prefix != null) query.append("translation_key_prefix", String(args.translation_key_prefix)) if (args.filter_by_prefix != null) query.append("filter_by_prefix", String(args.filter_by_prefix)) if (args.custom_metadata_filters != null) query.append("custom_metadata_filters", JSON.stringify(args.custom_metadata_filters)) for (const item of args.locale_ids ?? []) query.append("locale_ids", String(item)) if (args.updated_since != null) query.append("updated_since", String(args.updated_since)) const url = `${baseUrl.replace(/\/+$/, '')}/projects/${encodeURIComponent(String(args.project_id))}/locales/${encodeURIComponent(String(args.id))}/download${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 res.blob() };