From 67ad212554b58e7dd08297cd163520ac99c10fca Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 15 Apr 2023 22:13:03 +0200 Subject: [PATCH] add getAll and update logic --- src/Settings.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Settings.php b/src/Settings.php index 2529576..c5d8666 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -26,6 +26,14 @@ class Settings $this->url = $url; } + public function authAsAdmin(string $email, string $password): void + { + $bodyParams['identity'] = $email; + $bodyParams['password'] = $password; + $output = $this->doRequest($this->url . "/api/admins/auth-with-password", 'POST', $bodyParams); + self::$token = json_decode($output, true)['token']; + } + /** * @param string $recordId * @param string $url @@ -60,7 +68,12 @@ class Settings /** * @return void */ - public function getAll(){ - + public function getAll():array + { + return json_decode($this->doRequest($this->url . '/api/settings', 'GET', []), true); } -} \ No newline at end of file + + public function update($bodyParam):array{ + return json_decode($this->doRequest($this->url . '/api/settings', 'PATCH', json_encode($bodyParam)), true); + } +}