public void GroupsSortTest() { // get test Assert.That(GroupsSort.IdAsc.ToString(), Is.EqualTo("id_asc")); Assert.That(GroupsSort.IdDesc.ToString(), Is.EqualTo("id_desc")); Assert.That(GroupsSort.TimeAsc.ToString(), Is.EqualTo("time_asc")); Assert.That(GroupsSort.TimeDesc.ToString(), Is.EqualTo("time_desc")); // parse test Assert.That(GroupsSort.FromJsonString("id_asc"), Is.EqualTo(GroupsSort.IdAsc)); Assert.That(GroupsSort.FromJsonString("id_desc"), Is.EqualTo(GroupsSort.IdDesc)); Assert.That(GroupsSort.FromJsonString("time_asc"), Is.EqualTo(GroupsSort.TimeAsc)); Assert.That(GroupsSort.FromJsonString("time_desc"), Is.EqualTo(GroupsSort.TimeDesc)); }
public void GroupsSortTest() { // get test Assert.That(actual: GroupsSort.IdAsc.ToString(), expression: Is.EqualTo(expected: "id_asc")); Assert.That(actual: GroupsSort.IdDesc.ToString(), expression: Is.EqualTo(expected: "id_desc")); Assert.That(actual: GroupsSort.TimeAsc.ToString(), expression: Is.EqualTo(expected: "time_asc")); Assert.That(actual: GroupsSort.TimeDesc.ToString(), expression: Is.EqualTo(expected: "time_desc")); // parse test Assert.That(actual: GroupsSort.FromJsonString(response: "id_asc"), expression: Is.EqualTo(expected: GroupsSort.IdAsc)); Assert.That(actual: GroupsSort.FromJsonString(response: "id_desc"), expression: Is.EqualTo(expected: GroupsSort.IdDesc)); Assert.That(actual: GroupsSort.FromJsonString(response: "time_asc"), expression: Is.EqualTo(expected: GroupsSort.TimeAsc)); Assert.That(actual: GroupsSort.FromJsonString(response: "time_desc"), expression: Is.EqualTo(expected: GroupsSort.TimeDesc)); }
private static string GetSortQueryValue(GroupsSort sort) { switch (sort) { case GroupsSort.Ascending: return("asc"); case GroupsSort.Descending: return("desc"); default: throw new NotSupportedException($"GroupsSort {sort} is not supported"); } }
public ReadOnlyCollection<ulong> GetMembers(string gid, out int totalCount, uint? count = null, uint? offset = null, GroupsSort sort = null, GroupsFields fields = null, GroupsFilters filters = null) { var parameters = new VkParameters { { "gid", gid }, { "offset", offset }, { "sort", sort }, { "fields", fields }, { "filter", filters } }; if (count.HasValue && count.Value > 0 && count.Value < 1000) { parameters.Add("count", count); } var response = _vk.Call("groups.getMembers", parameters, true); totalCount = response["count"]; VkResponseArray users = response["users"]; return users.ToReadOnlyCollectionOf<ulong>(x => x); }
public ReadOnlyCollection<ulong> GetMembers(ulong gid, out int totalCount, uint? count = null, uint? offset = null, GroupsSort sort = null, GroupsFields fields = null, GroupsFilters filters = null) { return GetMembers(gid.ToString(), out totalCount, count, offset, sort, fields, filters); }
public ReadOnlyCollection<User> GetMembers(string gid, out int totalCount, uint? count = null, uint? offset = null, GroupsSort sort = null, UsersFields fields = null, GroupsFilters filters = null) { var parameters = new GroupsGetMembersParams { Offset = offset, Filter = filters, Fields = fields, Count = count, GroupId = gid, Sort = sort }; return GetMembers(out totalCount, parameters); }
public ReadOnlyCollection<User> GetMembers(long gid, out int totalCount, uint? count = null, uint? offset = null, GroupsSort sort = null, UsersFields fields = null, GroupsFilters filters = null) { VkErrors.ThrowIfNumberIsNegative(() => gid); var parameters = new GroupsGetMembersParams { GroupId = gid.ToString(), Count = count, Offset = offset, Sort = sort, Fields = fields, Filter = filters }; return GetMembers(out totalCount, parameters); }
public ReadOnlyCollection <User> GetMembers(string gid, out int totalCount, uint?count = null, uint?offset = null, GroupsSort sort = null, UsersFields fields = null, GroupsFilters filters = null) { var parameters = new GroupsGetMembersParams { Offset = offset, Filter = filters, Fields = fields, Count = count, GroupId = gid, Sort = sort }; return(GetMembers(out totalCount, parameters)); }
public ReadOnlyCollection<long> GetMembers(long gid, out int totalCount, uint? count = null, uint? offset = null, GroupsSort sort = null, GroupsFields fields = null, GroupsFilters filters = null) { VkErrors.ThrowIfNumberIsNegative(() => gid); return GetMembers(gid.ToString(), out totalCount, count, offset, sort, fields, filters); }
public ReadOnlyCollection <User> GetMembers(long gid, out int totalCount, uint?count = null, uint?offset = null, GroupsSort sort = null, UsersFields fields = null, GroupsFilters filters = null) { VkErrors.ThrowIfNumberIsNegative(() => gid); var parameters = new GroupsGetMembersParams { GroupId = gid.ToString(), Count = count, Offset = offset, Sort = sort, Fields = fields, Filter = filters }; return(GetMembers(out totalCount, parameters)); }
public ReadOnlyCollection<long> GetMembers(long gid, out int totalCount, int? count = null, int? offset = null, GroupsSort sort = null) { var parameters = new VkParameters { { "gid", gid }, { "offset", offset }, { "sort", sort } }; if (count.HasValue && count.Value > 0 && count.Value < 1000) parameters.Add("count", count); var response = _vk.Call("groups.getMembers", parameters, true); totalCount = response["count"]; VkResponseArray users = response["users"]; return users.ToReadOnlyCollectionOf<long>(x => x); }
public ReadOnlyCollection <ulong> GetMembers(ulong gid, out int totalCount, uint?count = null, uint?offset = null, GroupsSort sort = null, GroupsFields fields = null, GroupsFilters filters = null) { return(GetMembers(gid.ToString(), out totalCount, count, offset, sort, fields, filters)); }
public ReadOnlyCollection <long> GetMembers(long gid, out int totalCount, uint?count = null, uint?offset = null, GroupsSort sort = null, GroupsFields fields = null, GroupsFilters filters = null) { VkErrors.ThrowIfNumberIsNegative(() => gid); return(GetMembers(gid.ToString(), out totalCount, count, offset, sort, fields, filters)); }
public ReadOnlyCollection<long> GetAllMembers(long gid, out int totalCount, GroupsSort sort = null) { const int count = 1000; var i = 0; var result = new List<long>(); do { var currentItems = _groups.GetMembers(gid, out totalCount, count, i * count, sort); if (currentItems != null) result.AddRange(currentItems); } while (++i * count < (_vk.CountFromLastResponse ?? 0)); return result.ToReadOnlyCollection(); }