@@ -9,4 +9,143 @@ This project aims to create not just a music player but a universal music search
99### Database schema
1010<img width =" 546 " height =" 467 " alt =" image " src =" https://github.com/user-attachments/assets/b1f3813b-997b-4423-84d8-886970106500 " />
1111
12+ # MusicBoxApi API
13+ ## Version: 1.0
1214
15+
16+ ### /api/v1/download: sourceId
17+
18+ #### GET
19+ ##### Description:
20+
21+ Enables playback for song/file using http 206 partial content
22+
23+ ##### Parameters
24+
25+ | Name | Located in | Description | Required | Schema |
26+ | ---- | ---------- | ----------- | -------- | ---- |
27+ | download | body | message/rfc8259 see models.DownloadRequestModel | Yes | string |
28+
29+ ##### Responses
30+
31+ | Code | Description | Schema |
32+ | ---- | ----------- | ------ |
33+ | 0 | | [ models.DownloadRequestModel] ( #models.DownloadRequestModel ) |
34+ | 200 | serve song/file with range request (http 206) | |
35+ | 500 | Internal Server Error | [ models.ApiResponseModel] ( #models.ApiResponseModel ) |
36+
37+ ### /api/v1/play/: sourceId
38+
39+ #### GET
40+ ##### Description:
41+
42+ Enables playback for song/file using http 206 partial content
43+
44+ ##### Parameters
45+
46+ | Name | Located in | Description | Required | Schema |
47+ | ---- | ---------- | ----------- | -------- | ---- |
48+ | sourceId | path | Id of song/file to serve using http 206 partial content | Yes | string |
49+
50+ ##### Responses
51+
52+ | Code | Description | Schema |
53+ | ---- | ----------- | ------ |
54+ | 200 | serve song/file with range request (http 206) | |
55+ | 500 | Internal Server Error | [ models.ApiResponseModel] ( #models.ApiResponseModel ) |
56+
57+ ### /api/v1/playlist
58+
59+ #### GET
60+ ##### Description:
61+
62+ Returns data for all playlist, if lastKnowPlaylistId then only the playlist after lastKnowPlaylistId
63+
64+ ##### Parameters
65+
66+ | Name | Located in | Description | Required | Schema |
67+ | ---- | ---------- | ----------- | -------- | ---- |
68+ | lastKnowPlaylistId | path | Last know playlist id by the client, default is 0 | No | integer |
69+
70+ ##### Responses
71+
72+ | Code | Description | Schema |
73+ | ---- | ----------- | ------ |
74+ | 200 | OK | [ models.Playlist] ( #models.Playlist ) |
75+ | 500 | Internal Server Error | [ models.ApiResponseModel] ( #models.ApiResponseModel ) |
76+
77+ ### /api/v1/playlist/: playlistId
78+
79+ #### GET
80+ ##### Description:
81+
82+ Returns data for a playlist, if lastKnowSongPosition then only songs added after lastKnowSongPosition
83+
84+ ##### Parameters
85+
86+ | Name | Located in | Description | Required | Schema |
87+ | ---- | ---------- | ----------- | -------- | ---- |
88+ | playlistId | path | Id of playlist | Yes | integer |
89+ | lastKnowSongPosition | path | Last song that is know by the client, pass this in to only get the latest songs | No | integer |
90+
91+ ##### Responses
92+
93+ | Code | Description | Schema |
94+ | ---- | ----------- | ------ |
95+ | 200 | OK | [ models.Song] ( #models.Song ) |
96+ | 500 | Internal Server Error | [ models.ApiResponseModel] ( #models.ApiResponseModel ) |
97+
98+ ### /api/v1/songs
99+
100+ #### GET
101+ ##### Description:
102+
103+ Returns data for all songs
104+
105+ ##### Responses
106+
107+ | Code | Description | Schema |
108+ | ---- | ----------- | ------ |
109+ | 200 | OK | [ models.Song] ( #models.Song ) |
110+ | 500 | Internal Server Error | [ models.ApiResponseModel] ( #models.ApiResponseModel ) |
111+
112+ ### Models
113+
114+
115+ #### models.ApiResponseModel
116+
117+ | Name | Type | Description | Required |
118+ | ---- | ---- | ----------- | -------- |
119+ | data | | | No |
120+ | message | string | | No |
121+
122+ #### models.DownloadRequestModel
123+
124+ | Name | Type | Description | Required |
125+ | ---- | ---- | ----------- | -------- |
126+ | url | string | | No |
127+
128+ #### models.Playlist
129+
130+ | Name | Type | Description | Required |
131+ | ---- | ---- | ----------- | -------- |
132+ | creationDate | string | | No |
133+ | description | string | | No |
134+ | id | integer | | No |
135+ | isPublic | boolean | | No |
136+ | name | string | | No |
137+ | thumbnailPath | string | | No |
138+ | updatedAt | string | | No |
139+
140+ #### models.Song
141+
142+ | Name | Type | Description | Required |
143+ | ---- | ---- | ----------- | -------- |
144+ | created_at | string | | No |
145+ | duration | integer | | No |
146+ | id | integer | | No |
147+ | name | string | | No |
148+ | path | string | | No |
149+ | source_id | string | | No |
150+ | thumbnail_path | string | | No |
151+ | updated_at | string | | No |
0 commit comments