misskey_api/endpoint/notes/reactions/
create.rs

1use crate::model::{
2    id::Id,
3    note::{Note, Reaction},
4};
5
6use serde::Serialize;
7
8#[derive(Serialize, Debug, Clone)]
9#[serde(rename_all = "camelCase")]
10pub struct Request {
11    pub note_id: Id<Note>,
12    pub reaction: Reaction,
13}
14
15impl misskey_core::Request for Request {
16    type Response = ();
17    const ENDPOINT: &'static str = "notes/reactions/create";
18}
19
20#[cfg(test)]
21mod tests {
22    use super::Request;
23    use crate::test::{ClientExt, TestClient};
24
25    #[tokio::test]
26    async fn request() {
27        use crate::model::note::Reaction;
28
29        let client = TestClient::new();
30        let note = client.admin.create_note(Some("test"), None, None).await;
31
32        client
33            .user
34            .test(Request {
35                note_id: note.id,
36                reaction: Reaction("👍".to_string()),
37            })
38            .await;
39    }
40}