oas-document · contact
Declared module signatures, types, configuration, and source documentation.
Source: oas/oas/oas-document/src/contact.rs. SHA-256: b9714c05319246fe83cf72c2d2e9e01665b90f703afe1b3dc4cf1030db576d86.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
contact::ContactEntry
A single contact entry in an entity's contact directory.
Each entry represents one reachable channel (phone, email, social profile, etc.) with its own visibility level for access control.
DHT Behavior
For entries where visibility is not public, the DHT-stored copy contains:
{
"id": "phone-1",
"entryType": "phone",
"label": "Support",
"visibility": "organization",
"available": true,
"value": null
}The actual value is only served via the authenticated
OASPrivateEndpointService.
Examples
use oas_document::contact::ContactEntry;
use oas_document::visibility::Visibility;
let phone = ContactEntry {
id: "phone-1".to_string(),
entry_type: "phone".to_string(),
value: "tel:+15551234567".to_string(),
label: Some("Primary".to_string()),
platform: None,
handle: None,
visibility: Visibility::Public,
verified: Some(true),
};
assert_eq!(phone.entry_type, "phone");#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContactEntry {
/// Fragment identifier (e.g., "phone-1", "email-2", "social-x").
pub id: String,
/// Entry type: `"phone"`, `"email"`, `"social"`, `"website"`, `"messaging"`.
pub entry_type: String,
/// The contact value. Format depends on type:
/// - phone: `tel:+15551234567`
/// - email: `mailto:agent@example.com`
/// - social: `https://x.com/agent`
/// - website: `https://example.com/agent`
/// - messaging: `https://t.me/agent_bot`
pub value: String,
/// Human-readable label (e.g., "Primary", "Support", "Sales", "Personal").
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
/// Platform name for social/messaging entries (e.g., "x", "linkedin",
/// "discord", "telegram", "github", "slack", "whatsapp", "signal").
#[serde(skip_serializing_if = "Option::is_none")]
pub platform: Option<String>,
/// Handle/username for social/messaging entries (e.g., "@agent42").
#[serde(skip_serializing_if = "Option::is_none")]
pub handle: Option<String>,
/// Who can see this entry's actual value.
/// Non-public entries show only the capability flag on the DHT.
#[serde(default)]
pub visibility: Visibility,
/// Whether this contact channel has been verified by the entity.
#[serde(skip_serializing_if = "Option::is_none")]
pub verified: Option<bool>
}Source line: 53.
contact::ContactSection
Contact directory section of an OAS Identity Document.
Contains all reachable channels for an entity, each with independent visibility controls.
Standard Entry Types
| Type | Value Format | Example |
|---|---|---|
phone | tel: URI (E.164) | tel:+15551234567 |
email | mailto: URI | mailto:agent@acme.com |
social | HTTPS URL to profile | https://x.com/agent42 |
website | HTTPS URL | https://acme.com/agent |
messaging | HTTPS URL or protocol-specific URI | https://t.me/agent_bot |
Examples
use oas_document::contact::{ContactSection, ContactEntry};
use oas_document::visibility::Visibility;
let contact = ContactSection {
entries: vec![
ContactEntry {
id: "email-1".to_string(),
entry_type: "email".to_string(),
value: "mailto:hello@agent.ai".to_string(),
label: Some("Primary".to_string()),
platform: None,
handle: None,
visibility: Visibility::Public,
verified: Some(true),
},
ContactEntry {
id: "social-x".to_string(),
entry_type: "social".to_string(),
value: "https://x.com/agent42".to_string(),
label: None,
platform: Some("x".to_string()),
handle: Some("@agent42".to_string()),
visibility: Visibility::Public,
verified: None,
},
],
};
assert_eq!(contact.entries.len(), 2);#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContactSection {
/// All contact entries for this entity.
pub entries: Vec<ContactEntry>
}Source line: 140.
contact::entry_types
Standard contact entry types.
pub mod entry_types;Source line: 146.
contact::entry_types::PHONE
Telephone number (value format: tel: URI).
pub const PHONE: &str;Source line: 148.
contact::entry_types::EMAIL
Email address (value format: mailto: URI).
pub const EMAIL: &str;Source line: 150.
contact::entry_types::SOCIAL
Social media profile (value: HTTPS URL).
pub const SOCIAL: &str;Source line: 152.
contact::entry_types::WEBSITE
Website (value: HTTPS URL).
pub const WEBSITE: &str;Source line: 154.
contact::entry_types::MESSAGING
Messaging endpoint (value: HTTPS URL or protocol-specific URI).
pub const MESSAGING: &str;Source line: 156.
contact::platforms
Standard social platform identifiers.
pub mod platforms;Source line: 160.
contact::platforms::X
pub const X: &str;Source line: 161.
contact::platforms::LINKEDIN
pub const LINKEDIN: &str;Source line: 162.
contact::platforms::GITHUB
pub const GITHUB: &str;Source line: 163.
contact::platforms::DISCORD
pub const DISCORD: &str;Source line: 164.
contact::platforms::TELEGRAM
pub const TELEGRAM: &str;Source line: 165.
contact::platforms::SLACK
pub const SLACK: &str;Source line: 166.
contact::platforms::WHATSAPP
pub const WHATSAPP: &str;Source line: 167.
contact::platforms::SIGNAL
pub const SIGNAL: &str;Source line: 168.
contact::platforms::MASTODON
pub const MASTODON: &str;Source line: 169.
contact::platforms::BLUESKY
pub const BLUESKY: &str;Source line: 170.
contact::platforms::YOUTUBE
pub const YOUTUBE: &str;Source line: 171.
contact::platforms::INSTAGRAM
pub const INSTAGRAM: &str;Source line: 172.
contact::platforms::TIKTOK
pub const TIKTOK: &str;Source line: 173.
contact::platforms::REDDIT
pub const REDDIT: &str;Source line: 174.