export type GetApiCustomsExciseMovementsMovementIdMessagesMessageIdArgs = {Accept: 'application/vnd.hmrc.1.0+xml', movementId: string, messageId: string}; export type GetApiCustomsExciseMovementsMovementIdMessagesMessageIdOptions = {baseUrl?: string | undefined, userRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a message for an excise movement using the movementId and messageId * * GET /customs/excise/movements/{movementId}/messages/{messageId} */ export const getApiCustomsExciseMovementsMovementIdMessagesMessageId = async (args: GetApiCustomsExciseMovementsMovementIdMessagesMessageIdArgs, options?: GetApiCustomsExciseMovementsMovementIdMessagesMessageIdOptions) => { 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/vnd.hmrc.1.0+xml") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (userRestricted !== undefined) headers.set('authorization', `Bearer ${userRestricted}`) const url = `${baseUrl.replace(/\/+$/, '')}/customs/excise/movements/${encodeURIComponent(String(args.movementId))}/messages/${encodeURIComponent(String(args.messageId))}${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() };