export type UpdateApiMiscPushPullNotificationBoxBoxIdNotificationsAcknowledgeArgs = {Accept: 'application/vnd.hmrc.1.0+json', 'Content-Type': 'application/json', boxId: string, body: {notificationIds: Array}}; export type UpdateApiMiscPushPullNotificationBoxBoxIdNotificationsAcknowledgeOptions = {baseUrl?: string | undefined, applicationRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * Acknowledge a list of notifications * * PUT /misc/push-pull-notification/box/{boxId}/notifications/acknowledge */ export const updateApiMiscPushPullNotificationBoxBoxIdNotificationsAcknowledge = async (args: UpdateApiMiscPushPullNotificationBoxBoxIdNotificationsAcknowledgeArgs, options?: UpdateApiMiscPushPullNotificationBoxBoxIdNotificationsAcknowledgeOptions) => { const {baseUrl = "https://test-api.service.hmrc.gov.uk", fetch: fetchFn = fetch, applicationRestricted} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (applicationRestricted !== undefined) headers.set('authorization', `Bearer ${applicationRestricted}`) const url = `${baseUrl.replace(/\/+$/, '')}/misc/push-pull-notification/box/${encodeURIComponent(String(args.boxId))}/notifications/acknowledge${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };