export type DeleteApiApiV1TranslationKeysArgs = {key: string, namespace?: string | undefined}; export type DeleteApiApiV1TranslationKeysOptions = {baseUrl?: string | undefined, ProjectAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete translation key * * DELETE /api/v1/translation-keys */ export const deleteApiApiV1TranslationKeys = async (args: DeleteApiApiV1TranslationKeysArgs, options?: DeleteApiApiV1TranslationKeysOptions) => { 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${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 undefined };