From 3f762395eb58482d362ead7f655060747594fbe3 Mon Sep 17 00:00:00 2001 From: bepsvpt <8221099+bepsvpt@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:59:04 +0800 Subject: [PATCH] feat: support list and get connection(s) --- src/Objects/Connection.php | 20 +++++++++++++++++++ src/Requests/Connection.php | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/Objects/Connection.php diff --git a/src/Objects/Connection.php b/src/Objects/Connection.php new file mode 100644 index 0000000..c0b3747 --- /dev/null +++ b/src/Objects/Connection.php @@ -0,0 +1,20 @@ + + * + * @link https://docs.revert.dev/api-reference/api-reference/connection/get-all-connections + */ + public function list(): array + { + $data = $this->request( + 'get', + '/connection/all', + isArray: true, + ); + + return array_map( + fn (stdClass $item) => ConnectionObject::from($item), + $data, + ); + } + + /** + * Get details of a connection for a specific tenant. + * + * @link https://docs.revert.dev/api-reference/api-reference/connection/get-connection + */ + public function get(): ConnectionObject + { + $data = $this->request( + 'get', + '/connection', + ); + + return ConnectionObject::from($data); + } + /** * Delete a connection for a specific tenant. *