export type CreateApiApiV1TranslationKeysScreenshotsFileUploadArgs = {key: string, namespace?: string | undefined, body: BodyInit}; export type CreateApiApiV1TranslationKeysScreenshotsFileUploadOptions = {baseUrl?: string | undefined, ProjectAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload translation key screenshot from file * * POST /api/v1/translation-keys/screenshots/file-upload */ export const createApiApiV1TranslationKeysScreenshotsFileUpload = async (args: CreateApiApiV1TranslationKeysScreenshotsFileUploadArgs, options?: CreateApiApiV1TranslationKeysScreenshotsFileUploadOptions) => { const {baseUrl = "https://api.simplelocalize.io", fetch: fetchFn = fetch, ProjectAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.key != null) query.append("key", String(args.key)) if (args.namespace != null) query.append("namespace", String(args.namespace)) if (ProjectAPIKey !== undefined) headers.set("X-SimpleLocalize-Token", ProjectAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/translation-keys/screenshots/file-upload${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };