shared/api/endpoints/
locale.rs

1/// Entry endpoints
2pub mod entry {
3    use crate::{
4        api::{endpoints::ApiEndpoint, Method},
5        domain::locale::{
6            CreateEntryPath, CreateEntryRequest, CreateEntryResponse, DeleteEntryPath,
7            GetEntryPath, GetEntryResponse, ListEntryPath, ListEntryQuery, ListEntryResponse,
8            UpdateEntryPath, UpdateEntryRequest,
9        },
10        error::EmptyError,
11    };
12
13    /// Create an [`Entry`](crate::domain::locale::Entry)
14    pub struct Create;
15    impl ApiEndpoint for Create {
16        type Req = CreateEntryRequest;
17        type Res = CreateEntryResponse;
18        type Path = CreateEntryPath;
19        type Err = EmptyError;
20        const METHOD: Method = Method::Post;
21    }
22
23    /// List entries
24    pub struct List;
25    impl ApiEndpoint for List {
26        type Req = ListEntryQuery;
27        type Res = ListEntryResponse;
28        type Path = ListEntryPath;
29        type Err = EmptyError;
30        const METHOD: Method = Method::Get;
31    }
32
33    /// Get an individual [`Entry`](crate::domain::locale::Entry) by id
34    pub struct Get;
35    impl ApiEndpoint for Get {
36        type Req = ();
37        type Res = GetEntryResponse;
38        type Path = GetEntryPath;
39        type Err = EmptyError;
40        const METHOD: Method = Method::Get;
41    }
42
43    /// Update an [`Entry`](crate::domain::locale::Entry)
44    pub struct Update;
45    impl ApiEndpoint for Update {
46        type Req = UpdateEntryRequest;
47        type Res = ();
48        type Path = UpdateEntryPath;
49        type Err = EmptyError;
50        const METHOD: Method = Method::Patch;
51    }
52
53    /// Delete an [`Entry`](crate::domain::locale::Entry)
54    pub struct Delete;
55    impl ApiEndpoint for Delete {
56        type Req = ();
57        type Res = ();
58        type Path = DeleteEntryPath;
59        type Err = EmptyError;
60        const METHOD: Method = Method::Delete;
61    }
62}
63
64/// [`ItemKind`](crate::domain::locale::ItemKind) endpoints
65pub mod item_kind {
66    use crate::{
67        api::{endpoints::ApiEndpoint, Method},
68        domain::locale::{ListItemKindPath, ListItemKindResponse},
69        error::EmptyError,
70    };
71
72    /// List [`ItemKind`](crate::domain::locale::ItemKind)s
73    pub struct List;
74    impl ApiEndpoint for List {
75        type Req = ();
76        type Res = ListItemKindResponse;
77        type Path = ListItemKindPath;
78        type Err = EmptyError;
79        const METHOD: Method = Method::Get;
80    }
81}
82
83/// [`Bundle`](crate::domain::locale::Bundle) endpoints
84pub mod bundle {
85    use crate::{
86        api::{endpoints::ApiEndpoint, Method},
87        domain::locale::{ListBundlePath, ListBundleResponse},
88        error::EmptyError,
89    };
90
91    /// List [`Bundle`](crate::domain::locale::Bundle)s
92    pub struct List;
93    impl ApiEndpoint for List {
94        type Req = ();
95        type Res = ListBundleResponse;
96        type Path = ListBundlePath;
97        type Err = EmptyError;
98        const METHOD: Method = Method::Get;
99    }
100}