/// <summary> /// Update user by Id /// </summary> /// <param name="jwt">A valid JWT. Must be a full-access API key (e.g. service_role key).</param> /// <param name="userId"></param> /// <param name="userData"></param> /// <returns></returns> public async Task <User> UpdateUserById(string jwt, string userId, UserAttributes userData) { try { return(await api.UpdateUserById(jwt, userId, userData)); } catch (RequestException ex) { throw ExceptionHandler.Parse(ex); } }
/// <summary> /// Updates a User. /// </summary> /// <param name="attributes"></param> /// <returns></returns> public static async Task <User> Update(string accessToken, UserAttributes attributes, StatelessClientOptions options) { try { var result = await GetApi(options).UpdateUser(accessToken, attributes); return(result); } catch (RequestException ex) { throw ExceptionHandler.Parse(ex); } }
/// <summary> /// Updates a User. /// </summary> /// <param name="attributes"></param> /// <returns></returns> public async Task <User> Update(UserAttributes attributes) { if (CurrentSession == null || string.IsNullOrEmpty(CurrentSession.AccessToken)) { throw new Exception("Not Logged in."); } try { var result = await api.UpdateUser(CurrentSession.AccessToken, attributes); CurrentUser = result; StateChanged?.Invoke(this, new ClientStateChanged(AuthState.UserUpdated)); return(result); } catch (RequestException ex) { throw ParseRequestException(ex); } }
/// <summary> /// Updates the User data /// </summary> /// <param name="jwt"></param> /// <param name="attributes"></param> /// <returns></returns> public Task <User> UpdateUser(string jwt, UserAttributes attributes) { return(Helpers.MakeRequest <User>(HttpMethod.Put, $"{Url}/user", attributes, CreateAuthedRequestHeaders(jwt))); }
/// <summary> /// Update user by Id /// </summary> /// <param name="jwt">A valid JWT. Must be a full-access API key (e.g. service_role key).</param> /// <param name="userId"></param> /// <param name="userData"></param> /// <returns></returns> public static async Task <User> UpdateUserById(string jwt, StatelessClientOptions options, string userId, UserAttributes userData) { try { return(await GetApi(options).UpdateUserById(jwt, userId, userData)); } catch (RequestException ex) { throw ExceptionHandler.Parse(ex); } }
/// <summary> /// Update user by Id /// </summary> /// <param name="jwt">A valid JWT. Must be a full-access API key (e.g. service_role key).</param> /// <param name="userId"></param> /// <param name="data"></param> /// <returns></returns> public Task <User> UpdateUserById(string jwt, string userId, UserAttributes userData) { return(Helpers.MakeRequest <User>(HttpMethod.Put, $"{Url}/admin/users/{userId}", userData, CreateAuthedRequestHeaders(jwt))); }