コード例 #1
0
        /// <summary>
        /// Retrieve the description of a particular version of an api.
        /// Documentation https://developers.google.com/discovery/v1/reference/apis/getRest
        /// 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 discovery service.</param>
        /// <param name="api">The name of the API.</param>
        /// <param name="version">The version of the API.</param>
        /// <returns>RestDescriptionResponse</returns>
        public static RestDescription GetRest(discoveryService service, string api, string version)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (api == null)
                {
                    throw new ArgumentNullException(api);
                }
                if (version == null)
                {
                    throw new ArgumentNullException(version);
                }

                // Make the request.
                return(service.Apis.GetRest(api, version).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Apis.GetRest failed.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Retrieve the list of APIs supported at this endpoint.
        /// Documentation https://developers.google.com/discovery/v1/reference/apis/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 discovery service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>DirectoryListResponse</returns>
        public static DirectoryList List(discoveryService service, ApisListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

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

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