コード例 #1
0
        /// <summary>
        /// Retrieves a report which is a collection of properties / statistics for a specific customer.
        /// Documentation https://developers.google.com/reports/reports_v1/reference/customerUsageReports/get
        /// 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 reports service.</param>
        /// <param name="date">Represents the date in yyyy-mm-dd format for which the data is to be fetched.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>UsageReportsResponse</returns>
        public static UsageReports Get(reportsService service, string date, CustomerUsageReportsGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (date == null)
                {
                    throw new ArgumentNullException(date);
                }

                // Building the initial request.
                var request = service.CustomerUsageReports.Get(date);

                // Applying optional parameters to the request.
                request = (CustomerUsageReportsResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CustomerUsageReports.Get failed.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Retrieves a list of activities for a specific customer and application.
        /// Documentation https://developers.google.com/reports/reports_v1/reference/activities/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 reports service.</param>
        /// <param name="userKey">Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.</param>
        /// <param name="applicationName">Application name for which the events are to be retrieved.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ActivitiesResponse</returns>
        public static Activities List(reportsService service, string userKey, string applicationName, ActivitiesListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }
                if (applicationName == null)
                {
                    throw new ArgumentNullException(applicationName);
                }

                // Building the initial request.
                var request = service.Activities.List(userKey, applicationName);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Activities.List failed.", ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Stop watching resources through this channel
        /// Documentation https://developers.google.com/reports/reports_v1/reference/channels/stop
        /// 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 reports service.</param>
        /// <param name="body">A valid reports reports_v1 body.</param>
        public static void Stop(reportsService service, Channel body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Channels.Stop(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Channels.Stop failed.", ex);
            }
        }