From 13ad0366a549ac962dad3bdff8a96d111fb2cfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E8=93=9D?= <90918529+bilulanlv@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:48:11 +0800 Subject: [PATCH 1/2] Add Authorization After starting Bot and Abuse Protection, you need to add Authorization, otherwise captcha verification process failed will be reported. --- src/Service.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Service.php b/src/Service.php index e3d1950..c735d7e 100644 --- a/src/Service.php +++ b/src/Service.php @@ -29,6 +29,7 @@ public function __construct(string $apiKey, string $uriBase) $this->httpClient = new \GuzzleHttp\Client(); $this->headers['apikey'] = $this->apiKey; + $this->headers['Authorization'] = 'Bearer ' . $this->apiKey; } /** @@ -221,4 +222,4 @@ public function executeHttpRequest(string $method, string $uri, array $options) throw $e; } } -} \ No newline at end of file +} From 37735666ef14eca4682cefd6bb54f381a72577eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E8=93=9D?= <90918529+bilulanlv@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:50:32 +0800 Subject: [PATCH 2/2] Delete the user Delete the user --- src/Auth.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index 0e368b8..eb69f9f 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -248,4 +248,18 @@ public function updateUser(string $bearerUserToken, string $email = null, string return $this->service->executeHttpRequest('PUT', $uri, $options); } -} \ No newline at end of file + /** + * Delete the user, need service_role secret + * @param $id String The user id + * @return array|object|null + */ + public function deleteUser($id) + { + $uri = $this->service->getUriBase($this->suffix . 'admin/users/' . $id); + $options = [ + 'headers' => $this->service->getHeaders() + ]; + return $this->service->executeHttpRequest('DELETE', $uri, $options); + } + +}