shared/api/endpoints/user/
colors.rs

1use super::ApiEndpoint;
2
3use crate::{
4    api::method::Method,
5    domain::user::{
6        UserColorCreatePath, UserColorDeletePath, UserColorGetPath, UserColorResponse,
7        UserColorUpdatePath, UserColorValueRequest,
8    },
9    error::EmptyError,
10};
11
12/// Create a user color.
13///
14/// Appends the color to the user's list of colors.
15pub struct Create;
16impl ApiEndpoint for Create {
17    type Req = UserColorValueRequest;
18    type Res = UserColorResponse;
19    type Path = UserColorCreatePath;
20    type Err = EmptyError;
21    const METHOD: Method = Method::Post;
22}
23
24/// Get colors for the user.
25pub struct Get;
26impl ApiEndpoint for Get {
27    type Req = ();
28    type Res = UserColorResponse;
29    type Path = UserColorGetPath;
30    type Err = EmptyError;
31    const METHOD: Method = Method::Get;
32}
33
34/// Update a user color.
35pub struct Update;
36impl ApiEndpoint for Update {
37    type Req = UserColorValueRequest;
38    type Res = ();
39    type Path = UserColorUpdatePath;
40    type Err = EmptyError;
41    const METHOD: Method = Method::Patch;
42}
43
44/// Delete a user color.
45pub struct Delete;
46impl ApiEndpoint for Delete {
47    type Req = ();
48    type Res = ();
49    type Path = UserColorDeletePath;
50    type Err = EmptyError;
51    const METHOD: Method = Method::Delete;
52}