Skip to content

AI translation

This page was translated from German with AI. If in doubt, the German original applies.

Building fields

The document types are generated Protobuf types. Scalar fields there are not simple values but wrappers (StringField, BoolField, Int32Field, …). Short constructors for them are in Zedal.Sdk.Protobuf.ProtoFields:

Helper For
Sf(string) StringField
Bf(bool) BoolField
I32(int) / I64(long) Int32Field / Int64Field
Df(double) DoubleField
DateUtc(y, m, d) Date as TimestampField
DateTimeUtc(y, m, d, h, min, s) Timestamp as TimestampField

For controlled value lists, there are typed enums in Zedal.Sdk.Apis.Diwass.Enums — including AttachmentTypeId, PackageTypeCode, RecoveryDisposalCode, HCode, HpCode, WasteCodeListId, MeansOfTransportCode, FacilityTypeCode, Annex7FacilityTypeCode. Each enum value carries its wire value as an attribute; the conversion is done by the extension methods in DiwassEnumExtensions:

string wire = AttachmentTypeId.FacilityPermit.ToWire();

if (DiwassEnumExtensions.TryFromWire<AttachmentTypeId>(raw, out var typeId)) { /* … */ }

var lenient = DiwassEnumExtensions.FromWireOrUnknown<AttachmentTypeId>(raw);

Each of these enums has an Unknown value as a fallback for wire values the SDK doesn’t know yet. On read paths, this is intended: a new server value does not cause a crash. On write paths, Unknown is an error in your data. The business value lists are under Code lists.