/// <summary> /// Invoke a cloud function which you have defined in cloud/main.js (the old way). /// </summary> /// <param name="remoteAct">The name of the cloud function name</param> /// <param name="actParams">The parameters passed to the cloud function</param> /// <example> /// <code> /// string cloudFunc = "test"; /// IDictionary<string, object> dict = new Dictionary<string, object>(); /// dict.Add("data", "test"); /// FHResponse response = await FH.Act(cloudFunc, dict); /// if(null == response.Error) /// { /// //no error occured, the request is successful /// string rawResponseData = response.RawResponse; /// //you can get it as JSONObject (require Json.Net library) /// JObject resJson = response.GetResponseAsJObject(); /// //process response data /// } /// else /// { /// //error occured during the request, deal with it. /// //More infomation can be access from response.Error.InnerException /// } /// </code> /// </example> /// <returns>The response data returned by the cloud function</returns> /// <exception cref="InvalidOperationException"> It will be thrown if FH SDK is not ready.</exception> public static async Task<FHResponse> Act(string remoteAct, object actParams) { RequireAppReady(); FHActRequest actRequest = new FHActRequest(cloudProps); actRequest.TimeOut = timeout; return await actRequest.execAsync(remoteAct, actParams); }
/// <summary> /// Invoke a cloud function which you have defined in cloud/main.js (the old way). /// </summary> /// <param name="remoteAct">The name of the cloud function name</param> /// <param name="actParams">The parameters passed to the cloud function</param> /// <example> /// <code> /// string cloudFunc = "test"; /// IDictionary<string, object> dict = new Dictionary<string, object>(); /// dict.Add("data", "test"); /// FHResponse response = await FH.Act(cloudFunc, dict); /// if(null == response.Error) /// { /// //no error occured, the request is successful /// string rawResponseData = response.RawResponse; /// //you can get it as JSONObject (require Json.Net library) /// JObject resJson = response.GetResponseAsJObject(); /// //process response data /// } /// else /// { /// //error occured during the request, deal with it. /// //More infomation can be access from response.Error.InnerException /// } /// </code> /// </example> /// <returns>The response data returned by the cloud function</returns> /// <exception cref="InvalidOperationException"> It will be thrown if FH SDK is not ready.</exception> public static async Task<FHResponse> Act(string remoteAct, object actParams) { RequireAppReady(); var actRequest = new FHActRequest(CloudProps) {TimeOut = TimeOut}; return await actRequest.ExecAsync(remoteAct, actParams); }