export type DeleteApiRateplanV1RatePlansIdRatesArgs = {id: string, from: string, to: string}; export type DeleteApiRateplanV1RatePlansIdRatesOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes the rates for the rate plan * * DELETE /rateplan/v1/rate-plans/{id}/rates */ export const deleteApiRateplanV1RatePlansIdRates = async (args: DeleteApiRateplanV1RatePlansIdRatesArgs, options: DeleteApiRateplanV1RatePlansIdRatesOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.from != null) query.append("from", String(args.from)) if (args.to != null) query.append("to", String(args.to)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/rateplan/v1/rate-plans/${encodeURIComponent(String(args.id))}/rates${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 };