export type GetApiCustomsDeclarationsInformationMrnMrnStatusArgs = {mrn: string, Accept: string, 'X-Badge-Identifier'?: string | undefined, 'X-Submitter-Identifier'?: string | undefined}; export type GetApiCustomsDeclarationsInformationMrnMrnStatusOptions = {baseUrl?: string | undefined, userRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the status of a declaration by MRN * * GET /customs/declarations-information/mrn/{mrn}/status */ export const getApiCustomsDeclarationsInformationMrnMrnStatus = async (args: GetApiCustomsDeclarationsInformationMrnMrnStatusArgs, options?: GetApiCustomsDeclarationsInformationMrnMrnStatusOptions) => { 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['X-Badge-Identifier'] != null) headers.set("X-Badge-Identifier", String(args['X-Badge-Identifier'])) if (args['X-Submitter-Identifier'] != null) headers.set("X-Submitter-Identifier", String(args['X-Submitter-Identifier'])) if (userRestricted !== undefined) headers.set('authorization', `Bearer ${userRestricted}`) const url = `${baseUrl.replace(/\/+$/, '')}/customs/declarations-information/mrn/${encodeURIComponent(String(args.mrn))}/status${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() };