diff options
author | 2021-08-29 12:59:04 -0700 | |
---|---|---|
committer | 2021-08-29 12:59:04 -0700 | |
commit | 1c22088640e5deeadd61017bd90920b652685b5f (patch) | |
tree | 59d110a7c8792c39e0c1ea180fa972eee1c4662d /src/models/users.rs | |
parent | 8d5779a661f4537ef7d87a44bdfbf240eb054ff1 (diff) | |
download | notion-1c22088640e5deeadd61017bd90920b652685b5f.tar.gz notion-1c22088640e5deeadd61017bd90920b652685b5f.tar.zst notion-1c22088640e5deeadd61017bd90920b652685b5f.zip |
Notion API Version 2021-08-16 support; fix a bunch of modling errors as well
Diffstat (limited to 'src/models/users.rs')
-rw-r--r-- | src/models/users.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/models/users.rs b/src/models/users.rs new file mode 100644 index 0000000..b7702d0 --- /dev/null +++ b/src/models/users.rs @@ -0,0 +1,34 @@ +use crate::ids::UserId; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub struct UserCommon { + pub id: UserId, + pub name: Option<String>, + pub avatar_url: Option<String>, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub struct Person { + pub email: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub struct Bot { + pub email: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum User { + Person { + #[serde(flatten)] + common: UserCommon, + person: Person, + }, + Bot { + #[serde(flatten)] + common: UserCommon, + bot: Bot, + }, +} |