add getAll and update logic

This commit is contained in:
Jonathan
2023-04-15 22:13:03 +02:00
parent df8ed036fc
commit 67ad212554

View File

@@ -26,6 +26,14 @@ class Settings
$this->url = $url; $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 $recordId
* @param string $url * @param string $url
@@ -60,7 +68,12 @@ class Settings
/** /**
* @return void * @return void
*/ */
public function getAll(){ public function getAll():array
{
return json_decode($this->doRequest($this->url . '/api/settings', 'GET', []), true);
}
public function update($bodyParam):array{
return json_decode($this->doRequest($this->url . '/api/settings', 'PATCH', json_encode($bodyParam)), true);
} }
} }