export type GetApiCustomsGoodsMovementSystemMovementsGmrIdArgs = {gmrId: string, Accept: string, Authorization: string}; export type GetApiCustomsGoodsMovementSystemMovementsGmrIdOptions = {baseUrl?: string | undefined, userRestricted?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Goods Movement Record * * GET /customs/goods-movement-system/movements/{gmrId} */ export const getApiCustomsGoodsMovementSystemMovementsGmrId = async (args: GetApiCustomsGoodsMovementSystemMovementsGmrIdArgs, options?: GetApiCustomsGoodsMovementSystemMovementsGmrIdOptions) => { const {baseUrl = "https://api.service.hmrc.gov.uk", fetch: fetchFn = fetch, userRestricted} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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/goods-movement-system/movements/${encodeURIComponent(String(args.gmrId))}${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 };