misskey_api/endpoint/notes/
clips.rs

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