//Métodos get y post de usuarios public static void GetUser(string username, GetUserCallback callback, GetUserCallbackNotFound callbackNotFound) { RestClient.Get <UserData>($"{databaseURL}users/{username}.json").Then(user => { Debug.Log("GetUser"); callback(user); }).Catch(rejected => { Debug.Log("GetUserRejected"); callbackNotFound(); }); }
public static void get(string child, GetUserCallback callback, GetUserCallbackError callbackError) { RestClient.Get(baseurl + child + "/.json").Then(response => { if (response.Text.Equals("null")) { callback(false); } else { callback(response.Text); } }).Catch(err => callbackError(err.Message)); }
public static void get(string child, GetUserCallback callback) { RestClient.Get(baseurl + child + "/.json").Then(response => { if (response.Text.Equals("null")) { callback(false); } else { callback(response.Text); } }); }
/// <summary> /// Gets a user by their display name. /// </summary> /// <param name="cb">The result of the web request.</param> /// <param name="displayName">The display name of the user to get.</param> public void GetUserByName(GetUserCallback cb, string displayName) { if (!isInitialized) { throw new System.Exception("Account Services not initialized."); } // Query server for app authorization and web URL Dictionary <string, string> formData = new Dictionary <string, string>(); formData.Add("DisplayName", displayName); coroutineOwner.StartCoroutine(OnGetUserByNameResponse(apiUrl + "user/get_user_by_name.php", formData, cb)); }
/// <summary> /// Retrieves a user from the Firebase Database, given their id /// </summary> /// <param name="userId"> Id of the user that we are looking for </param> /// <param name="callback"> What to do after the user is downloaded successfully </param> public static void GetUser(string userId, GetUserCallback callback) { RestClient.Get <User>($"{databaseURL}users/{userId}.json").Then(user => { callback(user); }); }
public RenameUserWin() { InitializeComponent(); OnUserReceived += GetUser; }
/// <summary> /// Retrieves a user from the Firebase Database, given their id /// </summary> /// <param name="userId"> Id of the user that we are looking for </param> /// <param name="callback"> What to do after the user is downloaded successfully </param> public static void GetUser(string nodeId, GetUserCallback callback) { RestClient.Get <Node>($"{databaseURL}nodes/{nodeId}.json").Then(node => { callback(node); }); }
public static void GetUserByUsername(string username, GetUserCallback callback) { RestClient.Get <UserCredentials>($"{databaseURL}users/{username}.json") .Then(user => { callback(user); }) .Catch(err => { Debug.Log("GET couldn't fetch the object from database!"); callback(null); }); }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public void GetUser(string name, GetUserCallback callback) { getUserCallback = callback; SendMessage("GET_USER", name); }
public PasswordWin() { InitializeComponent(); OnUserReceived += GetUser; }
private IEnumerator OnGetUserByNameResponse(string url, Dictionary <string, string> formData, GetUserCallback cb) { using (UnityWebRequest request = WebConfig.Post(url, formData)) { yield return(request.SendWebRequest()); ErrorResponse error = WebConfig.ProcessGenericErrors(request); if (error != null) { cb?.Invoke(null, error); yield break; } GetUserByNameResponse response = GetUserByNameResponse.FromJson(request.downloadHandler.text); switch (response.code) { case 1: cb?.Invoke(new UserAccount(this, response.userID), null); break; default: // Unknown code error cb?.Invoke(null, WebConfig.GetUnknownError(request)); break; } } }