misskey_api/endpoint/notes/
state.rs

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