1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use http::Method;
use serde::Serialize;
use super::{endpoint::Endpoint, Direction};
#[derive(Debug, Clone, Serialize, Copy)]
pub enum NotificationsSorting {
Created,
}
#[derive(Default, Debug, Builder, Clone, Serialize)]
#[builder(default, setter(into, strip_option))]
#[serde(rename_all = "kebab-case")]
pub struct Notifications {
#[doc = r"Sorting options for results (default: Sorted by date)."]
orderby: Option<NotificationsSorting>,
#[doc = r"Sort direction. (default: descending)"]
direction: Option<Direction>,
}
impl Notifications {
pub fn builder() -> NotificationsBuilder {
NotificationsBuilder::default()
}
}
impl Default for NotificationsSorting {
fn default() -> Self {
Self::Created
}
}
impl Endpoint for Notifications {
fn method(&self) -> http::Method {
Method::GET
}
fn endpoint(&self) -> std::borrow::Cow<'static, str> {
"notifications".into()
}
fn query_parameters(&self) -> Result<std::borrow::Cow<'static, str>, super::error::BodyError> {
Ok(serde_urlencoded::to_string(self)?.into())
}
fn requires_authentication(&self) -> bool {
true
}
}