ReviewOS

also looking at this

meemalabs/meema-client-php

Tags model

#14
Merged glennmichael123 wants to merge tags-model-2 into main
5 files +165 -74
src/Models/Folder.phpmodified+30-5
Changes to src/Models/Folder.php
@@ -71,8 +71,6 @@ class Folder
7171 {
7272 $response = $this->client->request('GET', "folders/${id}");
7373
74 $this->id = $response['data']['id'];
75
7674 return new Response($this, $response);
7775 }
7876
@@ -176,15 +174,16 @@ class Folder
176174 }
177175
178176 /**
179 * Add folder to media.
177 * Delete folder from media.
180178 *
181179 * @param int $id
180 * @param int $folderId
182181 *
183182 * @return null
184183 */
185 public function deleteFolderFromMedia($mediaId, $folderId)
184 public function deleteFolderFromMedia($id, $folderId)
186185 {
187 return $this->client->request('DELETE', "media/{$mediaId}/folders/{$folderId}");
186 return $this->client->request('DELETE', "media/{$id}/folders/{$folderId}");
188187 }
189188
190189 /**
@@ -201,6 +200,20 @@ class Folder
201200 return $this;
202201 }
203202
203 /**
204 * Initialize media model.
205 *
206 * @param Meema\MeemaApi\Models\Folder $folder
207 *
208 * @return self
209 */
210 public function setTag($tag): self
211 {
212 $this->model = $tag;
213
214 return $this;
215 }
216
204217 /**
205218 * Get the protected id.
206219 *
@@ -222,4 +235,16 @@ class Folder
222235
223236 return (new Media($this->client))->setFolder($this);
224237 }
238
239 /**
240 * Initialize the tags model.
241 *
242 * @return Meema\MeemaApi\Models\Tag
243 */
244 public function tags($id = null): Tag
245 {
246 $this->id = $id;
247
248 return (new Tag($this->client))->setFolder($this);
249 }
225250}