Skip to content

Commit

Permalink
Adjust card entity
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Aug 13, 2023
1 parent 0f5953d commit 1671de4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/mastodon_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn streaming(url: &str, access_token: String) {
Some(access_token),
None,
);
let streaming = client.user_streaming(url.to_string());
let streaming = client.local_streaming(url.to_string());

streaming
.listen(Box::new(|message| match message {
Expand Down
6 changes: 4 additions & 2 deletions src/entities/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ pub struct Card {
pub image: Option<String>,
pub author_name: Option<String>,
pub author_url: Option<String>,
pub provider_name: Option<String>,
pub provider_url: Option<String>,
pub provider_name: String,
pub provider_url: String,
pub html: Option<String>,
pub width: Option<u32>,
pub height: Option<u32>,
pub embed_url: Option<String>,
pub blurhash: Option<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down
27 changes: 15 additions & 12 deletions src/friendica/entities/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ pub struct Card {
description: String,
r#type: CardType,
image: Option<String>,
author_name: Option<String>,
author_url: Option<String>,
provider_name: Option<String>,
provider_url: Option<String>,
html: Option<String>,
width: Option<u32>,
height: Option<u32>,
author_name: String,
author_url: String,
provider_name: String,
provider_url: String,
html: String,
width: u32,
height: u32,
blurhash: Option<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -45,13 +46,15 @@ impl Into<MegalodonEntities::Card> for Card {
description: self.description,
r#type: self.r#type.into(),
image: self.image,
author_name: self.author_name,
author_url: self.author_url,
author_name: Some(self.author_name),
author_url: Some(self.author_url),
provider_name: self.provider_name,
provider_url: self.provider_url,
html: self.html,
width: self.width,
height: self.height,
html: Some(self.html),
width: Some(self.width),
height: Some(self.height),
embed_url: None,
blurhash: self.blurhash,
}
}
}
28 changes: 16 additions & 12 deletions src/mastodon/entities/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ pub struct Card {
description: String,
r#type: CardType,
image: Option<String>,
author_name: Option<String>,
author_url: Option<String>,
provider_name: Option<String>,
provider_url: Option<String>,
html: Option<String>,
width: Option<u32>,
height: Option<u32>,
author_name: String,
author_url: String,
provider_name: String,
provider_url: String,
html: String,
width: u32,
height: u32,
embed_url: String,
blurhash: Option<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -45,13 +47,15 @@ impl Into<MegalodonEntities::Card> for Card {
description: self.description,
r#type: self.r#type.into(),
image: self.image,
author_name: self.author_name,
author_url: self.author_url,
author_name: Some(self.author_name),
author_url: Some(self.author_url),
provider_name: self.provider_name,
provider_url: self.provider_url,
html: self.html,
width: self.width,
height: self.height,
html: Some(self.html),
width: Some(self.width),
height: Some(self.height),
embed_url: Some(self.embed_url),
blurhash: self.blurhash,
}
}
}
21 changes: 9 additions & 12 deletions src/pleroma/entities/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ pub struct Card {
description: String,
r#type: CardType,
image: Option<String>,
author_name: Option<String>,
author_url: Option<String>,
provider_name: Option<String>,
provider_url: Option<String>,
html: Option<String>,
width: Option<u32>,
height: Option<u32>,
provider_name: String,
provider_url: String,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -45,13 +40,15 @@ impl Into<MegalodonEntities::Card> for Card {
description: self.description,
r#type: self.r#type.into(),
image: self.image,
author_name: self.author_name,
author_url: self.author_url,
author_name: None,
author_url: None,
provider_name: self.provider_name,
provider_url: self.provider_url,
html: self.html,
width: self.width,
height: self.height,
html: None,
width: None,
height: None,
embed_url: None,
blurhash: None,
}
}
}

0 comments on commit 1671de4

Please sign in to comment.