Beispiel #1
0
        /// <summary>
        /// Looks up political geography and representative information for a single address.
        /// Documentation https://developers.google.com/civicinfo/v2/reference/representatives/representativeInfoByAddress
        /// 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 Civicinfo service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>RepresentativeInfoResponseResponse</returns>
        public static RepresentativeInfoResponse RepresentativeInfoByAddress(CivicinfoService service, RepresentativesRepresentativeInfoByAddressOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Representatives.RepresentativeInfoByAddress();

                // Applying optional parameters to the request.
                request = (RepresentativesResource.RepresentativeInfoByAddressRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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