public async Task <string> Registrar(string privateKey, int account, string user, string pass, string hash, string coin, int test) { try { // Declaração e Instancia de objetos das classes utilizadas SendApi Api = new SendApi(); SingleResult singleResult = new SingleResult(); // Chamada do metodo de registro de arquivos da API singleResult = await Api.SendHashAsync(AStar.Util.Token.sign(privateKey), account, user, pass, hash, coin, test); // Verificação do retorno do metodo if (singleResult.Error != null) { return("Erro de execucao da rotina SendFile da API. " + singleResult.Result); } else { return(singleResult.Result); } } catch (Exception ex) { return("Erro na chamada da rotina Registrar. Exception: " + ex.Message); } }
protected override void Initialize(MessengerCredentials credentials = null) { base.Initialize(credentials); Authenticator = new Authenticator(credentials); SendApi = new SendApi(credentials); UserProfileApi = new UserProfileApi(credentials); MessengerProfileAPI = new MessengerProfileAPI(credentials); }
protected override void Initialize(Credentials credentials = null) { base.Initialize(credentials); Authenticator = new Authenticator(credentials); SendApi = new SendApi(credentials); UserProfileApi = new UserProfileApi(credentials); MessengerProfileAPI = new MessengerProfileAPI(credentials); HandoverProtocolHandler = new HandoverProtocolHandler(credentials); PageFeedApi = new PageFeedAPI(credentials); }
IEnumerator PostRequest() { SendApi myObject = new SendApi(); myObject.DurasiMain = TimePlay.text.ToString(); myObject.DurasiCocokan = TimeCocokan.text.ToString(); myObject.Status = StatusBerhasil.text.ToString(); myObject.Skip = SkipText.text.ToString(); string json = JsonUtility.ToJson(myObject); Debug.Log(json); string fileName = idLogin.text + "_" + namaPemain.text + "_" + LevelMain.text + "_checkout_" + tnya.ToString() + ".jpeg"; string pathToSave = fileName; ScreenCapture.CaptureScreenshot(pathToSave); //submit ke api( ScreenCapture.CaptureScreenshot(pathToSave); yield return(new WaitForEndOfFrame()); //Debug.Log("Screenshoot"); WWWForm form = new WWWForm(); form.AddField("token", tokenLogin.text.ToString()); form.AddField("id_user", idLogin.text.ToString()); form.AddField("id_game", "1"); form.AddField("level", LevelMain.text.ToString()); form.AddField("score", json); UnityWebRequest uwr = UnityWebRequest.Post("https://game.psikologicare.com/api/game/store-score", form); yield return(uwr.SendWebRequest()); if (uwr.isNetworkError) { Debug.Log("Error While Sending: " + uwr.error); } else { Debug.Log("Received: " + uwr.downloadHandler.text); //SceneManager.LoadScene("level2_resize"); } }