export type GetApiApiV2MeImprimirArquivoIdArgs = {Accept: string, arquivo: string, 'Content-Type': string, id: string, Authorization: string, 'User-Agent': string}; export type GetApiApiV2MeImprimirArquivoIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Impressão de etiquetas em arquivo * * GET /api/v2/me/imprimir/{arquivo}/{id} */ export const getApiApiV2MeImprimirArquivoId = async (args: GetApiApiV2MeImprimirArquivoIdArgs, options?: GetApiApiV2MeImprimirArquivoIdOptions) => { const {baseUrl = "https://sandbox.melhorenvio.com.br", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "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 (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/me/imprimir/${encodeURIComponent(String(args.arquivo))}/${encodeURIComponent(String(args.id))}${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 (await res.json()) as unknown };