-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from wujun4code/cloud-functions
feat: call LeanEngine cloud functions.
- Loading branch information
Showing
3 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// RxAVCloud.swift | ||
// RxLeanCloudSwift | ||
// | ||
// Created by WuJun on 28/10/2017. | ||
// Copyright © 2017 LeanCloud. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
/* | ||
* LeanEngine | ||
*/ | ||
public class RxAVCloud { | ||
public static func callCloudFuntion(funtionName: String, payload: [String: Any]?, app: RxAVApp?) -> Observable<[String:Any]?> { | ||
var _app = app | ||
if _app == nil { | ||
_app = RxAVClient.sharedInstance.getCurrentApp() | ||
} | ||
let cmd = AVCommand(relativeUrl: "/functions/\(funtionName)", method: "POST", data: payload, app: _app!) | ||
return RxAVCorePlugins.sharedInstance.commandRunner.runRxCommand(command: cmd).map({ (avResponse) -> [String: Any]? in | ||
return avResponse.jsonBody | ||
}) | ||
} | ||
} | ||
|