Beispiel #1
0
        private List <Group> GetGroups(string request)
        {
            List <Group>       resultGroups = new List <Group>();
            List <Group>       newGroups    = new List <Group>();
            GroupsSearchParams groupsParams = new GroupsSearchParams
            {
                Query = request,
                //CityId = 110,
                Count  = 1000,
                Offset = 0
            };

            do
            {
                try
                {
                    newGroups = Vk.Groups.Search(groupsParams).ToList();
                }
                catch
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);
                        newGroups = Vk.Groups.Search(groupsParams).ToList();
                    }
                    catch
                    {
                    }
                }
                resultGroups.AddRange(newGroups);
                groupsParams.Offset += groupsParams.Count;
            }while (newGroups.Count != 0);
            return(resultGroups);
        }
Beispiel #2
0
        public ReadOnlyCollection <Group> Search(out int totalCount, GroupsSearchParams @params)
        {
            var response = _vk.Call("groups.search", @params, true);

            totalCount = response["count"];

            return(response["items"].ToReadOnlyCollectionOf <Group>(r => r));
        }
        public ReadOnlyCollection <Group> Search(out int totalCount, GroupsSearchParams @params)
        {
            var response = Search(@params);

            totalCount = Convert.ToInt32(response.TotalCount);

            return(response.ToReadOnlyCollection());
        }
Beispiel #4
0
 public List <Group> GetGroupsBySearchPhrase(string searchPhrase, int count = 1000)
 {
     using (var api = _apiFactory.CreateVkApi(true))
     {
         var p = new GroupsSearchParams()
         {
             Query = searchPhrase, Count = count
         };
         var searchRes = api.Groups.Search(p);
         var groups    = searchRes.ToList();
         return(groups);
     }
 }
Beispiel #5
0
        public ReadOnlyCollection <Group> Search([NotNull] string query, out int totalCount, uint?offset = null, uint?count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint?countryId = null, uint?cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new GroupsSearchParams
            {
                Query     = query,
                Sort      = sort,
                Count     = count,
                Offset    = offset,
                Type      = type,
                CityId    = cityId,
                CountryId = countryId,
                Future    = future
            };

            return(Search(out totalCount, parameters));
        }
Beispiel #6
0
        public ReadOnlyCollection<Group> Search(out int totalCount, GroupsSearchParams @params)
        {
            var response = _vk.Call("groups.search", @params, true);

            totalCount = response["count"];

            return response["items"].ToReadOnlyCollectionOf<Group>(r => r);
        }
Beispiel #7
0
 /// <summary>
 /// Осуществляет поиск сообществ по заданной подстроке.
 /// </summary>
 /// <param name="params">Входные параметры выборки.</param>
 /// <param name="skipAuthorization">Если <c>true</c>, то пропустить авторизацию</param>
 /// <returns>
 /// После успешного выполнения возвращает список объектов group.
 /// </returns>
 /// <remarks>
 /// Страница документации ВКонтакте http://vk.com/dev/groups.search
 /// </remarks>
 public VkCollection <Group> Search(GroupsSearchParams @params, bool skipAuthorization = false)
 {
     return(_vk.Call("groups.search", @params, skipAuthorization).ToVkCollectionOf <Group>(r => r));
 }
Beispiel #8
0
 /// <inheritdoc />
 public VkCollection <Group> Search(GroupsSearchParams @params, bool skipAuthorization = false)
 {
     return(_vk.Call(methodName: "groups.search", parameters: @params, skipAuthorization: skipAuthorization)
            .ToVkCollectionOf <Group>(selector: r => r));
 }
Beispiel #9
0
 /// <inheritdoc />
 public async Task <VkCollection <Group> > SearchAsync(GroupsSearchParams @params, bool skipAuthorization = false)
 {
     return(await TypeHelper.TryInvokeMethodAsync(() => _vk.Groups.Search(@params, skipAuthorization)));
 }
Beispiel #10
0
		public ReadOnlyCollection<Group> Search(out int totalCount, GroupsSearchParams @params)
		{
			VkResponseArray response = _vk.Call("groups.search", @params);

			totalCount = response[0];

			return response.Skip(1).ToReadOnlyCollectionOf<Group>(r => r);
		}
Beispiel #11
0
		public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCount, uint? offset = null, uint? count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint? countryId = null, uint? cityId = null, bool future = false)
		{
			VkErrors.ThrowIfNullOrEmpty(() => query);

			var parameters = new GroupsSearchParams
			{
				Query = query,
				Sort = sort,
				Count = count,
				Offset = offset,
				Type = type,
				CityId = cityId,
				CountryId = countryId,
				Future = future
			};

			return Search(out totalCount, parameters);
		}
Beispiel #12
0
 /// <inheritdoc />
 public Task <VkCollection <Group> > SearchAsync(GroupsSearchParams @params, bool skipAuthorization = false)
 {
     return(TypeHelper.TryInvokeMethodAsync(func: () =>
                                            Search(@params: @params, skipAuthorization: skipAuthorization)));
 }
Beispiel #13
0
		public VkCollection<Group> Search(GroupsSearchParams @params, bool skipAuthorization = false)
		{
			return _vk.Call("groups.search", @params, skipAuthorization).ToVkCollectionOf<Group>(r => r);
		}