Exemple #1
0
        /// <summary>
        /// Lookup a Postcode as an asynchronous operation. Returns all available data if found.
        /// </summary>
        /// <param name="link">A link returned in a PostcodeLookup response.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <example>
        /// The following code example creates an AutoaddressClient and calls PostcodeLookupAsync with a request then calls PostcodeLookupAsync again with one of the option links.
        /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientPostcodeLookupAsyncLinkExample1.cs" language="cs" />
        /// </example>
        public async Task <Model.PostcodeLookup.Response> PostcodeLookupAsync(Model.PostcodeLookup.Link link)
        {
            if (link == null)
            {
                throw new ArgumentNullException(nameof(link));
            }

            Uri requestUri = link.Href;
            var response   = await GetResponseAsync <Model.PostcodeLookup.Response>(link, requestUri);

            return(response);
        }
Exemple #2
0
        /// <summary>
        /// Lookup a Postcode. Returns all available data if found.
        /// </summary>
        /// <param name="link">A link returned in a PostcodeLookup response.</param>
        /// <returns>PostcodeLookup response.</returns>
        /// <example>
        /// The following code example creates an AutoaddressClient and calls PostcodeLookup with a request then calls PostcodeLookup again with one of the option links.
        /// <code source="..\src\Autoaddress2.0SDK.Test\Example\AutoaddressClientPostcodeLookupLinkExample1.cs" language="cs" />
        /// </example>
        public Model.PostcodeLookup.Response PostcodeLookup(Model.PostcodeLookup.Link link)
        {
            try
            {
                return(PostcodeLookupAsync(link).Result);
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    throw e.InnerException;
                }

                throw;
            }
        }