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