musicbrainz_rs/entity/annotation.rs
1use lucene_query_builder::QueryBuilder;
2use serde::{Deserialize, Serialize};
3
4/// Annotations are text fields, functioning like a miniature wiki, that can be added to any existing
5/// artists, labels, recordings, releases, release groups and works.
6/// Their purpose is to add information that usually doesn't fit into the strict structural data
7/// schema of MusicBrainz / (be it due to technical limitations that may be addressed later, or
8/// because the information in itself has to be free-text).
9/// The content of an annotation can be edited by any MusicBrainz user. Like the rest of the database,
10/// if something is incorrect or incomplete, you can fix it. All changes are recorded and if someone
11/// deletes or defaces the annotation, you can easily restore a previous copy.
12#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
13#[cfg_attr(
14 feature = "legacy_serialize",
15 serde(rename_all(deserialize = "kebab-case"))
16)]
17#[cfg_attr(not(feature = "legacy_serialize"), serde(rename_all = "kebab-case"))]
18pub struct Annotation {
19 /// the annotated entity's MBID
20 pub entity: String,
21 /// the annotated entity's name or title (diacritics are ignored)
22 pub name: String,
23 /// the annotation's content (includes wiki formatting)
24 pub text: String,
25 /// the annotated entity's entity type
26 #[serde(rename = "type")]
27 pub annotation_type: String,
28}
29
30#[derive(Debug, Default, Serialize, Deserialize, QueryBuilder)]
31pub struct AnnotationSearchQuery {
32 /// the annotated entity's MBID
33 pub entity: String,
34 /// the numeric ID of the annotation
35 pub id: String,
36 /// the annotated entity's name or title (diacritics are ignored)
37 pub name: String,
38 /// the annotation's content (includes wiki formatting)
39 pub text: String,
40 /// the annotated entity's entity type
41 #[query_builder_field = "type"]
42 pub annotation_type: String,
43}