export type UpdateTranslationKeyRequestV2 = {key?: string | undefined, namespace?: string | undefined, description?: string | undefined, codeDescription?: string | undefined, charactersLimit?: number | undefined, deprecated?: boolean | undefined, lock?: boolean | undefined, tags?: Array | undefined, attributes?: {[key: string]: unknown} | undefined}; export type PatchApiApiV1TranslationKeysIdArgs = {id: string, body: UpdateTranslationKeyRequestV2}; export type PatchApiApiV1TranslationKeysIdOptions = {baseUrl?: string | undefined, ProjectAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update translation key by ID * * PATCH /api/v1/translation-keys/{id} */ export const patchApiApiV1TranslationKeysId = async (args: PatchApiApiV1TranslationKeysIdArgs, options?: PatchApiApiV1TranslationKeysIdOptions) => { const {baseUrl = "https://api.simplelocalize.io", fetch: fetchFn = fetch, ProjectAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ProjectAPIKey !== undefined) headers.set("X-SimpleLocalize-Token", ProjectAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/translation-keys/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };