export type GetApiValidateDocumentUuidArgs = {documentUuid: string}; export type GetApiValidateDocumentUuidOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Link para página de validação da(s) assinatura(s) sobre documento específico * * GET /validate/{documentUuid} */ export const getApiValidateDocumentUuid = async (args: GetApiValidateDocumentUuidArgs, options?: GetApiValidateDocumentUuidOptions) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/validate/${encodeURIComponent(String(args.documentUuid))}${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 };