示例#1
0
文件: WallCategory.cs 项目: odugen/vk
		public int GetExtended(long ownerId, out ReadOnlyCollection<Post> wallPosts, out ReadOnlyCollection<User> profiles, out ReadOnlyCollection<Group> groups, int? count = null, int? offset = null, WallFilter filter = WallFilter.All)
		{			   
			VkErrors.ThrowIfNumberIsNegative(() => count);
			VkErrors.ThrowIfNumberIsNegative(() => offset);
			if (filter == WallFilter.Suggests && ownerId >= 0)
				throw new ArgumentException("OwnerID must be negative in case filter equal to Suggests", "ownerId");

			var parameters = new VkParameters { { "owner_id", ownerId }, { "count", count }, { "offset", offset }, { "filter", filter.ToString().ToLowerInvariant() }, {"extended", 1} };
			var response = _vk.Call("wall.get", parameters);

		    wallPosts = response["items"].ToReadOnlyCollectionOf<Post>(r => r);
			profiles = response["profiles"].ToReadOnlyCollectionOf<User>(r => r);
			groups = response["groups"].ToReadOnlyCollectionOf<Group>(r => r);
		    return response["count"];
		}
示例#2
0
文件: WallCategory.cs 项目: odugen/vk
        public ReadOnlyCollection<Post> Get(long ownerId, out int totalCount, int? count = null, int? offset = null, WallFilter filter = WallFilter.All)
        {
            VkErrors.ThrowIfNumberIsNegative(() => count);
			VkErrors.ThrowIfNumberIsNegative(() => offset);
			if (filter == WallFilter.Suggests && ownerId >= 0)
		        throw new ArgumentException("OwnerID must be negative in case filter equal to Suggests", "ownerId");

	        var parameters = new VkParameters { { "owner_id", ownerId }, { "count", count }, { "offset", offset }, { "filter", filter.ToString().ToLowerInvariant() } };

			VkResponse response = _vk.Call("wall.get", parameters);

            totalCount = response["count"];

            VkResponseArray items = response["items"];
			return items.ToReadOnlyCollectionOf<Post>(r => r);
        }
示例#3
0
        public int GetExtended(long ownerId, out ReadOnlyCollection <Post> wallPosts, out ReadOnlyCollection <User> profiles, out ReadOnlyCollection <Group> groups, int?count = null, int?offset = null, WallFilter filter = WallFilter.All)
        {
            VkErrors.ThrowIfNumberIsNegative(() => count);
            VkErrors.ThrowIfNumberIsNegative(() => offset);
            if (filter == WallFilter.Suggests && ownerId >= 0)
            {
                throw new ArgumentException("OwnerID must be negative in case filter equal to Suggests", "ownerId");
            }

            var parameters = new VkParameters {
                { "owner_id", ownerId }, { "count", count }, { "offset", offset }, { "filter", filter.ToString().ToLowerInvariant() }, { "extended", 1 }
            };
            var response = _vk.Call("wall.get", parameters);

            wallPosts = response["items"].ToReadOnlyCollectionOf <Post>(r => r);
            profiles  = response["profiles"].ToReadOnlyCollectionOf <User>(r => r);
            groups    = response["groups"].ToReadOnlyCollectionOf <Group>(r => r);
            return(response["count"]);
        }
示例#4
0
        public ReadOnlyCollection <Post> Get(long ownerId, out int totalCount, int?count = null, int?offset = null, WallFilter filter = WallFilter.All)
        {
            VkErrors.ThrowIfNumberIsNegative(() => count);
            VkErrors.ThrowIfNumberIsNegative(() => offset);
            if (filter == WallFilter.Suggests && ownerId >= 0)
            {
                throw new ArgumentException("OwnerID must be negative in case filter equal to Suggests", "ownerId");
            }

            var parameters = new VkParameters {
                { "owner_id", ownerId }, { "count", count }, { "offset", offset }, { "filter", filter.ToString().ToLowerInvariant() }
            };

            VkResponse response = _vk.Call("wall.get", parameters);

            totalCount = response["count"];

            VkResponseArray items = response["items"];

            return(items.ToReadOnlyCollectionOf <Post>(r => r));
        }