pub struct Party {
pub id: String,
pub metadata: HashMap<String, Value>,
}Expand description
Party in a transaction (TAIP-6).
Parties are identified using an IRI as the @id attribute in a JSON-LD object. They represent real-world entities (legal or natural persons) that are parties to a transaction.
Fields§
§id: StringIRI of the party (DID, email, phone number, etc).
metadata: HashMap<String, Value>Additional JSON-LD metadata for the party. This allows for extensible metadata like country codes, LEI codes, MCC codes, etc. Example: {“https://schema.org/addressCountry”: “de”, “lei”: “…”}
Implementations§
Source§impl Party
impl Party
Sourcepub fn with_metadata(id: &str, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(id: &str, metadata: HashMap<String, Value>) -> Self
Create a new party with metadata.
Sourcepub fn add_metadata(&mut self, key: String, value: Value)
pub fn add_metadata(&mut self, key: String, value: Value)
Add a metadata field to the party.
Sourcepub fn with_metadata_field(self, key: String, value: Value) -> Self
pub fn with_metadata_field(self, key: String, value: Value) -> Self
Add metadata using the builder pattern.
Sourcepub fn with_country(self, country_code: &str) -> Self
pub fn with_country(self, country_code: &str) -> Self
Add country code metadata.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get a metadata value by key.
Sourcepub fn with_name_hash(self, name: &str) -> Self
pub fn with_name_hash(self, name: &str) -> Self
Add name hash metadata according to TAIP-12.
Sourcepub fn set_name_hash(&mut self, hash: String)
pub fn set_name_hash(&mut self, hash: String)
Set name hash directly.
Sourcepub fn with_name(self, name: &str) -> Self
pub fn with_name(self, name: &str) -> Self
Add a name field (schema.org/Organization or schema.org/Person).
Sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
Add a description field (schema.org/Organization).
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Get the description field if present.
Sourcepub fn with_email(self, email: &str) -> Self
pub fn with_email(self, email: &str) -> Self
Add an email field (schema.org/Organization or schema.org/Person).
Sourcepub fn with_telephone(self, telephone: &str) -> Self
pub fn with_telephone(self, telephone: &str) -> Self
Add a telephone field (schema.org/Organization or schema.org/Person).