export type DeleteApiIndividualsDeductionsOtherNinoTaxYearOptions = {baseUrl?: string | undefined, UserRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /individuals/deductions/other/{nino}/{taxYear} */ export const deleteApiIndividualsDeductionsOtherNinoTaxYear = async (options?: DeleteApiIndividualsDeductionsOtherNinoTaxYearOptions) => { const {baseUrl = "https://test-api.service.hmrc.gov.uk", fetch: fetchFn = fetch, UserRestricted} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (UserRestricted !== undefined) headers.set('authorization', `Bearer ${UserRestricted}`) const url = `${baseUrl.replace(/\/+$/, '')}/individuals/deductions/other/${encodeURIComponent(String(args.nino))}/${encodeURIComponent(String(args.taxYear))}${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 };