export type GetApiCustomsImportsNotificationsArgs = {Accept: 'application/vnd.hmrc.1.0+xml', Authorization: 'Bearer bb7fed3fe10dd235a2ccda3d50fb'}; export type GetApiCustomsImportsNotificationsOptions = {baseUrl?: string | undefined, UserRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a list of notifications * * GET /customs/imports/notifications/ */ export const getApiCustomsImportsNotifications = async (args: GetApiCustomsImportsNotificationsArgs, options?: GetApiCustomsImportsNotificationsOptions) => { const {baseUrl = "https://test-api.service.hmrc.gov.uk", fetch: fetchFn = fetch, UserRestricted} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/xml") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (UserRestricted !== undefined) headers.set('authorization', `Bearer ${UserRestricted}`) const url = `${baseUrl.replace(/\/+$/, '')}/customs/imports/notifications/${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 res.blob() };