shared/api/endpoints/
jig.rs1use crate::{
2 api::Method,
3 domain::{
4 jig::{
5 GetJigPlaylistsPath, GetJigPlaylistsResponse, JigAdminDataUpdatePath,
6 JigAdminTransferRequest, JigBrowsePath, JigBrowseQuery, JigBrowseResponse,
7 JigClonePath, JigCountPath, JigCountResponse, JigCoverPath, JigCreatePath,
8 JigCreateRequest, JigDeleteAllPath, JigDeletePath, JigFeaturedPath,
9 JigFeaturedResponse, JigFeaturedUpdateRequest, JigGetDraftPath, JigGetLivePath, JigId,
10 JigLikePath, JigLikedPath, JigLikedResponse, JigPlayPath, JigPublishPath, JigResponse,
11 JigSearchPath, JigSearchQuery, JigSearchResponse, JigTransferAdminPath,
12 JigTrendingPath, JigTrendingResponse, JigUnlikePath, JigUpdateAdminDataRequest,
13 JigUpdateDraftDataPath, JigUpdateDraftDataRequest, ListLikedPath, ListLikedRequest,
14 ListLikedResponse, ListPlayedPath, ListPlayedRequest, ListPlayedResponse,
15 },
16 CreateResponse,
17 },
18 error::{EmptyError, MetadataNotFound},
19};
20
21use super::ApiEndpoint;
22
23pub mod codes;
25
26pub mod curation;
28
29pub mod report;
31
32pub struct Create;
47impl ApiEndpoint for Create {
48 type Req = JigCreateRequest;
49 type Res = CreateResponse<JigId>;
50 type Path = JigCreatePath;
51 type Err = MetadataNotFound;
52 const METHOD: Method = Method::Post;
53}
54
55pub struct GetLive;
63impl ApiEndpoint for GetLive {
64 type Req = ();
65 type Res = JigResponse;
66 type Path = JigGetLivePath;
67 type Err = EmptyError;
68 const METHOD: Method = Method::Get;
69}
70
71pub struct GetDraft;
80impl ApiEndpoint for GetDraft {
81 type Req = ();
82 type Res = JigResponse;
83 type Path = JigGetDraftPath;
84 type Err = EmptyError;
85 const METHOD: Method = Method::Get;
86}
87
88pub struct UpdateDraftData;
100impl ApiEndpoint for UpdateDraftData {
101 type Req = JigUpdateDraftDataRequest;
102 type Res = ();
103 type Path = JigUpdateDraftDataPath;
104 type Err = MetadataNotFound;
105 const METHOD: Method = Method::Patch;
106}
107
108pub struct Publish;
113impl ApiEndpoint for Publish {
114 type Req = ();
115 type Res = ();
116 type Path = JigPublishPath;
117 type Err = EmptyError;
118 const METHOD: Method = Method::Put;
119}
120
121pub struct Browse;
127impl ApiEndpoint for Browse {
128 type Req = JigBrowseQuery;
129 type Res = JigBrowseResponse;
130 type Path = JigBrowsePath;
131 type Err = EmptyError;
132 const METHOD: Method = Method::Get;
133}
134
135pub struct Search;
140impl ApiEndpoint for Search {
141 type Req = JigSearchQuery;
142 type Res = JigSearchResponse;
143 type Path = JigSearchPath;
144 type Err = EmptyError;
145 const METHOD: Method = Method::Get;
146}
147
148pub struct Trending;
150impl ApiEndpoint for Trending {
151 type Req = ();
152 type Res = JigTrendingResponse;
153 type Path = JigTrendingPath;
154 type Err = EmptyError;
155 const METHOD: Method = Method::Get;
156}
157
158pub struct ListLiked;
160impl ApiEndpoint for ListLiked {
161 type Req = ListLikedRequest;
162 type Res = ListLikedResponse;
163 type Path = ListLikedPath;
164 type Err = EmptyError;
165 const METHOD: Method = Method::Get;
166}
167
168pub struct ListPlayed;
170impl ApiEndpoint for ListPlayed {
171 type Req = ListPlayedRequest;
172 type Res = ListPlayedResponse;
173 type Path = ListPlayedPath;
174 type Err = EmptyError;
175 const METHOD: Method = Method::Get;
176}
177
178pub struct Featured;
180impl ApiEndpoint for Featured {
181 type Req = ();
182 type Res = JigFeaturedResponse;
183 type Path = JigFeaturedPath;
184 type Err = EmptyError;
185 const METHOD: Method = Method::Get;
186}
187
188pub struct FeaturedUpdate;
190impl ApiEndpoint for FeaturedUpdate {
191 type Req = JigFeaturedUpdateRequest;
192 type Res = ();
193 type Path = JigFeaturedPath;
194 type Err = EmptyError;
195 const METHOD: Method = Method::Put;
196}
197
198pub struct Clone;
209impl ApiEndpoint for Clone {
210 type Req = ();
211 type Res = CreateResponse<JigId>;
212 type Path = JigClonePath;
213 type Err = EmptyError;
214 const METHOD: Method = Method::Post;
215}
216
217pub struct Delete;
222impl ApiEndpoint for Delete {
223 type Req = ();
224 type Res = ();
225 type Path = JigDeletePath;
226 type Err = EmptyError;
227 const METHOD: Method = Method::Delete;
228}
229
230pub struct DeleteAll;
235impl ApiEndpoint for DeleteAll {
236 type Req = ();
237 type Res = ();
238 type Path = JigDeleteAllPath;
239 type Err = EmptyError;
240 const METHOD: Method = Method::Delete;
241}
242
243pub struct Cover;
248impl ApiEndpoint for Cover {
249 type Req = ();
250 type Res = ();
251 type Path = JigCoverPath;
252 type Err = EmptyError;
253 const METHOD: Method = Method::Patch;
254}
255
256pub struct Count;
261impl ApiEndpoint for Count {
262 type Req = ();
263 type Res = JigCountResponse;
264 type Path = JigCountPath;
265 type Err = EmptyError;
266 const METHOD: Method = Method::Get;
267}
268
269pub struct Like;
274impl ApiEndpoint for Like {
275 type Req = ();
276 type Res = ();
277 type Path = JigLikePath;
278 type Err = EmptyError;
279 const METHOD: Method = Method::Put;
280}
281
282pub struct Unlike;
287impl ApiEndpoint for Unlike {
288 type Req = ();
289 type Res = ();
290 type Path = JigUnlikePath;
291 type Err = EmptyError;
292 const METHOD: Method = Method::Delete;
293}
294
295pub struct Liked;
300impl ApiEndpoint for Liked {
301 type Req = ();
302 type Res = JigLikedResponse;
303 type Path = JigLikedPath;
304 type Err = EmptyError;
305 const METHOD: Method = Method::Get;
306}
307
308pub struct Play;
313impl ApiEndpoint for Play {
314 type Req = ();
315 type Res = ();
316 type Path = JigPlayPath;
317 type Err = EmptyError;
318 const METHOD: Method = Method::Put;
319}
320
321pub struct JigAdminDataUpdate;
333impl ApiEndpoint for JigAdminDataUpdate {
334 type Req = JigUpdateAdminDataRequest;
335 type Res = ();
336 type Path = JigAdminDataUpdatePath;
337 type Err = EmptyError;
338 const METHOD: Method = Method::Patch;
339}
340
341pub struct JigAdminTransfer;
353impl ApiEndpoint for JigAdminTransfer {
354 type Req = JigAdminTransferRequest;
355 type Res = ();
356 type Path = JigTransferAdminPath;
357 type Err = EmptyError;
358 const METHOD: Method = Method::Post;
359}
360
361pub struct RemoveResource;
369impl ApiEndpoint for RemoveResource {
370 type Path = RemoveResourcePath;
371 type Req = ();
372 type Res = ();
373 type Err = EmptyError;
374 const METHOD: Method = Method::Delete;
375}
376use crate::api::endpoints::PathPart;
377macros::make_path_parts!(RemoveResourcePath => "/v1/jig/{}/resources" => JigId);
378
379pub struct GetJigPlaylists;
385impl ApiEndpoint for GetJigPlaylists {
386 type Req = ();
387 type Res = GetJigPlaylistsResponse;
388 type Path = GetJigPlaylistsPath;
389 type Err = EmptyError;
390 const METHOD: Method = Method::Get;
391}