当前位置: 首页>>代码示例>>C#>>正文


C# ProfileFields类代码示例

本文整理汇总了C#中ProfileFields的典型用法代码示例。如果您正苦于以下问题:C# ProfileFields类的具体用法?C# ProfileFields怎么用?C# ProfileFields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProfileFields类属于命名空间,在下文中一共展示了ProfileFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public User Get(long userId, ProfileFields fields = null,
            NameCase nameCase = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => userId);

            var parameters = new VkParameters { { "fields", fields }, { "name_case", nameCase }, { "user_ids", userId } };

            VkResponseArray response = _vk.Call("users.get", parameters, true);

            return response[0];
        }
开发者ID:Olegasdf,项目名称:vk,代码行数:11,代码来源:UsersCategory.cs

示例2: Get

        public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
        {
            if(listId != null && listId < 0)
				throw new ArgumentOutOfRangeException("listId", "listId must be a positive number.");
			
			var parameters = new VkParameters { { "user_id", uid }, { "fields", fields }, { "count", count }, { "offset", offset }, { "order", order }, {"list_id", listId} , {"name_case", nameCase}};

            var response = _vk.Call("friends.get", parameters);

		    if (fields != null)
                return response["items"].ToReadOnlyCollectionOf<User>(x => x);
		    return response.ToReadOnlyCollectionOf(id => new User { Id = id });
        }
开发者ID:odugen,项目名称:vk,代码行数:13,代码来源:FriendsCategory.cs

示例3: SearchAdvanced

        public ReadOnlyCollection<User> SearchAdvanced(out int itemsCount, Sex sex, int age_from, ProfileFields fields = null, int count = 20, int offset = 0)
        {
           
            var parameters = new VkParameters { { "q", "" }, { "fields", fields }, { "count", count }, {"sort", 1}, {"country", 1}, {"sex",sex}
            ,{"age_from", age_from}, {"online", 1}, {"has_photo", 1}};
            if (offset > 0)
                parameters.Add("offset", offset);

            VkResponseArray response = _vk.Call("users.search", parameters);

            itemsCount = response[0];

            return response.Skip(1).ToReadOnlyCollectionOf<User>(r => r);
        }
开发者ID:SaintCat,项目名称:VkBot,代码行数:14,代码来源:UsersCategory.cs

示例4: GetAll

        public ReadOnlyCollection<User> GetAll(long uid, ProfileFields fields = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
        {
            const int count = 50;
            var i = 0;
            var result = new List<User>();

            do
            {
                var currentItems = _friends.Get(uid, fields, count, i * count, order, nameCase, listId);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:FriendsCategoryExtended.cs

示例5: Get

        public User Get(int userId, ProfileFields[] fields = null, NameCase nameCase = NameCase.nom)
        {
            NameValueCollection qs = new NameValueCollection();
            qs["uids"] = userId.ToString();

            if (fields != null)
                qs["fields"] = String.Join(",", from field in fields select field.ToString());

            qs["name_case"] = nameCase.ToString();
            XmlDocument answer = VkResponse.ExecuteCommand("users.get", qs);
            XmlNode usersNodes = answer.SelectSingleNode("response/user");
            User user = new User(usersNodes);
            return user;
        }
开发者ID:natashalysakova,项目名称:VkApiLibarary,代码行数:14,代码来源:UserCategory.cs

示例6: GetAllFollowers

        public ReadOnlyCollection<User> GetAllFollowers(long? userId = null, ProfileFields fields = null, NameCase nameCase = null)
        {
            const int count = 1000;
            var i = 0;
            var result = new List<User>();

            do
            {
                var currentItems = _users.GetFollowers(userId, count, i * count, fields, nameCase);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:UsersCategoryExtended.cs

示例7: Search

        public ReadOnlyCollection<User> Search([NotNull] string query, out int itemsCount, ProfileFields fields = null, int count = 20, int offset = 0)
        {
            if (string.IsNullOrEmpty(query))
                throw new ArgumentException("Query can not be null or empty.");

            var parameters = new VkParameters { { "q", query }, { "fields", fields }, { "count", count } };
            if (offset > 0)
                parameters.Add("offset", offset);

            VkResponseArray response = _vk.Call("users.search", parameters);

            itemsCount = response[0];

            return response.Skip(1).ToReadOnlyCollectionOf<User>(r => r);
        }
开发者ID:J2GIS,项目名称:vk,代码行数:15,代码来源:UsersCategory.cs

示例8: Get

		public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
		{
			if (listId != null && listId < 0)
				throw new ArgumentOutOfRangeException("listId", "listId must be a positive number.");

			var parameters = new FriendsGetParams
			{
				UserId = uid,
				Count = count,
				Offset = offset,
				Fields = fields,
				NameCase = nameCase,
				ListId = listId,
				Order = order
			};

			return Get(parameters).ToReadOnlyCollection();
		}
开发者ID:kadkin,项目名称:vk,代码行数:18,代码来源:FriendsCategory.Obsolete.cs

示例9: FriendsGet

        public void FriendsGet(ProfileFields fields)
        {
            var wc = new WebClient();
            wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e)
            {
                var ob = JObject.Parse(e.Result);
                var list = ob["response"].Select(q => new Profile
                {
                    uid = (int)q["uid"],
                    first_name = (string)q["first_name"],
                    last_name = (string)q["last_name"],
                    online = (int)q["online"] == 1,
                    photo = (string)q["photo"],
                    photo_big = (string)q["photo_big"],
                    photo_medium = (string)q["photo_medium"],
                    sex = q["sex"] != null ? (int)q["sex"] : 0 // и .т.д.
                }).ToArray();
                FriendsGetComplited(list);

            };
            wc.DownloadStringAsync(new Uri(string.Format("https://api.vk.com/method/friends.get?access_token={0}&fields={1}&order=hints", access_token, fields.ToString().Replace(" ", ""))));
        }
开发者ID:klyuchnikov,项目名称:VKM,代码行数:22,代码来源:VKService.cs

示例10: get

 /// <summary>Возвращает список идентификаторов друзей пользователя или расширенную информацию о друзьях пользователя (при использовании параметра</summary>
 /// <param name="uid">идентификатор пользователя, для которого необходимо получить список друзей</param>
 /// <param name="fields">перечисленные через запятую поля анкет, необходимые для получения</param>
 /// <param name="name_case">падеж для склонения имени и фамилии пользователя</param>
 /// <param name="count">количество друзей, которое нужно вернуть</param>
 /// <param name="offset">смещение, необходимое для выборки определенного подмножества друзей</param>
 /// <param name="lid">идентификатор списка друзей, полученный методом friends</param>
 /// <param name="order">Порядок в котором нужно вернуть список друзей</param>
 /// <returns>Ответ сервера в XML или JSON формате.</returns>
 private VKResponseBase get(System.Int64? uid, ProfileFields? fields, NameCase? name_case, System.Int32? count, System.Int32? offset, System.Int64? lid, string order)
 {
     manager.AddValueByName("@uid", uid);
     manager.AddValueByName("@fields", fields);
     manager.AddValueByName("@name_case", name_case);
     manager.AddValueByName("@count", count);
     manager.AddValueByName("@offset", offset);
     manager.AddValueByName("@lid", lid);
     manager.AddValueByName("@order", order);
     return new VKResponseBase(GetResponse("get"), IsXMLResponse);
 }
开发者ID:salterok,项目名称:VK-2-years-old-,代码行数:20,代码来源:VKApiManager.Friends.cs

示例11: Get

 /// <summary>Возвращает список идентификаторов друзей пользователя или расширенную информацию о друзьях пользователя (при использовании параметра</summary>
 /// <param name="fields">перечисленные через запятую поля анкет, необходимые для получения</param>
 /// <param name="name_case">падеж для склонения имени и фамилии пользователя</param>
 /// <param name="lid">идентификатор списка друзей, полученный методом friends</param>
 /// <param name="count">количество друзей, которое нужно вернуть</param>
 /// <param name="offset">смещение, необходимое для выборки определенного подмножества друзей</param>
 /// <returns>Ответ сервера в XML или JSON формате.</returns>
 public VKResponseBase Get(ProfileFields fields, NameCase name_case, System.Int64? lid = null, System.Int32? count = null, System.Int32? offset = null)
 {
     return get(null, fields, name_case, count, offset, lid, null);
 }
开发者ID:salterok,项目名称:VK-2-years-old-,代码行数:11,代码来源:VKApiManager.Friends.cs

示例12: Get

        public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null)
        {
            var parameters = new VkParameters { { "uid", uid }, { "fields", fields }, { "count", count }, { "offset", offset }, { "order", order } };

            var response = _vk.Call("friends.get", parameters);

            if (fields != null)
                return response.ToReadOnlyCollectionOf<User>(x => x);

            return response.ToReadOnlyCollectionOf(id => new User { Id = id });
        }
开发者ID:G-IT-ED,项目名称:vk,代码行数:11,代码来源:FriendsCategory.cs

示例13: Get

 public User Get(long userId, ProfileFields fields = null, NameCase nameCase = null)
 {
     VkErrors.ThrowIfNumberIsNegative(() => userId);
     var users = Get(new[] {userId}, fields, nameCase);
     return users.FirstOrDefault();
 }
开发者ID:VladimirTyrin,项目名称:vk,代码行数:6,代码来源:UsersCategory.cs

示例14: GetFollowers

        public ReadOnlyCollection<User> GetFollowers(long? userId = null, int? count = null, int? offset = null, ProfileFields fields = null, NameCase nameCase = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => userId);
            VkErrors.ThrowIfNumberIsNegative(() => count);
            VkErrors.ThrowIfNumberIsNegative(() => offset);

            var parameters = new VkParameters
                {
                    {"user_id", userId},
                    {"offset", offset},
                    {"count", count},
                    {"fields", fields},
                    {"name_case", nameCase}
                };

            VkResponseArray response = _vk.Call("users.getFollowers", parameters);

            // проверка: возвращается массив объектов или только идентификаторы пользователей
            if (response.Count > 0 && response[0].ContainsKey("id"))
            {
                return response.ToReadOnlyCollectionOf<User>(x => x);
            }

            return response.ToReadOnlyCollectionOf(x => new User{Id = x});
        }
开发者ID:J2GIS,项目名称:vk,代码行数:25,代码来源:UsersCategory.cs

示例15: GetAsync

        public async Task<ReadOnlyCollection<User>> GetAsync([NotNull] IEnumerable<string> screenNames, ProfileFields fields = null, NameCase nameCase = null)
        {
            if (screenNames == null)
                throw new ArgumentNullException("screenNames");

            var parameters = new VkParameters
                {
                    { "user_ids", screenNames }, 
                    { "fields", fields }, 
                    { "name_case", nameCase }
                };

            VkResponseArray response = await _vk.CallAsync("users.get", parameters);
            return response.ToReadOnlyCollectionOf<User>(x => x);
        }
开发者ID:J2GIS,项目名称:vk,代码行数:15,代码来源:UsersCategory.cs


注:本文中的ProfileFields类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。