shared/api/endpoints/
category.rs1use super::ApiEndpoint;
2use crate::{
3 api::method::Method,
4 domain::category::{
5 CategoryResponse, CreateCategoryPath, CreateCategoryRequest, DeleteCategoryPath,
6 GetCategoryPath, GetCategoryRequest, NewCategoryResponse, UpdateCategoryPath,
7 UpdateCategoryRequest,
8 },
9 error::EmptyError,
10};
11
12pub struct Get;
17impl ApiEndpoint for Get {
18 type Path = GetCategoryPath;
19 type Req = GetCategoryRequest;
20 type Res = CategoryResponse;
21 type Err = EmptyError;
22 const METHOD: Method = Method::Get;
23}
24
25pub struct Create;
30impl ApiEndpoint for Create {
31 type Path = CreateCategoryPath;
32 type Req = CreateCategoryRequest;
33 type Res = NewCategoryResponse;
34 type Err = EmptyError;
35 const METHOD: Method = Method::Post;
36}
37
38pub struct Update;
43impl ApiEndpoint for Update {
44 type Path = UpdateCategoryPath;
45 type Req = UpdateCategoryRequest;
46 type Res = ();
47 type Err = EmptyError;
48 const METHOD: Method = Method::Patch;
49}
50
51pub struct Delete;
56impl ApiEndpoint for Delete {
57 type Path = DeleteCategoryPath;
58 type Req = ();
59 type Res = ();
60 type Err = EmptyError;
61 const METHOD: Method = Method::Delete;
62}