shared/api/endpoints/
user.rs1use super::ApiEndpoint;
2
3use crate::{
4 api::method::Method,
5 domain::{
6 session::NewSessionResponse,
7 user::{
8 ChangePasswordPath, ChangePasswordRequest, CreateUserPath, CreateUserRequest,
9 OtherUser, ResetEmailPath, ResetEmailRequest, ResetEmailResponse, ResetPasswordPath,
10 ResetPasswordRequest, UserBrowsePath, UserBrowseQuery, UserBrowseResponse,
11 UserDeletePath, UserLookupPath, UserLookupQuery, UserSearchPath, UserSearchQuery,
12 UserSearchResponse, VerifyEmailPath, VerifyEmailRequest, VerifyResetEmailPath,
13 VerifyResetEmailRequest,
14 },
15 },
16 error::EmptyError,
17};
18
19mod colors;
20mod fonts;
21mod profile;
22mod public_user;
23
24pub use colors::{
25 Create as CreateColor, Delete as DeleteColor, Get as GetColors, Update as UpdateColor,
26};
27
28pub use fonts::{
29 Create as CreateFont, Delete as DeleteFont, Get as GetFonts, Update as UpdateFont,
30};
31
32pub use profile::{
33 Create as CreateProfile, Get as Profile, Patch as PatchProfile, PatchProfileAdminData,
34};
35
36pub use public_user::{
37 BrowseFollowers, BrowseFollowing, BrowsePublicUser, BrowseUserJigs,
38 BrowseUserPlaylists as BrowsePlaylists, BrowseUserResources as BrowseResources, Follow,
39 Get as GetPublicUser, SearchPublicUser as Search, Unfollow,
40};
41
42pub struct Create;
53impl ApiEndpoint for Create {
54 type Req = CreateUserRequest;
55 type Res = ();
56 type Path = CreateUserPath;
57 type Err = EmptyError;
58 const METHOD: Method = Method::Post;
59}
60
61pub struct VerifyEmail;
89impl ApiEndpoint for VerifyEmail {
90 type Req = VerifyEmailRequest;
91 type Res = Option<NewSessionResponse>;
92 type Path = VerifyEmailPath;
93 type Err = EmptyError;
94 const METHOD: Method = Method::Post;
95}
96
97pub struct VerifyResetEmail;
99impl ApiEndpoint for VerifyResetEmail {
100 type Req = VerifyResetEmailRequest;
101 type Res = ();
102 type Path = VerifyResetEmailPath;
103 type Err = EmptyError;
104 const METHOD: Method = Method::Post;
105}
106
107pub struct ResetEmail;
116impl ApiEndpoint for ResetEmail {
117 type Req = ResetEmailRequest;
118 type Res = ResetEmailResponse;
119 type Path = ResetEmailPath;
120 type Err = EmptyError;
121 const METHOD: Method = Method::Patch;
122}
123
124pub struct ResetPassword;
132impl ApiEndpoint for ResetPassword {
133 type Req = ResetPasswordRequest;
134 type Res = ();
135 type Path = ResetPasswordPath;
136 type Err = EmptyError;
137 const METHOD: Method = Method::Post;
138}
139
140pub struct ChangePassword;
150impl ApiEndpoint for ChangePassword {
151 type Req = ChangePasswordRequest;
152 type Res = ();
153 type Path = ChangePasswordPath;
154 type Err = EmptyError;
155 const METHOD: Method = Method::Put;
156}
157
158pub struct UserLookup;
160impl ApiEndpoint for UserLookup {
161 type Req = UserLookupQuery;
162 type Res = OtherUser;
163 type Path = UserLookupPath;
164 type Err = EmptyError;
165 const METHOD: Method = Method::Get;
166}
167
168pub struct Delete;
170impl ApiEndpoint for Delete {
171 type Req = ();
172 type Res = ();
173 type Path = UserDeletePath;
174 type Err = EmptyError;
175 const METHOD: Method = Method::Delete;
176}
177
178pub struct Browse;
184impl ApiEndpoint for Browse {
185 type Req = UserBrowseQuery;
186 type Res = UserBrowseResponse;
187 type Path = UserBrowsePath;
188 type Err = EmptyError;
189 const METHOD: Method = Method::Get;
190}
191
192pub struct SearchUser;
198impl ApiEndpoint for SearchUser {
199 type Req = UserSearchQuery;
200 type Res = UserSearchResponse;
201 type Path = UserSearchPath;
202 type Err = EmptyError;
203 const METHOD: Method = Method::Get;
204}