Skip to main content

peasy_css/
types.rs

1use serde::Deserialize;
2
3#[derive(Debug, Deserialize)]
4pub struct PaginatedResponse<T> {
5    pub count: u32,
6    pub next: Option<String>,
7    pub previous: Option<String>,
8    pub results: Vec<T>,
9}
10
11#[derive(Debug, Deserialize)]
12pub struct Tool {
13    pub slug: String,
14    pub name: String,
15    pub description: String,
16    pub category: String,
17    #[serde(default)]
18    pub url: String,
19}
20
21#[derive(Debug, Deserialize)]
22pub struct Category {
23    pub slug: String,
24    pub name: String,
25    pub description: String,
26    pub tool_count: u32,
27}
28
29#[derive(Debug, Deserialize)]
30pub struct Format {
31    pub slug: String,
32    pub name: String,
33    pub extension: String,
34    pub mime_type: String,
35    pub category: String,
36    pub description: String,
37}
38
39#[derive(Debug, Deserialize)]
40pub struct Conversion {
41    pub source: String,
42    pub target: String,
43    pub description: String,
44    pub tool_slug: String,
45}
46
47#[derive(Debug, Deserialize)]
48pub struct GlossaryTerm {
49    pub slug: String,
50    pub term: String,
51    pub definition: String,
52    pub category: String,
53}
54
55#[derive(Debug, Deserialize)]
56pub struct Guide {
57    pub slug: String,
58    pub title: String,
59    pub description: String,
60    pub category: String,
61    pub audience_level: String,
62    pub word_count: u32,
63}
64
65#[derive(Debug, Deserialize)]
66pub struct UseCase {
67    pub slug: String,
68    pub title: String,
69    pub industry: String,
70}
71
72#[derive(Debug, Deserialize)]
73pub struct Site {
74    pub name: String,
75    pub domain: String,
76    pub url: String,
77}
78
79#[derive(Debug, Deserialize)]
80pub struct SearchResult {
81    pub query: String,
82    pub results: SearchCategories,
83}
84
85#[derive(Debug, Deserialize)]
86pub struct SearchCategories {
87    pub tools: Vec<Tool>,
88    pub formats: Vec<Format>,
89    pub glossary: Vec<GlossaryTerm>,
90}
91
92/// Options for paginated list requests.
93#[derive(Default)]
94pub struct ListOptions {
95    pub page: Option<u32>,
96    pub limit: Option<u32>,
97    pub category: Option<String>,
98    pub search: Option<String>,
99}
100
101/// Options for list_guides with audience level.
102#[derive(Default)]
103pub struct ListGuidesOptions {
104    pub page: Option<u32>,
105    pub limit: Option<u32>,
106    pub category: Option<String>,
107    pub audience_level: Option<String>,
108    pub search: Option<String>,
109}
110
111/// Options for list_conversions with source/target.
112#[derive(Default)]
113pub struct ListConversionsOptions {
114    pub page: Option<u32>,
115    pub limit: Option<u32>,
116    pub source: Option<String>,
117    pub target: Option<String>,
118}