export type DeleteApiApiV1GlossaryArgs = {'X-SimpleLocalize-Token': string, sourceText: string}; export type DeleteApiApiV1GlossaryOptions = {baseUrl?: string | undefined, ProjectAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete glossary entry * * DELETE /api/v1/glossary */ export const deleteApiApiV1Glossary = async (args: DeleteApiApiV1GlossaryArgs, options?: DeleteApiApiV1GlossaryOptions) => { const {baseUrl = "https://api.simplelocalize.io", fetch: fetchFn = fetch, ProjectAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-SimpleLocalize-Token'] != null) headers.set("X-SimpleLocalize-Token", String(args['X-SimpleLocalize-Token'])) if (args.sourceText != null) query.append("sourceText", String(args.sourceText)) if (ProjectAPIKey !== undefined) headers.set("X-SimpleLocalize-Token", ProjectAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/glossary${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 };