From ce21d647c7c760693ed14987c181ae2724a8ffdd Mon Sep 17 00:00:00 2001
From: xavi <xpeiro92@gmail.com>
Date: Tue, 24 Sep 2024 10:05:38 +0200
Subject: [PATCH] adding on client

---
 ai_engine_sdk/client.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/ai_engine_sdk/client.py b/ai_engine_sdk/client.py
index 309b28e..aa767b5 100644
--- a/ai_engine_sdk/client.py
+++ b/ai_engine_sdk/client.py
@@ -82,8 +82,10 @@ async def make_api_request(
         api_key: str,
         method: str,
         endpoint: str,
-        payload: Optional[dict] = None
+        payload: Optional[dict] = None,
+        params: Optional[dict] = None
 ) -> dict:
+    params = {} if params is None else params
     body = json.dumps(payload) if payload else None
 
     headers = {
@@ -95,7 +97,13 @@ async def make_api_request(
         logger.debug(f"\n\n 📤 Request triggered : {method} {api_base_url}{endpoint}")
         logger.debug(f"{body=}")
         logger.debug("---------------------------\n\n")
-        async with session.request(method, f"{api_base_url}{endpoint}", headers=headers, data=body) as response:
+        async with session.request(
+            method,
+            f"{api_base_url}{endpoint}",
+            headers=headers,
+            data=body,
+            params=params
+        ) as response:
             if not bool(re.search(pattern="^2..$", string=str(response.status))):
                 raise Exception(f"Request failed with status {response.status} to {method}: {endpoint}")
             return await response.json()
@@ -482,12 +490,14 @@ async def get_functions_by_function_group(self, function_group_id: str) -> list[
         return result
 
 
-    async def get_functions(self) -> list[Function]:
+    async def get_functions(self, params: Optional[dict] = None) -> list[Function]:
+        params = {} if params is None else params
         raw_response: dict = await make_api_request(
             api_base_url=self._api_base_url,
             api_key=self._api_key,
             method='GET',
-            endpoint=f"/v1beta1/functions/"
+            endpoint=f"/v1beta1/functions/",
+            params=params
         )
         return list(
             map(