Esempio n. 1
0
        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="updates">更新项</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <User> UpdateProfile(
            UpdateUserInput updates,
            CancellationToken cancellationToken = default)
        {
            var param = new UpdateUserParam(updates);
            var res   = await Request <UpdateUserResponse>(param.CreateRequest(), cancellationToken);

            User = res.Result;
            return(res.Result);
        }
 /// <summary>
 /// 注销
 /// </summary>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public async Task Logout(CancellationToken cancellationToken = default)
 {
     await CheckLoggedIn();
     var param = new UpdateUserParam()
     {
         Id = CurrentUser.Id,
         Input = new UpdateUserInput()
         {
             TokenExpiredAt = "0",
         }
     };
     await Request<UpdateUserResponse>(param.CreateRequest(), cancellationToken);
     CurrentUser = null;
 }
Esempio n. 3
0
            /// <summary>
            /// 更新用户信息
            /// </summary>
            /// <param name="userId">用户 ID</param>
            /// <param name="updates">更新信息</param>
            /// <param name="cancellationToken"></param>
            /// <returns></returns>
            public async Task <User> Update(
                string userId,
                UpdateUserInput updates,
                CancellationToken cancellationToken = default)
            {
                updates.Password = client.Encrypt(updates.Password);
                var param = new UpdateUserParam(updates)
                {
                    Id    = userId,
                    Input = updates
                };

                var res = await client.Request <UpdateUserResponse>(param.CreateRequest(), cancellationToken);

                return(res.Result);
            }