export type DeleteApiGlossariesGlossaryIdTermsArgs = {glossaryId: number, languageId?: string | undefined, conceptId?: number | undefined, translationOfTermId?: number | undefined}; export type DeleteApiGlossariesGlossaryIdTermsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Clear Glossary * * DELETE /glossaries/{glossaryId}/terms */ export const deleteApiGlossariesGlossaryIdTerms = async (args: DeleteApiGlossariesGlossaryIdTermsArgs, options?: DeleteApiGlossariesGlossaryIdTermsOptions) => { const {baseUrl = "https://api.crowdin.com/api/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.languageId != null) query.append("languageId", String(args.languageId)) if (args.conceptId != null) query.append("conceptId", String(args.conceptId)) if (args.translationOfTermId != null) query.append("translationOfTermId", String(args.translationOfTermId)) const url = `${baseUrl.replace(/\/+$/, '')}/glossaries/${encodeURIComponent(String(args.glossaryId))}/terms${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 };