-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
Richard Wei edited this page Jun 13, 2021
·
3 revisions
const functions = firebase.functions();
const incrementViews = functions.httpsCallable('incrementView');
incrementViews({ id: 'THE_ID_OF_THE_ARTICLE' }).then((result) => {
// Read result of the Function.
const result = result.data.status;
});FirebaseFunctions functions = FirebaseFunctions.getInstance();
public Task<String> incrementViews(String articleId) {
// Create the arguments to the callable function.
Map<String, Object> data = new HashMap<>();
data.put("id", articleId);
return functions
.getHttpsCallable("incrementView")
.call(data)
.continueWith(new Continuation<HttpsCallableResult, String>() {
@Override
public String then(@NonNull Task<HttpsCallableResult> task) throws Exception {
// Get the result (normaly returns {status: "Good"})
String result = (String) task.getResult().getData();
return result;
}
});
}lazy var functions = Functions.functions()
functions.httpsCallable("incrementView").call(["id": THE_ID_OF_THE_ARTICLE ]) { (_, _) in }