@@ -76,6 +76,7 @@ open class Functions: Service {
7676 /// @param String templateOwner
7777 /// @param String templateRootDirectory
7878 /// @param String templateVersion
79+ /// @param String specification
7980 /// @throws Exception
8081 /// @return array
8182 ///
@@ -100,7 +101,8 @@ open class Functions: Service {
100101 templateRepository: String ? = nil ,
101102 templateOwner: String ? = nil ,
102103 templateRootDirectory: String ? = nil ,
103- templateVersion: String ? = nil
104+ templateVersion: String ? = nil ,
105+ specification: String ? = nil
104106 ) async throws -> AppwriteModels . Function {
105107 let apiPath : String = " /functions "
106108
@@ -125,7 +127,8 @@ open class Functions: Service {
125127 " templateRepository " : templateRepository,
126128 " templateOwner " : templateOwner,
127129 " templateRootDirectory " : templateRootDirectory,
128- " templateVersion " : templateVersion
130+ " templateVersion " : templateVersion,
131+ " specification " : specification
129132 ]
130133
131134 let apiHeaders : [ String : String ] = [
@@ -176,6 +179,38 @@ open class Functions: Service {
176179 )
177180 }
178181
182+ ///
183+ /// List available function runtime specifications
184+ ///
185+ /// List allowed function specifications for this instance.
186+ ///
187+ ///
188+ /// @throws Exception
189+ /// @return array
190+ ///
191+ open func listSpecifications(
192+ ) async throws -> AppwriteModels . SpecificationList {
193+ let apiPath : String = " /functions/specifications "
194+
195+ let apiParams : [ String : Any ] = [ : ]
196+
197+ let apiHeaders : [ String : String ] = [
198+ " content-type " : " application/json "
199+ ]
200+
201+ let converter : ( Any ) -> AppwriteModels . SpecificationList = { response in
202+ return AppwriteModels . SpecificationList. from ( map: response as! [ String : Any ] )
203+ }
204+
205+ return try await client. call (
206+ method: " GET " ,
207+ path: apiPath,
208+ headers: apiHeaders,
209+ params: apiParams,
210+ converter: converter
211+ )
212+ }
213+
179214 ///
180215 /// List function templates
181216 ///
@@ -314,6 +349,7 @@ open class Functions: Service {
314349 /// @param String providerBranch
315350 /// @param Bool providerSilentMode
316351 /// @param String providerRootDirectory
352+ /// @param String specification
317353 /// @throws Exception
318354 /// @return array
319355 ///
@@ -334,7 +370,8 @@ open class Functions: Service {
334370 providerRepositoryId: String ? = nil ,
335371 providerBranch: String ? = nil ,
336372 providerSilentMode: Bool ? = nil ,
337- providerRootDirectory: String ? = nil
373+ providerRootDirectory: String ? = nil ,
374+ specification: String ? = nil
338375 ) async throws -> AppwriteModels . Function {
339376 let apiPath : String = " /functions/{functionId} "
340377 . replacingOccurrences ( of: " {functionId} " , with: functionId)
@@ -355,7 +392,8 @@ open class Functions: Service {
355392 " providerRepositoryId " : providerRepositoryId,
356393 " providerBranch " : providerBranch,
357394 " providerSilentMode " : providerSilentMode,
358- " providerRootDirectory " : providerRootDirectory
395+ " providerRootDirectory " : providerRootDirectory,
396+ " specification " : specification
359397 ]
360398
361399 let apiHeaders : [ String : String ] = [
@@ -780,13 +818,12 @@ open class Functions: Service {
780818 path: String ? = nil ,
781819 method: AppwriteEnums . ExecutionMethod ? = nil ,
782820 headers: Any ? = nil ,
783- scheduledAt: String ? = nil ,
784- onProgress: ( ( UploadProgress ) -> Void ) ? = nil
821+ scheduledAt: String ? = nil
785822 ) async throws -> AppwriteModels . Execution {
786823 let apiPath : String = " /functions/{functionId}/executions "
787824 . replacingOccurrences ( of: " {functionId} " , with: functionId)
788825
789- var apiParams : [ String : Any ? ] = [
826+ let apiParams : [ String : Any ? ] = [
790827 " body " : body,
791828 " async " : async ,
792829 " path " : path,
@@ -795,23 +832,20 @@ open class Functions: Service {
795832 " scheduledAt " : scheduledAt
796833 ]
797834
798- var apiHeaders : [ String : String ] = [
799- " content-type " : " multipart/form-data "
835+ let apiHeaders : [ String : String ] = [
836+ " content-type " : " application/json "
800837 ]
801838
802839 let converter : ( Any ) -> AppwriteModels . Execution = { response in
803840 return AppwriteModels . Execution. from ( map: response as! [ String : Any ] )
804841 }
805842
806- let idParamName : String ? = nil
807- return try await client . chunkedUpload (
843+ return try await client . call (
844+ method : " POST " ,
808845 path: apiPath,
809- headers: & apiHeaders,
810- params: & apiParams,
811- paramName: paramName,
812- idParamName: idParamName,
813- converter: converter,
814- onProgress: onProgress
846+ headers: apiHeaders,
847+ params: apiParams,
848+ converter: converter
815849 )
816850 }
817851
0 commit comments