Add ID type for relationships

This commit is contained in:
D. Scott Boggs 2023-01-09 07:53:58 -05:00 committed by Scott Boggs
parent f4ef3c27ab
commit d4e7c4b59b
1 changed files with 12 additions and 1 deletions

View File

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct Relationship { pub struct Relationship {
/// Target account id /// Target account id
pub id: String, pub id: RelationshipId,
/// Whether the application client follows the account. /// Whether the application client follows the account.
pub following: bool, pub following: bool,
/// Whether the account follows the application client. /// Whether the account follows the application client.
@ -31,3 +31,14 @@ pub struct Relationship {
/// making calls to pleroma or mastodon<2.5.0 instances /// making calls to pleroma or mastodon<2.5.0 instances
pub endorsed: Option<bool>, pub endorsed: Option<bool>,
} }
/// Wrapper type for a relationship ID string
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(transparent)]
pub struct RelationshipId(String);
impl AsRef<str> for RelationshipId {
fn as_ref(&self) -> &str {
&self.0
}
}