From a8e2d58d11ff7e3f3a8af4d8a96146d52ea7c467 Mon Sep 17 00:00:00 2001 From: David Carr Date: Thu, 14 Nov 2024 02:33:14 +0000 Subject: [PATCH 1/2] corrected return types --- src/Resources/Contacts.php | 2 +- src/Resources/Files.php | 5 +++-- src/Resources/Tasks/TaskLists.php | 10 +++++----- src/Resources/Tasks/Tasks.php | 8 ++++---- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Resources/Contacts.php b/src/Resources/Contacts.php index 95dc72e..09ca7dd 100644 --- a/src/Resources/Contacts.php +++ b/src/Resources/Contacts.php @@ -40,7 +40,7 @@ public function update(string $id, array $data): array return MsGraph::patch("me/contacts/$id", $data); } - public function delete(string $id): array + public function delete(string $id): string { return MsGraph::delete("me/contacts/$id"); } diff --git a/src/Resources/Files.php b/src/Resources/Files.php index 9347876..87c0aa8 100644 --- a/src/Resources/Files.php +++ b/src/Resources/Files.php @@ -42,12 +42,12 @@ public function downloadFile(string $id, string $type = 'me'): object return redirect()->away($id['@microsoft.graph.downloadUrl']); } - public function deleteFile(string $id, string $type = 'me'): array + public function deleteFile(string $id, string $type = 'me'): string { return MsGraph::delete($type."/drive/items/$id"); } - public function createFolder(string $name, string $path, string $type = 'me', string $behavior = 'rename'): array + public function createFolder(string $name, string $path = '', string $type = 'me', string $behavior = 'rename'): array { $path = $path === '' ? $type.'/drive/root/children' : $type.'/drive/root:'.$this->forceStartingSlash($path).':/children'; @@ -75,6 +75,7 @@ public function rename(string $name, string $id, string $type = 'me'): array public function upload(string $name, string $uploadPath, string $path = '', string $type = 'me', string $behavior = 'rename'): void { $uploadSession = $this->createUploadSession($name, $path, $type, $behavior); + dd($uploadSession); $uploadUrl = $uploadSession['uploadUrl']; $fragSize = 320 * 1024; diff --git a/src/Resources/Tasks/TaskLists.php b/src/Resources/Tasks/TaskLists.php index ed735fb..13f8eb6 100644 --- a/src/Resources/Tasks/TaskLists.php +++ b/src/Resources/Tasks/TaskLists.php @@ -6,33 +6,33 @@ class TaskLists extends MsGraph { - public function get(array $params = []): MsGraph + public function get(array $params = []): array { $params = http_build_query($params); return MsGraph::get('me/todo/lists?'.$params); } - public function find(string $listId): MsGraph + public function find(string $listId): array { return MsGraph::get("me/todo/lists/$listId"); } - public function store(string $name): MsGraph + public function store(string $name): array { return MsGraph::post('me/todo/lists', [ 'displayName' => $name, ]); } - public function update(string $listId, string $name): MsGraph + public function update(string $listId, string $name): array { return MsGraph::patch("me/todo/lists/$listId", [ 'displayName' => $name, ]); } - public function delete(string $listId): MsGraph + public function delete(string $listId): string { return MsGraph::delete("me/todo/lists/$listId"); } diff --git a/src/Resources/Tasks/Tasks.php b/src/Resources/Tasks/Tasks.php index 5148715..4ed2060 100644 --- a/src/Resources/Tasks/Tasks.php +++ b/src/Resources/Tasks/Tasks.php @@ -29,22 +29,22 @@ public function get(string $taskListId, array $params = [], int $perPage = 25, s ]; } - public function find(string $taskListId, string $taskId): MsGraph + public function find(string $taskListId, string $taskId): array { return MsGraph::get("me/todo/lists/$taskListId/tasks/$taskId"); } - public function store(string $taskListId, array $data): MsGraph + public function store(string $taskListId, array $data): array { return MsGraph::post("me/todo/lists/$taskListId/tasks", $data); } - public function update(string $taskListId, string $taskId, array $data): MsGraph + public function update(string $taskListId, string $taskId, array $data): array { return MsGraph::patch("me/todo/lists/$taskListId/tasks/$taskId", $data); } - public function delete(string $taskListId, string $taskId): MsGraph + public function delete(string $taskListId, string $taskId): string { return MsGraph::delete("me/todo/lists/$taskListId/tasks/$taskId"); } From 5e85d83fe33e510f6549b10f3e5166dd92521bc7 Mon Sep 17 00:00:00 2001 From: David Carr Date: Thu, 14 Nov 2024 02:33:36 +0000 Subject: [PATCH 2/2] ran pint --- tests/MsGraphTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/MsGraphTest.php b/tests/MsGraphTest.php index ef07b56..187c1f0 100644 --- a/tests/MsGraphTest.php +++ b/tests/MsGraphTest.php @@ -5,7 +5,6 @@ use Dcblogdev\MsGraph\MsGraph; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; -use League\OAuth2\Client\Provider\Exception\IdentityProviderException; use League\OAuth2\Client\Provider\GenericProvider; use League\OAuth2\Client\Token\AccessToken; use Mockery\MockInterface;