@@ -20,7 +20,7 @@ def list(self, queries = None, search = None):
2020 'content-type' : 'application/json' ,
2121 }, api_params )
2222
23- def create (self , function_id , name , runtime , execute = None , events = None , schedule = None , timeout = None , enabled = None , logging = None , entrypoint = None , commands = None , scopes = None , installation_id = None , provider_repository_id = None , provider_branch = None , provider_silent_mode = None , provider_root_directory = None , template_repository = None , template_owner = None , template_root_directory = None , template_branch = None ):
23+ def create (self , function_id , name , runtime , execute = None , events = None , schedule = None , timeout = None , enabled = None , logging = None , entrypoint = None , commands = None , scopes = None , installation_id = None , provider_repository_id = None , provider_branch = None , provider_silent_mode = None , provider_root_directory = None , template_repository = None , template_owner = None , template_root_directory = None , template_version = None ):
2424 """Create function"""
2525
2626
@@ -56,7 +56,7 @@ def create(self, function_id, name, runtime, execute = None, events = None, sche
5656 api_params ['templateRepository' ] = template_repository
5757 api_params ['templateOwner' ] = template_owner
5858 api_params ['templateRootDirectory' ] = template_root_directory
59- api_params ['templateBranch ' ] = template_branch
59+ api_params ['templateVersion ' ] = template_version
6060
6161 return self .client .call ('post' , api_path , {
6262 'content-type' : 'application/json' ,
@@ -69,6 +69,38 @@ def list_runtimes(self):
6969 api_path = '/functions/runtimes'
7070 api_params = {}
7171
72+ return self .client .call ('get' , api_path , {
73+ 'content-type' : 'application/json' ,
74+ }, api_params )
75+
76+ def list_templates (self , runtimes = None , use_cases = None , limit = None , offset = None ):
77+ """List function templates"""
78+
79+
80+ api_path = '/functions/templates'
81+ api_params = {}
82+
83+ api_params ['runtimes' ] = runtimes
84+ api_params ['useCases' ] = use_cases
85+ api_params ['limit' ] = limit
86+ api_params ['offset' ] = offset
87+
88+ return self .client .call ('get' , api_path , {
89+ 'content-type' : 'application/json' ,
90+ }, api_params )
91+
92+ def get_template (self , template_id ):
93+ """Get function template"""
94+
95+
96+ api_path = '/functions/templates/{templateId}'
97+ api_params = {}
98+ if template_id is None :
99+ raise AppwriteException ('Missing required parameter: "template_id"' )
100+
101+ api_path = api_path .replace ('{templateId}' , template_id )
102+
103+
72104 return self .client .call ('get' , api_path , {
73105 'content-type' : 'application/json' ,
74106 }, api_params )
@@ -210,7 +242,7 @@ def get_deployment(self, function_id, deployment_id):
210242 }, api_params )
211243
212244 def update_deployment (self , function_id , deployment_id ):
213- """Update function deployment"""
245+ """Update deployment"""
214246
215247
216248 api_path = '/functions/{functionId}/deployments/{deploymentId}'
@@ -290,8 +322,8 @@ def update_deployment_build(self, function_id, deployment_id):
290322 'content-type' : 'application/json' ,
291323 }, api_params )
292324
293- def download_deployment (self , function_id , deployment_id ):
294- """Download Deployment """
325+ def get_deployment_download (self , function_id , deployment_id ):
326+ """Download deployment """
295327
296328
297329 api_path = '/functions/{functionId}/deployments/{deploymentId}/download'
@@ -328,7 +360,7 @@ def list_executions(self, function_id, queries = None, search = None):
328360 'content-type' : 'application/json' ,
329361 }, api_params )
330362
331- def create_execution (self , function_id , body = None , xasync = None , path = None , method = None , headers = None , scheduled_at = None ):
363+ def create_execution (self , function_id , body = None , xasync = None , path = None , method = None , headers = None , scheduled_at = None , on_progress = None ):
332364 """Create execution"""
333365
334366
@@ -340,15 +372,18 @@ def create_execution(self, function_id, body = None, xasync = None, path = None,
340372 api_path = api_path .replace ('{functionId}' , function_id )
341373
342374 api_params ['body' ] = body
343- api_params ['async' ] = xasync
375+ api_params ['async' ] = str ( xasync ). lower () if type ( xasync ) is bool else xasync
344376 api_params ['path' ] = path
345377 api_params ['method' ] = method
346- api_params ['headers' ] = headers
378+ api_params ['headers' ] = str ( headers ). lower () if type ( headers ) is bool else headers
347379 api_params ['scheduledAt' ] = scheduled_at
348380
349- return self .client .call ('post' , api_path , {
350- 'content-type' : 'application/json' ,
351- }, api_params )
381+
382+ upload_id = ''
383+
384+ return self .client .chunked_upload (api_path , {
385+ 'content-type' : 'multipart/form-data' ,
386+ }, api_params , param_name , on_progress , upload_id )
352387
353388 def get_execution (self , function_id , execution_id ):
354389 """Get execution"""
0 commit comments