export type GetApiIndividualsDeductionsOtherNinoTaxYearOptions = {baseUrl?: string | undefined, UserRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /individuals/deductions/other/{nino}/{taxYear} */ export const getApiIndividualsDeductionsOtherNinoTaxYear = async (options?: GetApiIndividualsDeductionsOtherNinoTaxYearOptions) => { 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: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };