예제 #1
0
        public virtual Control GenerateSection()
        {
            var section = new ChannelSection(this);

            section.Initialize();
            return(section);
        }
        /// <summary>
        /// Update a channelSection.
        /// Documentation https://developers.google.com/youtube/v3/reference/channelSections/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Youtube service.</param>
        /// <param name="part">The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.The part names that you can include in the parameter value are snippet and contentDetails.</param>
        /// <param name="body">A valid Youtube v3 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ChannelSectionResponse</returns>
        public static ChannelSection Update(YoutubeService service, string part, ChannelSection body, ChannelSectionsUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (part == null)
                {
                    throw new ArgumentNullException(part);
                }

                // Building the initial request.
                var request = service.ChannelSections.Update(body, part);

                // Applying optional parameters to the request.
                request = (ChannelSectionsResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ChannelSections.Update failed.", ex);
            }
        }