notion_sdk/database/relation.rs
1use crate::database::id::{DatabaseId, PropertyId};
2use crate::pages::id::PageId;
3use serde::{Deserialize, Serialize};
4
5/// Relation property value objects contain an array of page references within the relation property.
6/// A page reference is an object with an id property,
7/// with a string value (UUIDv4) corresponding to a page ID in another database.
8#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
9pub struct RelationValue {
10 pub id: PageId,
11}
12
13#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
14pub struct Relation {
15 /// The database this relation refers to.
16 /// New linked pages must belong to this database in order to be valid.
17 pub database_id: DatabaseId,
18 /// By default, relations are formed as two synced properties across databases:
19 /// if you make a change to one property, it updates the synced property at the same time.
20 /// `synced_property_name` refers to the name of the property in the related database.
21 pub synced_property_name: Option<String>,
22 /// By default, relations are formed as two synced properties across databases:
23 /// if you make a change to one property, it updates the synced property at the same time.
24 /// `synced_property_id` refers to the id of the property in the related database.
25 /// This is usually a short string of random letters and symbols.
26 pub synced_property_id: Option<PropertyId>,
27}