Bacen.STA.ProtocolParser (Bacen STA v0.1.1)

The Protocol response message parser.

Link to this section Summary

Functions

Parses a Protocol response message schema into tuple-formatted XML.

Link to this section Functions

Specs

parse(String.t() | xml_nodes()) ::
  {:ok, Bacen.STA.Response.t()} | {:error, any()}

Parses a Protocol response message schema into tuple-formatted XML.

Examples

iex> response_xml = ~s(<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Resultado xmlns:atom="http://www.w3.org/2005/Atom"><Protocolo>202111172051</Protocolo><atom:link href="https://sta-h.bcb.gov.br/staws/arquivos/202111172051/conteudo" rel="conteudo" type="application/octet-stream" /></Resultado>)
iex> Bacen.STA.ProtocolParser.parse(response_xml)
{:ok, %Bacen.STA.Response{
  result: %Bacen.STA.Response.Result{protocol: "202111172051"}
}}