apple_search_ads/objects/
sorting.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Serialize, Deserialize, Debug, Clone)]
7pub struct Sorting {
8 pub field: Box<str>,
9
10 #[serde(rename = "sortOrder")]
11 pub sort_order: SortingSortOrder,
12}
13
14impl Default for Sorting {
15 fn default() -> Self {
16 Self::new("localSpend", SortingSortOrder::DESCENDING)
17 }
18}
19
20impl Sorting {
21 pub fn new(field: impl AsRef<str>, sort_order: SortingSortOrder) -> Self {
22 Self {
23 field: field.as_ref().into(),
24 sort_order,
25 }
26 }
27}
28
29#[derive(Serialize, Deserialize, Debug, Clone)]
30pub enum SortingSortOrder {
31 #[allow(clippy::upper_case_acronyms)]
32 ASCENDING,
33 #[allow(clippy::upper_case_acronyms)]
34 DESCENDING,
35}