1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Attachments and external identifiers, shared across domains.
use super::macros::tmf_struct;
use super::value::{Quantity, TimePeriod};
tmf_struct! {
@name = "Attachment", @ref = "AttachmentRef";
/// A file or document attached to an entity, either inline or by URL.
///
/// The v5 schemas type this member as `AttachmentRefOrValue`, a `oneOf`
/// over the full attachment and a bare reference to one. Both arms are
/// structurally a subset of this type, so one Rust struct covers them:
/// `id`/`href` alone is the reference form.
///
/// `attachmentType` and `mimeType` are required by the *create* schema and
/// optional on the base — nested types follow the base, so both are
/// [`Option`] here. See [`crate::core`] for why that rule exists.
pub struct Attachment {
/// Unique identifier of the attachment.
id: String,
/// URI of the attachment.
href: String,
/// Friendly name.
name: String,
/// Narrative describing the attachment.
description: String,
/// Kind of attachment, e.g. `video`, `picture`.
attachment_type: String,
/// The attachment MIME type.
mime_type: String,
/// URL where the attachment can be retrieved.
url: String,
/// Inline base64-encoded content.
content: String,
/// Size of the attachment.
size: Quantity,
/// Period during which the attachment is valid.
valid_for: TimePeriod,
@renamed {
/// The concrete class of the attachment, when this is the reference
/// form: `AttachmentRefOrValue` is a `oneOf` over the whole
/// attachment and a bare reference to one, and only the reference
/// carries a `@referredType`.
"@referredType" referred_type: String,
}
}
}
tmf_struct! {
@name = "ExternalIdentifier";
/// An identifier for the entity in an external system.
pub struct ExternalIdentifier {
/// The identifier in the external system.
id: String,
/// The system that owns the identifier.
owner: String,
/// The kind of external identifier.
external_identifier_type: String,
}
}