4
4
from subprocess import Popen , PIPE
5
5
from sys import executable
6
6
from time import sleep
7
- from typing import Any , Callable , Awaitable
7
+ from typing import Any , Callable , Awaitable , List
8
8
9
9
import requests
10
10
@@ -184,10 +184,13 @@ async def list_models(self, providers: list[str] = None, credential_overrides: l
184
184
{"providers" : providers , "credentialOverrides" : credential_overrides }
185
185
)).split ("\n " )
186
186
187
- async def list_credentials (self , context : str = "default" , all_contexts : bool = False ) -> list [Credential ] | str :
187
+ async def list_credentials (self , contexts : List [str ] = None , all_contexts : bool = False ) -> list [Credential ] | str :
188
+ if contexts is None :
189
+ contexts = ["default" ]
190
+
188
191
res = await self ._run_basic_command (
189
192
"credentials" ,
190
- {"context" : context , "allContexts" : all_contexts }
193
+ {"context" : contexts , "allContexts" : all_contexts }
191
194
)
192
195
if res .startswith ("an error occurred:" ):
193
196
return res
@@ -200,10 +203,13 @@ async def create_credential(self, cred: Credential) -> str:
200
203
{"content" : cred .to_json ()}
201
204
)
202
205
203
- async def reveal_credential (self , context : str = "default" , name : str = "" ) -> Credential | str :
206
+ async def reveal_credential (self , contexts : List [str ] = None , name : str = "" ) -> Credential | str :
207
+ if contexts is None :
208
+ contexts = ["default" ]
209
+
204
210
res = await self ._run_basic_command (
205
211
"credentials/reveal" ,
206
- {"context" : context , "name" : name }
212
+ {"context" : contexts , "name" : name }
207
213
)
208
214
if res .startswith ("an error occurred:" ):
209
215
return res
@@ -213,7 +219,7 @@ async def reveal_credential(self, context: str = "default", name: str = "") -> C
213
219
async def delete_credential (self , context : str = "default" , name : str = "" ) -> str :
214
220
return await self ._run_basic_command (
215
221
"credentials/delete" ,
216
- {"context" : context , "name" : name }
222
+ {"context" : [ context ] , "name" : name }
217
223
)
218
224
219
225
0 commit comments