@@ -50,13 +50,17 @@ extension HookFunction {
5050 . delete ( options: [ . serverURL( parseServerURLString) ] )
5151 default :
5252 throw ParseError ( code: . otherCause,
53+ // swiftlint:disable:next line_length
5354 message: " Method \( method) is not supported for Hook Function: \" \( String ( describing: hookFunction) ) \" " )
5455 }
56+ // swiftlint:disable:next line_length
5557 configuration. logger. notice ( " Successful \( method) ; Hook Function: \" \( String ( describing: hookFunction) ) \" on server: \( parseServerURLString) " )
5658 } catch {
5759 if error. containedIn ( [ . webhookError] ) && method == . POST {
60+ // swiftlint:disable:next line_length
5861 configuration. logger. warning ( " Hook Function: \" \( String ( describing: hookFunction) ) \" ; warning: \( error) ; on server: \( parseServerURLString) " )
5962 } else {
63+ // swiftlint:disable:next line_length
6064 configuration. logger. error ( " Could not \( method) Hook Function: \" \( String ( describing: hookFunction) ) \" ; error: \( error) ; on server: \( parseServerURLString) " )
6165 }
6266 }
@@ -68,7 +72,7 @@ extension HookFunction {
6872
6973// MARK: HookFunction - Fetch
7074public extension HookFunction {
71-
75+
7276 /**
7377 Fetches a Parse Cloud Code hook function.
7478 - parameter path: A variadic list of paths.
@@ -80,8 +84,8 @@ public extension HookFunction {
8084 Will log an error for each `parseServerURLString` that returns an error.
8185 */
8286 static func fetch( _ path: PathComponent ... ,
83- name: String ,
84- parseServerURLStrings: [ String ] ) async throws -> [ String : HookFunction ] {
87+ name: String ,
88+ parseServerURLStrings: [ String ] ) async throws -> [ String : HookFunction ] {
8589 try await fetch ( path, name: name, parseServerURLStrings: parseServerURLStrings)
8690 }
8791
@@ -96,11 +100,11 @@ public extension HookFunction {
96100 Will log an error for each `parseServerURLString` that returns an error.
97101 */
98102 static func fetch( _ path: [ PathComponent ] ,
99- name: String ,
100- parseServerURLStrings: [ String ] ) async throws -> [ String : HookFunction ] {
103+ name: String ,
104+ parseServerURLStrings: [ String ] ) async throws -> [ String : HookFunction ] {
101105 try await method ( . PUT, path, name: name, parseServerURLStrings: parseServerURLStrings)
102106 }
103-
107+
104108 /**
105109 Fetches all Parse Cloud Code hook function.
106110 - parameter path: A variadic list of paths.
@@ -140,6 +144,7 @@ public extension HookFunction {
140144 hookFunctions [ parseServerURLString] = try await hookFunction
141145 . fetchAll ( options: [ . serverURL( parseServerURLString) ] )
142146 } catch {
147+ // swiftlint:disable:next line_length
143148 configuration. logger. error ( " Could not fetchAll function: \" \( String ( describing: hookFunction) ) \" ; error: \( error) ; on server: \( parseServerURLString) " )
144149 }
145150 }
@@ -149,7 +154,7 @@ public extension HookFunction {
149154
150155// MARK: HookFunction - Create
151156public extension HookFunction {
152-
157+
153158 /**
154159 Creates a Parse Cloud Code hook function.
155160 - parameter path: A variadic list of paths.
@@ -163,6 +168,7 @@ public extension HookFunction {
163168 */
164169 static func create( _ path: PathComponent ... ,
165170 name: String ,
171+ // swiftlint:disable:next line_length
166172 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws -> [ String : HookFunction ] {
167173 try await create ( path, name: name, parseServerURLStrings: parseServerURLStrings)
168174 }
@@ -180,14 +186,15 @@ public extension HookFunction {
180186 */
181187 static func create( _ path: [ PathComponent ] ,
182188 name: String ,
189+ // swiftlint:disable:next line_length
183190 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws -> [ String : HookFunction ] {
184191 try await method ( . POST, path, name: name, parseServerURLStrings: parseServerURLStrings)
185192 }
186193}
187194
188195// MARK: HookFunction - Update
189196public extension HookFunction {
190-
197+
191198 /**
192199 Updates a Parse Cloud Code hook function.
193200 - parameter path: A variadic list of paths.
@@ -201,6 +208,7 @@ public extension HookFunction {
201208 */
202209 static func update( _ path: PathComponent ... ,
203210 name: String ,
211+ // swiftlint:disable:next line_length
204212 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws -> [ String : HookFunction ] {
205213 try await update ( path, name: name, parseServerURLStrings: parseServerURLStrings)
206214 }
@@ -218,14 +226,15 @@ public extension HookFunction {
218226 */
219227 static func update( _ path: [ PathComponent ] ,
220228 name: String ,
229+ // swiftlint:disable:next line_length
221230 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws -> [ String : HookFunction ] {
222231 try await method ( . PUT, path, name: name, parseServerURLStrings: parseServerURLStrings)
223232 }
224233}
225234
226235// MARK: HookFunction - Delete
227236public extension HookFunction {
228-
237+
229238 /**
230239 Removes a Parse Cloud Code hook function.
231240 - parameter path: A variadic list of paths.
@@ -238,6 +247,7 @@ public extension HookFunction {
238247 */
239248 static func delete( _ path: PathComponent ... ,
240249 name: String ,
250+ // swiftlint:disable:next line_length
241251 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws {
242252 try await delete ( path, name: name, parseServerURLStrings: parseServerURLStrings)
243253 }
@@ -254,6 +264,7 @@ public extension HookFunction {
254264 */
255265 static func delete( _ path: [ PathComponent ] ,
256266 name: String ,
267+ // swiftlint:disable:next line_length
257268 parseServerURLStrings: [ String ] = ParseServerSwift . configuration. parseServerURLStrings) async throws {
258269 try await method ( . DELETE, path, name: name, parseServerURLStrings: parseServerURLStrings)
259270 }
@@ -276,8 +287,7 @@ public extension RoutesBuilder {
276287 name: String ,
277288 use closure: @escaping ( Request ) async throws -> Response
278289 ) -> Route
279- where Response: AsyncResponseEncodable
280- {
290+ where Response: AsyncResponseEncodable {
281291 self . on ( path,
282292 name: name,
283293 use: closure)
@@ -298,8 +308,7 @@ public extension RoutesBuilder {
298308 name: String ,
299309 use closure: @escaping ( Request ) async throws -> Response
300310 ) -> Route
301- where Response: AsyncResponseEncodable
302- {
311+ where Response: AsyncResponseEncodable {
303312 self . on ( path,
304313 name: name,
305314 use: closure)
@@ -322,8 +331,7 @@ public extension RoutesBuilder {
322331 name: String ,
323332 use closure: @escaping ( Request ) async throws -> Response
324333 ) -> Route
325- where Response: AsyncResponseEncodable
326- {
334+ where Response: AsyncResponseEncodable {
327335 self . on ( path,
328336 body: body,
329337 name: name,
@@ -347,13 +355,13 @@ public extension RoutesBuilder {
347355 name: String ,
348356 use closure: @escaping ( Request ) async throws -> Response
349357 ) -> Route
350- where Response: AsyncResponseEncodable
351- {
358+ where Response: AsyncResponseEncodable {
352359 Task {
353360 do {
354361 await configuration. hooks. updateFunctions ( try await HookFunction . create ( path,
355362 name: name) )
356363 } catch {
364+ // swiftlint:disable:next line_length
357365 configuration. logger. error ( " Could not create HookFunction route for path: \( path) ; name: \( name) on servers: \( configuration. parseServerURLStrings) because of error: \( error) " )
358366 }
359367 }
0 commit comments