Esempio n. 1
0
        /// <summary>
        /// Method for media download. Download is supportedon the URI `/v1/media/{+name}?alt=media`.
        /// Documentation https://developers.google.com/youtubereporting/v1/reference/media/download
        /// 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 Youtubereporting service.</param>
        /// <param name="resourceName">Name of the media that is being downloaded.  SeeReadRequest.resource_name.</param>
        /// <returns>MediaResponse</returns>
        public static Media Download(YoutubereportingService service, string resourceName)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (resourceName == null)
                {
                    throw new ArgumentNullException(resourceName);
                }

                // Make the request.
                return(service.Media.Download(resourceName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Media.Download failed.", ex);
            }
        }
        /// <summary>
        /// Lists report types.
        /// Documentation https://developers.google.com/youtubereporting/v1/reference/reportTypes/list
        /// 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 Youtubereporting service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ListReportTypesResponseResponse</returns>
        public static ListReportTypesResponse List(YoutubereportingService service, ReportTypesListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.ReportTypes.List();

                // Applying optional parameters to the request.
                request = (ReportTypesResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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