Skip to content

Commit

Permalink
added delete to folder endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
loki84nl committed May 13, 2024
1 parent cdc84a6 commit cca846d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@

- Added delete to client endpoint
- Added create to client endpoint

## [1.0.11] - 2024-05-13

- Added delete to folder endpoint

9 changes: 9 additions & 0 deletions docs/folder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ Create folder
$result = $client->folder->create($projectId, $folderName);
Delete folder
`````````````

.. code-block:: php
$folderId = 42;
$result = $client->folder->delete($folderId);
`Back to top <#top>`_
2 changes: 1 addition & 1 deletion src/Endpoint/Endpoints/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function list(int $folderId): ?array
*/
public function create(int $folderId, string $filename): ?array
{
return $this->client->post('/document/create', [
return $this->client->post('/document', [
'folder_id' => $folderId,
'filename' => basename($filename),
'content' => base64_encode(file_get_contents($filename))
Expand Down
12 changes: 11 additions & 1 deletion src/Endpoint/Endpoints/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ public function listByProjectId(int $projectId): ?array
*/
public function create(int $projectId, string $folderName): ?array
{
return $this->client->post('/folder/create', [
return $this->client->post('/folder', [
'project_id' => $projectId,
'folder_name' => $folderName
]);
}

/**
* @param int $folderId
*
* @return array|null
*/
public function delete(int $folderId): ?array
{
return $this->client->delete("/folder/$folderId");
}
}

0 comments on commit cca846d

Please sign in to comment.