11from typing import Any , Dict , List , Optional , Union
2+ from portkey_ai ._vendor .openai import NOT_GIVEN , NotGiven
23from portkey_ai .api_resources .base_client import APIClient , AsyncAPIClient
34from urllib .parse import urlencode
45from portkey_ai .api_resources .apis .api_resource import APIResource , AsyncAPIResource
@@ -18,17 +19,17 @@ def __init__(self, client: APIClient) -> None:
1819 def create (
1920 self ,
2021 * ,
21- type : Optional [str ] = None ,
22- sub_type : Optional [str ] = None ,
23- name : Optional [str ] = None ,
24- description : Optional [str ] = None ,
25- workspace_id : Optional [str ] = None ,
26- user_id : Optional [str ] = None ,
27- rate_limits : Optional [List [Dict [str , Any ]]] = None ,
28- usage_limits : Optional [Dict [str , Any ]] = None ,
29- scopes : List [str ],
30- defaults : Optional [Dict [str , Any ]] = None ,
31- expires_at : Optional [Any ] = None ,
22+ type : Union [str , NotGiven ] = NOT_GIVEN ,
23+ sub_type : Union [str , NotGiven ] = NOT_GIVEN ,
24+ name : Union [str , NotGiven ] = NOT_GIVEN ,
25+ description : Union [str , NotGiven ] = NOT_GIVEN ,
26+ workspace_id : Union [str , NotGiven ] = NOT_GIVEN ,
27+ user_id : Union [str , NotGiven ] = NOT_GIVEN ,
28+ rate_limits : Union [List [Dict [str , Any ]], NotGiven ] = NOT_GIVEN ,
29+ usage_limits : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
30+ scopes : Union [ List [str ], NotGiven ] = NOT_GIVEN ,
31+ defaults : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
32+ expires_at : Union [Any , NotGiven ] = NOT_GIVEN ,
3233 ** kwargs : Any ,
3334 ) -> ApiKeyAddResponse :
3435 body = {
@@ -69,16 +70,16 @@ def retrieve(self, *, id: Optional[str]) -> ApiKeyGetResponse:
6970 def list (
7071 self ,
7172 * ,
72- page_size : Optional [ Union [int , str ]] = None ,
73+ page_size : Union [int , str , NotGiven ] = NOT_GIVEN ,
7374 current_page : Optional [int ] = 0 ,
74- workspace_id : Optional [str ] = None ,
75+ workspace_id : Union [str , NotGiven ] = NOT_GIVEN ,
7576 ) -> ApiKeyListResponse :
7677 query = {
7778 "page_size" : page_size ,
7879 "current_page" : current_page ,
7980 "workspace_id" : workspace_id ,
8081 }
81- filtered_query = {k : v for k , v in query .items () if v is not None }
82+ filtered_query = {k : v for k , v in query .items () if v is not NOT_GIVEN }
8283 query_string = urlencode (filtered_query )
8384 return self ._get (
8485 f"{ PortkeyApiPaths .API_KEYS_API } ?{ query_string } " ,
@@ -93,14 +94,14 @@ def list(
9394 def update (
9495 self ,
9596 * ,
96- id : Optional [str ] = None ,
97- name : Optional [str ] = None ,
98- description : Optional [str ] = None ,
99- rate_limits : Optional [List [Dict [str , Any ]]] = None ,
100- usage_limits : Optional [Dict [str , Any ]] = None ,
101- scopes : Optional [List [str ]] = None ,
102- defaults : Optional [Dict [str , Any ]] = None ,
103- expires_at : Optional [Any ] = None ,
97+ id : Union [str , NotGiven ] = NOT_GIVEN ,
98+ name : Union [str , NotGiven ] = NOT_GIVEN ,
99+ description : Union [str , NotGiven ] = NOT_GIVEN ,
100+ rate_limits : Union [List [Dict [str , Any ]], NotGiven ] = NOT_GIVEN ,
101+ usage_limits : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
102+ scopes : Union [List [str ], NotGiven ] = NOT_GIVEN ,
103+ defaults : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
104+ expires_at : Union [Any , NotGiven ] = NOT_GIVEN ,
104105 ** kwargs : Any ,
105106 ) -> Any :
106107 body = {
@@ -147,17 +148,17 @@ def __init__(self, client: AsyncAPIClient) -> None:
147148 async def create (
148149 self ,
149150 * ,
150- type : Optional [str ] = None ,
151- sub_type : Optional [str ] = None ,
152- name : Optional [str ] = None ,
153- description : Optional [str ] = None ,
154- workspace_id : Optional [str ] = None ,
155- user_id : Optional [str ] = None ,
156- rate_limits : Optional [List [Dict [str , Any ]]] = None ,
157- usage_limits : Optional [Dict [str , Any ]] = None ,
158- scopes : List [str ],
159- defaults : Optional [Dict [str , Any ]] = None ,
160- expires_at : Optional [Any ] = None ,
151+ type : Union [str , NotGiven ] = NOT_GIVEN ,
152+ sub_type : Union [str , NotGiven ] = NOT_GIVEN ,
153+ name : Union [str , NotGiven ] = NOT_GIVEN ,
154+ description : Union [str , NotGiven ] = NOT_GIVEN ,
155+ workspace_id : Union [str , NotGiven ] = NOT_GIVEN ,
156+ user_id : Union [str , NotGiven ] = NOT_GIVEN ,
157+ rate_limits : Union [List [Dict [str , Any ]], NotGiven ] = NOT_GIVEN ,
158+ usage_limits : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
159+ scopes : Union [ List [str ], NotGiven ] = NOT_GIVEN ,
160+ defaults : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
161+ expires_at : Union [Any , NotGiven ] = NOT_GIVEN ,
161162 ** kwargs : Any ,
162163 ) -> ApiKeyAddResponse :
163164 body = {
@@ -198,16 +199,16 @@ async def retrieve(self, *, id: Optional[str]) -> ApiKeyGetResponse:
198199 async def list (
199200 self ,
200201 * ,
201- page_size : Optional [ Union [int , str ]] = None ,
202+ page_size : Union [int , str , NotGiven ] = NOT_GIVEN ,
202203 current_page : Optional [int ] = 0 ,
203- workspace_id : Optional [str ] = None ,
204+ workspace_id : Union [str , NotGiven ] = NOT_GIVEN ,
204205 ) -> ApiKeyListResponse :
205206 query = {
206207 "page_size" : page_size ,
207208 "current_page" : current_page ,
208209 "workspace_id" : workspace_id ,
209210 }
210- filtered_query = {k : v for k , v in query .items () if v is not None }
211+ filtered_query = {k : v for k , v in query .items () if v is not NOT_GIVEN }
211212 query_string = urlencode (filtered_query )
212213 return await self ._get (
213214 f"{ PortkeyApiPaths .API_KEYS_API } ?{ query_string } " ,
@@ -222,14 +223,14 @@ async def list(
222223 async def update (
223224 self ,
224225 * ,
225- id : Optional [str ] = None ,
226- name : Optional [str ] = None ,
227- description : Optional [str ] = None ,
228- rate_limits : Optional [List [Dict [str , Any ]]] = None ,
229- usage_limits : Optional [Dict [str , Any ]] = None ,
230- scopes : Optional [List [str ]] = None ,
231- defaults : Optional [Dict [str , Any ]] = None ,
232- expires_at : Optional [Any ] = None ,
226+ id : Union [str , NotGiven ] = NOT_GIVEN ,
227+ name : Union [str , NotGiven ] = NOT_GIVEN ,
228+ description : Union [str , NotGiven ] = NOT_GIVEN ,
229+ rate_limits : Union [List [Dict [str , Any ]], NotGiven ] = NOT_GIVEN ,
230+ usage_limits : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
231+ scopes : Union [List [str ], NotGiven ] = NOT_GIVEN ,
232+ defaults : Union [Dict [str , Any ], NotGiven ] = NOT_GIVEN ,
233+ expires_at : Union [Any , NotGiven ] = NOT_GIVEN ,
233234 ** kwargs : Any ,
234235 ) -> Any :
235236 body = {
0 commit comments