shared/api/endpoints/
locale.rs

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/// Entry endpoints
pub mod entry {
    use crate::{
        api::{endpoints::ApiEndpoint, Method},
        domain::locale::{
            CreateEntryPath, CreateEntryRequest, CreateEntryResponse, DeleteEntryPath,
            GetEntryPath, GetEntryResponse, ListEntryPath, ListEntryQuery, ListEntryResponse,
            UpdateEntryPath, UpdateEntryRequest,
        },
        error::EmptyError,
    };

    /// Create an [`Entry`](crate::domain::locale::Entry)
    pub struct Create;
    impl ApiEndpoint for Create {
        type Req = CreateEntryRequest;
        type Res = CreateEntryResponse;
        type Path = CreateEntryPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Post;
    }

    /// List entries
    pub struct List;
    impl ApiEndpoint for List {
        type Req = ListEntryQuery;
        type Res = ListEntryResponse;
        type Path = ListEntryPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Get;
    }

    /// Get an individual [`Entry`](crate::domain::locale::Entry) by id
    pub struct Get;
    impl ApiEndpoint for Get {
        type Req = ();
        type Res = GetEntryResponse;
        type Path = GetEntryPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Get;
    }

    /// Update an [`Entry`](crate::domain::locale::Entry)
    pub struct Update;
    impl ApiEndpoint for Update {
        type Req = UpdateEntryRequest;
        type Res = ();
        type Path = UpdateEntryPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Patch;
    }

    /// Delete an [`Entry`](crate::domain::locale::Entry)
    pub struct Delete;
    impl ApiEndpoint for Delete {
        type Req = ();
        type Res = ();
        type Path = DeleteEntryPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Delete;
    }
}

/// [`ItemKind`](crate::domain::locale::ItemKind) endpoints
pub mod item_kind {
    use crate::{
        api::{endpoints::ApiEndpoint, Method},
        domain::locale::{ListItemKindPath, ListItemKindResponse},
        error::EmptyError,
    };

    /// List [`ItemKind`](crate::domain::locale::ItemKind)s
    pub struct List;
    impl ApiEndpoint for List {
        type Req = ();
        type Res = ListItemKindResponse;
        type Path = ListItemKindPath;
        type Err = EmptyError;
        const METHOD: Method = Method::Get;
    }
}

/// [`Bundle`](crate::domain::locale::Bundle) endpoints
pub mod bundle {
    use crate::{
        api::{endpoints::ApiEndpoint, Method},
        domain::locale::{ListBundlePath, ListBundleResponse},
        error::EmptyError,
    };

    /// List [`Bundle`](crate::domain::locale::Bundle)s
    pub struct List;
    impl ApiEndpoint for List {
        type Req = ();
        type Res = ListBundleResponse;
        type Path = ListBundlePath;
        type Err = EmptyError;
        const METHOD: Method = Method::Get;
    }
}