@@ -107,6 +107,8 @@ public class LCFile: LCObject {
107107 return " _File "
108108 }
109109
110+ // MARK: Save
111+
110112 /// Save file synchronously.
111113 public func save( ) -> LCBooleanResult {
112114 return expect { fulfill in
@@ -162,7 +164,8 @@ public class LCFile: LCObject {
162164 @discardableResult
163165 private func save(
164166 progressInBackground progress: @escaping ( Double ) -> Void ,
165- completion: @escaping ( LCBooleanResult ) -> Void ) -> LCRequest
167+ completion: @escaping ( LCBooleanResult ) -> Void )
168+ -> LCRequest
166169 {
167170 let httpClient : HTTPClient = self . application. httpClient
168171
@@ -197,7 +200,9 @@ public class LCFile: LCObject {
197200 }
198201 }
199202
200- let parameters = dictionary. jsonValue as? [ String : Any ]
203+ var parameters = dictionary. jsonValue as? [ String : Any ]
204+ parameters? . removeValue ( forKey: " __type " )
205+ parameters? . removeValue ( forKey: " className " )
201206
202207 return httpClient. request ( . post, " files " , parameters: parameters) { response in
203208 let result = LCValueResult < LCDictionary > ( response: response)
@@ -224,7 +229,8 @@ public class LCFile: LCObject {
224229 private func upload(
225230 payload: Payload ,
226231 progress: @escaping ( Double ) -> Void ,
227- completion: @escaping ( LCBooleanResult ) -> Void ) -> LCRequest
232+ completion: @escaping ( LCBooleanResult ) -> Void )
233+ -> LCRequest
228234 {
229235 let uploader = FileUploader ( file: self , payload: payload)
230236
@@ -281,41 +287,24 @@ public class LCFile: LCObject {
281287 // MARK: Unavailable
282288
283289 @available ( * , unavailable)
284- public override class func save(
285- _ objects: [ LCObject ] ,
286- options: [ LCObject . SaveOption ] = [ ] )
287- -> LCBooleanResult
288- {
290+ public override class func save( _ objects: [ LCObject ] , options: [ LCObject . SaveOption ] = [ ] ) -> LCBooleanResult {
289291 fatalError ( " not support " )
290292 }
291293
292294 @available ( * , unavailable)
293- public override class func save(
294- _ objects: [ LCObject ] ,
295- options: [ LCObject . SaveOption ] = [ ] ,
296- completion: @escaping ( LCBooleanResult ) -> Void )
297- -> LCRequest
298- {
295+ public override class func save( _ objects: [ LCObject ] , options: [ LCObject . SaveOption ] = [ ] , completion: @escaping ( LCBooleanResult ) -> Void ) -> LCRequest {
299296 fatalError ( " not support " )
300297 }
301298
302299 @available ( * , unavailable)
303- public override func save(
304- options: [ LCObject . SaveOption ] = [ ] )
305- -> LCBooleanResult
306- {
300+ public override func save( options: [ LCObject . SaveOption ] = [ ] ) -> LCBooleanResult {
307301 fatalError ( " not support " )
308302 }
309303
310304 @available ( * , unavailable)
311- public override func save(
312- options: [ LCObject . SaveOption ] = [ ] ,
313- completion: @escaping ( LCBooleanResult ) -> Void )
314- -> LCRequest
315- {
305+ public override func save( options: [ LCObject . SaveOption ] = [ ] , completion: @escaping ( LCBooleanResult ) -> Void ) -> LCRequest {
316306 fatalError ( " not support " )
317307 }
318-
319308}
320309
321310extension LCFile {
0 commit comments