misskey_api/endpoint/notes/
featured.rs

1use crate::model::note::Note;
2
3use serde::Serialize;
4
5#[derive(Serialize, Default, Debug, Clone)]
6#[serde(rename_all = "camelCase")]
7pub struct Request {
8    #[serde(skip_serializing_if = "Option::is_none")]
9    pub offset: Option<u64>,
10    /// 1 .. 100
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub limit: Option<u8>,
13}
14
15impl misskey_core::Request for Request {
16    type Response = Vec<Note>;
17    const ENDPOINT: &'static str = "notes/featured";
18}
19
20impl_offset_pagination!(Request, Note);
21
22#[cfg(test)]
23mod tests {
24    use super::Request;
25    use crate::test::{ClientExt, TestClient};
26
27    #[tokio::test]
28    async fn request() {
29        let client = TestClient::new();
30        client.test(Request::default()).await;
31    }
32
33    #[tokio::test]
34    async fn request_with_offset() {
35        let client = TestClient::new();
36        client
37            .test(Request {
38                offset: Some(5),
39                limit: None,
40            })
41            .await;
42    }
43
44    #[tokio::test]
45    async fn request_with_limit() {
46        let client = TestClient::new();
47        client
48            .test(Request {
49                offset: None,
50                limit: Some(100),
51            })
52            .await;
53    }
54}