Exemplo n.º 1
0
        /// <summary>
        /// 获取信息
        /// </summary>
        /// <param name="user">用户</param>
        /// <returns></returns>
        public static async Task <string> GetInfoAsync(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            QueryCollection queries;

            queries = new QueryCollection {
                { "access_key", user.LoginData["access_key"] },
                { "ts", ApiUtils.GetTimeStamp().ToString() }
            };
            queries.AddRange(user.LoginData["cookie"].Split(';').Select(item => {
                string[] pair;

                pair = item.Split('=');
                return(new KeyValuePair <string, string>(pair[0], pair[1]));
            }));
            queries.AddRange(General);
            queries.SortAndSign();
            using (HttpResponseMessage response = await user.Client.SendAsync(HttpMethod.Get, OAUTH2_INFO_URL, queries, user.AppHeaders))
                return(await response.Content.ReadAsStringAsync());
        }