Skip to content

Commit 3e57bed

Browse files
committed
moved methods into the corresponding new classes
1 parent 4bd2b99 commit 3e57bed

File tree

3 files changed

+64
-68
lines changed

3 files changed

+64
-68
lines changed

src/API.php

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -152,50 +152,6 @@ public function importPlaylist($url)
152152
]);
153153
}
154154

155-
/**
156-
* moveTrack
157-
*
158-
* @param string $trackUUID uuid of the track
159-
* @param string $parent subfolder UUID, empty value means root folder
160-
* @return array status
161-
*/
162-
public function moveTrack($trackUUID, $parent = "")
163-
{
164-
return $this->request('/bot/files/'.$trackUUID, 'PATCH', [
165-
"parent" => $parent,
166-
]);
167-
}
168-
169-
/**
170-
* editTrack
171-
*
172-
* @param string $trackUUID uuid of the track
173-
* @param string $title title
174-
* @param string $artist artist
175-
* @param string $album album
176-
* @return array status
177-
*/
178-
public function editTrack($trackUUID, $title, $artist = "", $album = "")
179-
{
180-
return $this->request('/bot/files/'.$trackUUID, 'PATCH', [
181-
"displayTitle" => $title,
182-
"title" => $title,
183-
"artist" => $artist,
184-
"album" => $album,
185-
]);
186-
}
187-
188-
/**
189-
* deleteTrack
190-
*
191-
* @param string $trackUUID track uuid
192-
* @return array status
193-
*/
194-
public function deleteTrack($trackUUID)
195-
{
196-
return $this->request('/bot/files/'.$trackUUID, 'DELETE');
197-
}
198-
199155
/**
200156
* addURL
201157
*
@@ -256,17 +212,6 @@ public function renameFolder($folderName, $folderUUID)
256212
]);
257213
}
258214

259-
/**
260-
* deleteFolder
261-
*
262-
* @param string $folderUUID uuid of the folder
263-
* @return array status
264-
*/
265-
public function deleteFolder($folderUUID)
266-
{
267-
return $this->deleteTrack($folderUUID);
268-
}
269-
270215
/**
271216
* getJobs
272217
*
@@ -444,18 +389,7 @@ public function getBotLog()
444389
{
445390
return $this->request('/bot/log');
446391
}
447-
448-
/**
449-
* getThumbnail
450-
*
451-
* @param string $thumbnail see getFiles()
452-
* @return string url
453-
*/
454-
public function getThumbnail($thumbnail)
455-
{
456-
return $this->url.'/cache/'.$thumbnail;
457-
}
458-
392+
459393
/**
460394
* __construct
461395
*

src/File.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,42 @@ public function getParent()
104104
public function delete()
105105
{
106106
return $this->request('/bot/files/'.$this->uuid, 'DELETE');
107+
108+
}
109+
110+
/**
111+
* getThumbnail
112+
*
113+
* @return string url
114+
*/
115+
public function getThumbnail()
116+
{
117+
return array_key_exists('thumbnail', $this->file)?$this->url.'/cache/'.$this->file["thumbnail"]:null;
118+
}
119+
120+
121+
/**
122+
* edit
123+
*
124+
* @param Array $options - keys: displayTitle, title, artist, album...
125+
* @return array status
126+
* @api
127+
*/
128+
public function edit($options)
129+
{
130+
return $this->request('/bot/files/'.$this->uuid, 'PATCH', $options);
131+
}
132+
133+
/**
134+
* move
135+
*
136+
* @param string $parent subfolder UUID, empty value means root folder
137+
* @return array status
138+
*/
139+
public function move($parent = "")
140+
{
141+
return $this->request('/bot/files/'.$this->uuid, 'PATCH', [
142+
"parent" => $parent,
143+
]);
107144
}
108145
}

src/Folder.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,31 @@ public function getChildren()
129129
*/
130130
public function delete()
131131
{
132-
return $this->request('/bot/folders/'.$this->uuid, 'DELETE');
132+
return $this->request('/bot/files/'.$this->uuid, 'DELETE');
133+
}
134+
135+
/**
136+
* edit
137+
*
138+
* @param Array $options - keys: displayTitle, title, artist, album...
139+
* @return array status
140+
* @api
141+
*/
142+
public function edit($options)
143+
{
144+
return $this->request('/bot/files/'.$this->uuid, 'PATCH', $options);
145+
}
146+
147+
/**
148+
* move
149+
*
150+
* @param string $parent subfolder UUID, empty value means root folder
151+
* @return array status
152+
*/
153+
public function move($parent = "")
154+
{
155+
return $this->request('/bot/files/'.$this->uuid, 'PATCH', [
156+
"parent" => $parent,
157+
]);
133158
}
134159
}

0 commit comments

Comments
 (0)