示例#1
0
 /// <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);
     }
 }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        /// <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);
            }
        }
示例#4
0
 /// <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)));
 }
示例#5
0
 /// <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);
     }
 }
示例#6
0
 /// <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)));
 }