export type GetApiFwV1XmlOperacoesIdentificadorAssinaturasHashArgs = {identificador: string, hash: string}; export type GetApiFwV1XmlOperacoesIdentificadorAssinaturasHashOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Recupera um documento via link enquanto disponível em cache. Após o download, o documento é excluído da cache. * * GET /fw/v1/xml/operacoes/{identificador}/assinaturas/{hash} */ export const getApiFwV1XmlOperacoesIdentificadorAssinaturasHash = async (args: GetApiFwV1XmlOperacoesIdentificadorAssinaturasHashArgs, options?: GetApiFwV1XmlOperacoesIdentificadorAssinaturasHashOptions) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/fw/v1/xml/operacoes/${encodeURIComponent(String(args.identificador))}/assinaturas/${encodeURIComponent(String(args.hash))}${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() };