Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of mini-venues partially matching the search term, near the location in an asynchronous operation
        /// </summary>
        /// <param name="term">A search term to be applied against titles. Must be at least 3 characters long.</param>
        /// <param name="location">A string naming a place in the world</param>
        /// <param name="limit">Number of results to return</param>
        /// <exception cref="ArgumentOutOfRangeException">If term is not at least 3 characters long</exception>
        /// <exception cref="ArgumentNullException">If location is null or empty</exception>
        /// <exception cref="HttpRequestException">If location could not be found</exception>
        /// <returns><c ref="MiniVenuesResponse" /> which contain Meta information about status code of the response and list of mini-venues</returns>
        public async Task <MiniVenuesResponse> GetVenueSuggestionsAsync(string term, string location, int limit = 30)
        {
            if (term.Length < 3)
            {
                throw new ArgumentOutOfRangeException(paramName: nameof(term));
            }

            if (string.IsNullOrEmpty(location))
            {
                throw new ArgumentNullException(paramName: nameof(location));
            }

            var invoker = WebServiceInvoker <MiniVenuesResponse> .Create(_httpClient, new Uri(
                                                                             URI_BASE +
                                                                             SUGGEST_COMPLETION +
                                                                             string.Format(CLIENT_ID, _clientId) +
                                                                             string.Format(CLIENT_SECRET, _clientSecret) +
                                                                             string.Format(NEAR, location) +
                                                                             string.Format(QUERY, term) +
                                                                             string.Format(LIMIT, limit) +
                                                                             VERSION +
                                                                             MODE
                                                                             ));

            return(await invoker.InvokeWebService());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a complete venue matching given id in an asynchronous operation
        /// </summary>
        /// <param name="id">ID of venue to retrieve</param>
        /// <exception cref="ArgumentNullException">If id is null or empty</exception>
        /// <returns><c ref="VenueResponse" /> which contain Meta information about status code of the response and a complete venue</returns>
        public async Task <VenueResponse> GetVenueAsync(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException(paramName: nameof(id));
            }

            var invoker = WebServiceInvoker <VenueResponse> .Create(_httpClient, new Uri(
                                                                        URI_BASE +
                                                                        id + "?" +
                                                                        string.Format(CLIENT_ID, _clientId) +
                                                                        string.Format(CLIENT_SECRET, _clientSecret) +
                                                                        VERSION +
                                                                        MODE
                                                                        ));

            return(await invoker.InvokeWebService());
        }