export type DeleteApiInstallmentsPlansInstallmentCodeArgs = {installment_code: string}; export type DeleteApiInstallmentsPlansInstallmentCodeOptions = {baseUrl?: string | undefined, publicApiKey?: string | undefined, privateSecretKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Installments Plan * * DELETE /installments-plans/{installment_code} */ export const deleteApiInstallmentsPlansInstallmentCode = async (args: DeleteApiInstallmentsPlansInstallmentCodeArgs, options?: DeleteApiInstallmentsPlansInstallmentCodeOptions) => { const {baseUrl = "https://api-sandbox.y.uno/v1", fetch: fetchFn = fetch, publicApiKey, privateSecretKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (publicApiKey !== undefined) headers.set("PUBLIC-API-KEY", publicApiKey) if (privateSecretKey !== undefined) headers.set("PRIVATE-SECRET-KEY", privateSecretKey) const url = `${baseUrl.replace(/\/+$/, '')}/installments-plans/${encodeURIComponent(String(args.installment_code))}${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 (await res.json()) as unknown };