pub struct MessageBuilder { /* private fields */ }Expand description
Builds a complete DVGW message.
The document code decides the family, the carrier and the UNH header, so
there is one builder rather than one per message type.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn new(document: DvgwDocument) -> Self
pub fn new(document: DvgwDocument) -> Self
Start a message of the given document type.
Sourcepub fn message_ref(self, value: impl Into<String>) -> Self
pub fn message_ref(self, value: impl Into<String>) -> Self
UNH DE 0062 message reference (mirrored in UNT).
Sourcepub fn document_number(self, value: impl Into<String>) -> Self
pub fn document_number(self, value: impl Into<String>) -> Self
BGM C106 DE 1004 Dokumentennummer.
Sourcepub fn version(self, value: impl Into<String>) -> Self
pub fn version(self, value: impl Into<String>) -> Self
UNH S009 DE 0057 — the package code (DVGW17) or version (5.11a).
Defaults to what the family’s Nachrichtenbeschreibung prescribes
(DvgwMessageType::anwendungscode).
Sourcepub fn pruefidentifikator(self, pid: u32) -> Self
pub fn pruefidentifikator(self, pid: u32) -> Self
SG1 RFF+Z13 Prüfidentifikator.
Sourcepub fn message_datetime(self, value: OffsetDateTime) -> Self
pub fn message_datetime(self, value: OffsetDateTime) -> Self
DTM+137 Datum und Zeit der Nachricht.
Sourcepub fn validity_period(self, period: DvgwPeriod) -> Self
pub fn validity_period(self, period: DvgwPeriod) -> Self
DTM+Z01 Gültigkeitszeitraum — the gas day for ALOCAT, NOMINT and
NOMRES, the Abrechnungszeitraum for SSQNOT.
Sourcepub fn sender(self, code: impl Into<String>) -> Self
pub fn sender(self, code: impl Into<String>) -> Self
NAD+MS Absender, coded under the DVGW agency (332).
Sourcepub fn sender_coded(
self,
code: impl Into<String>,
agency: impl Into<String>,
) -> Self
pub fn sender_coded( self, code: impl Into<String>, agency: impl Into<String>, ) -> Self
NAD+MS Absender under an explicit DE 3055 agency (9 for a GLN).
Sourcepub fn receiver(self, code: impl Into<String>) -> Self
pub fn receiver(self, code: impl Into<String>) -> Self
NAD+MR Empfänger, coded under the DVGW agency (332).
Sourcepub fn receiver_coded(
self,
code: impl Into<String>,
agency: impl Into<String>,
) -> Self
pub fn receiver_coded( self, code: impl Into<String>, agency: impl Into<String>, ) -> Self
NAD+MR Empfänger under an explicit DE 3055 agency (9 for a GLN).
Sourcepub fn party(self, role: impl Into<String>, code: impl Into<String>) -> Self
pub fn party(self, role: impl Into<String>, code: impl Into<String>) -> Self
Any further header NAD, e.g. ZSY (zusätzlicher BKV), under 332.
Sourcepub fn party_coded(
self,
role: impl Into<String>,
code: impl Into<String>,
agency: impl Into<String>,
) -> Self
pub fn party_coded( self, role: impl Into<String>, code: impl Into<String>, agency: impl Into<String>, ) -> Self
party under an explicit DE 3055 agency.
Sourcepub fn clearingnummer(self, value: impl Into<String>) -> Self
pub fn clearingnummer(self, value: impl Into<String>) -> Self
RFF+ANX Clearingnummer (ALOCAT), written first in SG1 as the
Nachrichtenstruktur orders it.
Sourcepub fn original_nomination(
self,
value: impl Into<String>,
processed_at: OffsetDateTime,
) -> Self
pub fn original_nomination( self, value: impl Into<String>, processed_at: OffsetDateTime, ) -> Self
RFF+AGO — the nomination this one corrects (NOMINT) — with the
DTM+9 Bearbeitungsdatum NOMINT 4.6 marks Erforderlich beside it.
Sourcepub fn reference(
self,
qualifier: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn reference( self, qualifier: impl Into<String>, value: impl Into<String>, ) -> Self
Any further header RFF, written after the ones the structure orders.
Sourcepub fn build(&self) -> Result<Vec<u8>, Error>
pub fn build(&self) -> Result<Vec<u8>, Error>
Render the message as UNH…UNT EDIFACT bytes.
The interchange envelope is deliberately not written: the AS4 layer owns
UNB/UNZ and its control reference, and a second writer would have to
guess at both.
§Errors
Returns Error::Serialize when a mandatory field was never set — the
Dokumentennummer, the Prüfidentifikator, the two timestamps, both parties,
or at least one position.
Trait Implementations§
Source§impl Clone for MessageBuilder
impl Clone for MessageBuilder
Source§fn clone(&self) -> MessageBuilder
fn clone(&self) -> MessageBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more