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
#![forbid(unsafe_code)]
#![warn(clippy::pedantic)]
#[cfg(feature = "actix_web")]
pub mod actix_web;
#[cfg(feature = "hyper")]
pub mod hyper;
pub mod responses;
pub mod typed;
#[cfg(feature = "jsonschema")]
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "jsonschema", derive(JsonSchema))]
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ListOptions {
pub offset: Option<u64>,
pub limit: Option<u64>,
pub order: Option<ListOrder>,
pub sort: Option<String>,
}
impl Default for ListOptions {
#[must_use]
fn default() -> Self {
Self { offset: None, limit: Some(100), order: None, sort: None }
}
}
#[cfg_attr(feature = "jsonschema", derive(JsonSchema))]
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum ListOrder {
#[serde(alias = "ASC", alias = "asc")]
Asc,
#[serde(alias = "DESC", alias = "desc")]
Desc,
}