shared/api/endpoints/user/
public_user.rs1use super::super::ApiEndpoint;
2use crate::{
3 api::Method,
4 domain::{
5 jig::JigBrowseResponse,
6 playlist::PlaylistBrowseResponse,
7 user::public_user::{
8 BrowsePublicUserFollowersPath, BrowsePublicUserFollowersQuery,
9 BrowsePublicUserFollowersResponse, BrowsePublicUserFollowingPath,
10 BrowsePublicUserFollowingResponse, BrowsePublicUserFollowingsQuery,
11 BrowsePublicUserJigsPath, BrowsePublicUserJigsQuery, BrowsePublicUserPlaylistsPath,
12 BrowsePublicUserPlaylistsQuery, BrowsePublicUserResourcesPath,
13 BrowsePublicUserResourcesQuery, BrowsePublicUserResourcesResponse,
14 BrowsePublicUserResponse, PublicUser, PublicUserBrowsePath, PublicUserFollowPath,
15 PublicUserGetPath, PublicUserSearchPath, PublicUserUnfollowPath, SearchPublicUserQuery,
16 SearchPublicUserResponse, UserBrowseQuery,
17 },
18 },
19 error::EmptyError,
20};
21
22pub struct Get;
24impl ApiEndpoint for Get {
25 type Req = ();
26 type Res = PublicUser;
27 type Path = PublicUserGetPath;
28 type Err = EmptyError;
29 const METHOD: Method = Method::Get;
30}
31
32pub struct BrowsePublicUser;
34impl ApiEndpoint for BrowsePublicUser {
35 type Req = UserBrowseQuery;
36 type Res = BrowsePublicUserResponse;
37 type Path = PublicUserBrowsePath;
38 type Err = EmptyError;
39 const METHOD: Method = Method::Get;
40}
41
42pub struct SearchPublicUser;
44impl ApiEndpoint for SearchPublicUser {
45 type Req = SearchPublicUserQuery;
46 type Res = SearchPublicUserResponse;
47 type Path = PublicUserSearchPath;
48 type Err = EmptyError;
49 const METHOD: Method = Method::Get;
50}
51
52pub struct BrowseUserJigs;
54impl ApiEndpoint for BrowseUserJigs {
55 type Req = BrowsePublicUserJigsQuery;
56 type Res = JigBrowseResponse;
57 type Path = BrowsePublicUserJigsPath;
58 type Err = EmptyError;
59 const METHOD: Method = Method::Get;
60}
61
62pub struct BrowseUserResources;
64impl ApiEndpoint for BrowseUserResources {
65 type Req = BrowsePublicUserResourcesQuery;
66 type Res = BrowsePublicUserResourcesResponse;
67 type Path = BrowsePublicUserResourcesPath;
68 type Err = EmptyError;
69 const METHOD: Method = Method::Get;
70}
71
72pub struct BrowseUserPlaylists;
74impl ApiEndpoint for BrowseUserPlaylists {
75 type Req = BrowsePublicUserPlaylistsQuery;
76 type Res = PlaylistBrowseResponse;
77 type Path = BrowsePublicUserPlaylistsPath;
78 type Err = EmptyError;
79 const METHOD: Method = Method::Get;
80}
81
82pub struct BrowseFollowers;
84impl ApiEndpoint for BrowseFollowers {
85 type Req = BrowsePublicUserFollowersQuery;
86 type Res = BrowsePublicUserFollowersResponse;
87 type Path = BrowsePublicUserFollowersPath;
88 type Err = EmptyError;
89 const METHOD: Method = Method::Get;
90}
91
92pub struct BrowseFollowing;
94impl ApiEndpoint for BrowseFollowing {
95 type Req = BrowsePublicUserFollowingsQuery;
96 type Res = BrowsePublicUserFollowingResponse;
97 type Path = BrowsePublicUserFollowingPath;
98 type Err = EmptyError;
99 const METHOD: Method = Method::Get;
100}
101
102pub struct Follow;
104impl ApiEndpoint for Follow {
105 type Req = ();
106 type Res = ();
107 type Path = PublicUserFollowPath;
108 type Err = EmptyError;
109 const METHOD: Method = Method::Post;
110}
111
112pub struct Unfollow;
114impl ApiEndpoint for Unfollow {
115 type Req = ();
116 type Res = ();
117 type Path = PublicUserUnfollowPath;
118 type Err = EmptyError;
119 const METHOD: Method = Method::Delete;
120}