/// <summary>
        /// takes a list of products, adds batch operation and adds each item to a feed
        /// </summary>
        /// <param name="products">the list of products to add to a feed</param>
        /// <returns>the created ProductFeed</returns>
        protected ProductFeed CreateBatchFeed(List <ProductEntry> products, GDataBatchOperationType operation)
        {
            ProductFeed feed = new ProductFeed(null, this);

            foreach (ProductEntry product in products)
            {
                if (product.BatchData != null)
                {
                    product.BatchData.Type = operation;
                }
                else
                {
                    product.BatchData = new GDataBatchEntryData(operation);
                }

                feed.Entries.Add(product);
            }

            return(feed);
        }
        /// <summary>
        /// takes a list of products, adds batch operation and adds each item to a feed
        /// </summary>
        /// <param name="products">the list of products to add to a feed</param>
        /// <returns>the created ProductFeed</returns>
        protected ProductFeed CreateBatchFeed(List<ProductEntry> products, GDataBatchOperationType operation) {
            ProductFeed feed = new ProductFeed(null, this);

            foreach(ProductEntry product in products)
            {
                if (product.BatchData != null) {
                    product.BatchData.Type = operation;
                }
                else {
                    product.BatchData = new GDataBatchEntryData(operation);
                }

                feed.Entries.Add(product);
            }

            return feed;
        }
 /// <summary>
 /// takes a given feed, and does a batch post of that feed
 /// </summary>
 /// <param name="feed">the feed to post</param>
 /// <returns>the returned ProductFeed</returns>
 public ProductFeed Batch(ProductFeed feed) {
     return Batch(feed, this.AccountId, this.Projection);
 }
 /// <summary>
 /// takes a given feed, and does a batch post of that feed
 /// </summary>
 /// <param name="feed">the feed to post</param>
 /// <param name="accountId">The account ID of the user.</param>
 /// <returns>the returned ProductFeed</returns>
 public ProductFeed Batch(ProductFeed feed, string accountId) {
     return Batch(feed, accountId, this.Projection);
 }
 /// <summary>
 /// takes a given feed, and does a batch post of that feed
 /// </summary>
 /// <param name="feed">the feed to post</param>
 /// <param name="accountId">The account ID of the user.</param>
 /// <param name="projection">a projection determining response values
 /// <returns>the returned ProductFeed</returns>
 public ProductFeed Batch(ProductFeed feed, string accountId, string projection) {
     Uri batchUri = CreateUri(accountId, "items/products", projection, "batch");
     return base.Batch(feed, batchUri) as ProductFeed;
 }
 /// <summary>
 /// Inserts a new product entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public ProductEntry Insert(ProductFeed feed, ProductEntry entry)
 {
     return base.Insert(feed, entry);
 }
        /// <summary>
        /// takes a list of products, adds delete as the batch operation and delete them
        /// </summary>
        /// <param name="products">the list of products to delete</param>
        /// <returns>the returned ProductFeed</returns>
        public ProductFeed DeleteProducts(List <ProductEntry> products)
        {
            ProductFeed feed = CreateBatchFeed(products, GDataBatchOperationType.delete);

            return(Batch(feed));
        }
        /// <summary>
        /// takes a list of products, adds delete as the batch operation and delete them
        /// </summary>
        /// <param name="products">the list of products to delete</param>
        /// <param name="accountId">The account ID of the user.</param>
        /// <param name="projection">a projection determining response values</param>
        /// <returns>the returned ProductFeed</returns>
        public ProductFeed DeleteProducts(List <ProductEntry> products, string accountId, string projection)
        {
            ProductFeed feed = CreateBatchFeed(products, GDataBatchOperationType.delete);

            return(Batch(feed, accountId, projection));
        }
        /// <summary>
        /// takes a list of products, adds update as the batch operation and updates them
        /// </summary>
        /// <param name="products">the list of products to update</param>
        /// <param name="accountId">The account ID of the user.</param>
        /// <returns>the returned ProductFeed</returns>
        public ProductFeed UpdateProducts(List <ProductEntry> products, string accountId)
        {
            ProductFeed feed = CreateBatchFeed(products, GDataBatchOperationType.update);

            return(Batch(feed, accountId));
        }
        /// <summary>
        /// takes a list of products, adds insert as the batch operation and inserts them
        /// </summary>
        /// <param name="products">the list of products to insert</param>
        /// <returns>the returned ProductFeed</returns>
        public ProductFeed InsertProducts(List <ProductEntry> products)
        {
            ProductFeed feed = CreateBatchFeed(products, GDataBatchOperationType.insert);

            return(Batch(feed));
        }
 /// <summary>
 /// takes a given feed, and does a batch post of that feed
 /// </summary>
 /// <param name="feed">the feed to post</param>
 /// <returns>the returned ProductFeed</returns>
 public ProductFeed Batch(ProductFeed feed)
 {
     return(Batch(feed, this.AccountId, this.Projection));
 }
        /// <summary>
        /// takes a given feed, and does a batch post of that feed
        /// </summary>
        /// <param name="feed">the feed to post</param>
        /// <param name="accountId">The account ID of the user.</param>
        /// <param name="projection">a projection determining response values
        /// <returns>the returned ProductFeed</returns>
        public ProductFeed Batch(ProductFeed feed, string accountId, string projection)
        {
            Uri batchUri = CreateUri(accountId, "items/products", projection, "batch");

            return(base.Batch(feed, batchUri) as ProductFeed);
        }
 /// <summary>
 /// Inserts a new product entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public ProductEntry Insert(ProductFeed feed, ProductEntry entry)
 {
     return(base.Insert(feed, entry));
 }