Skip to content

Commit

Permalink
refs #260 Handle empty response in dismiss notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Nov 18, 2024
1 parent ed2f6f0 commit 0af1c19
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/mastodon/mastodon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2719,23 +2719,32 @@ impl megalodon::Megalodon for Mastodon {
let params = HashMap::new();
let res = self
.client
.post::<()>("/api/v1/notifications/clear", &params, None)
.post::<Value>("/api/v1/notifications/clear", &params, None)
.await?;
Ok(res)
Ok(Response::<()>::new(
(),
res.status,
res.status_text,
res.header,
))
}

async fn dismiss_notification(&self, id: String) -> Result<Response<()>, Error> {
let params = HashMap::new();
let res = self
.client
.post::<()>(
.post::<Value>(
format!("/api/v1/notifications/{}/dismiss", id).as_str(),
&params,
None,
)
.await?;

Ok(res)
Ok(Response::<()>::new(
(),
res.status,
res.status_text,
res.header,
))
}

async fn read_notifications(
Expand Down

0 comments on commit 0af1c19

Please sign in to comment.