Esempio n. 1
0
        public string GetSearchGeoReverseQuery(IGeoSearchReverseParameters parameters)
        {
            if (parameters.Coordinates == null)
            {
                throw new ArgumentException("You must provide valid coordinates.");
            }

            var query = new StringBuilder(Resources.Geo_SearchGeoReverse);

            if (parameters.Coordinates != null)
            {
                query.AddParameterToQuery("lat", parameters.Coordinates.Latitude);
                query.AddParameterToQuery("long", parameters.Coordinates.Longitude);
            }

            if (parameters.Granularity != Granularity.Undefined)
            {
                query.AddParameterToQuery("granularity", parameters.Granularity.ToString().ToLowerInvariant());
            }

            query.AddParameterToQuery("accuracy", parameters.Accuracy);
            query.AddParameterToQuery("max_results", parameters.MaximumNumberOfResults);
            query.AddParameterToQuery("callback", parameters.Callback);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Esempio n. 2
0
        public string GetSearchGeoReverseQuery(IGeoSearchReverseParameters parameters)
        {
            if (parameters.Coordinates == null)
            {
                throw new ArgumentException("You must provide valid coordinates.");
            }

            var query = new StringBuilder(Resources.Geo_SearchGeoReverse);

            if (parameters.Coordinates != null)
            {
                query.AddParameterToQuery("lat", parameters.Coordinates.Latitude);
                query.AddParameterToQuery("long", parameters.Coordinates.Longitude);
            }

            if (parameters.Granularity != Granularity.Undefined)
            {
                query.AddParameterToQuery("granularity", parameters.Granularity.ToString().ToLowerInvariant());
            }

            query.AddParameterToQuery("accuracy", parameters.Accuracy);
            query.AddParameterToQuery("max_results", parameters.MaximumNumberOfResults);
            query.AddParameterToQuery("callback", parameters.Callback);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return query.ToString();
        }
Esempio n. 3
0
        public void Validate(IGeoSearchReverseParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (parameters.Coordinates == null)
            {
                throw new ArgumentNullException($"{nameof(parameters)}.{nameof(parameters.Coordinates)}");
            }
        }
Esempio n. 4
0
 public void Validate(IGeoSearchReverseParameters parameters)
 {
     _helpClientParametersValidator.Validate(parameters);
 }
Esempio n. 5
0
 public Task <ITwitterResult <SearchGeoSearchResultDTO> > SearchGeoReverseAsync(IGeoSearchReverseParameters parameters, ITwitterRequest request)
 {
     return(_helpQueryExecutor.SearchGeoReverseAsync(parameters, request));
 }
Esempio n. 6
0
 public Task <ITwitterResult <SearchGeoSearchResultDTO> > SearchGeoReverseAsync(IGeoSearchReverseParameters parameters, ITwitterRequest request)
 {
     request.Query.Url        = _helpQueryGenerator.GetSearchGeoReverseQuery(parameters);
     request.Query.HttpMethod = HttpMethod.GET;
     return(_twitterAccessor.ExecuteRequestAsync <SearchGeoSearchResultDTO>(request));
 }
Esempio n. 7
0
        public async Task <IPlace[]> SearchGeoReverse(IGeoSearchReverseParameters parameters)
        {
            var result = await _helpRequester.SearchGeoReverse(parameters).ConfigureAwait(false);

            return(result?.DataTransferObject?.Result.Places);
        }
Esempio n. 8
0
        public IEnumerable <IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
        {
            var query = _geoQueryGenerator.GetSearchGeoReverseQuery(parameters);

            return(_twitterAccessor.ExecuteGETQueryWithPath <IEnumerable <IPlace> >(query, "result", "places"));
        }
Esempio n. 9
0
 public IEnumerable <IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return(_geoQueryExecutor.SearchGeoReverse(parameters));
 }
Esempio n. 10
0
 /// <summary>
 /// Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status.
 /// </summary>
 public static IEnumerable <IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return(GeoController.SearchGeoReverse(parameters));
 }
Esempio n. 11
0
 public Task <ITwitterResult <SearchGeoSearchResultDTO> > SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     _validator.Validate(parameters);
     return(ExecuteRequest(request => _helpController.SearchGeoReverse(parameters, request)));
 }
Esempio n. 12
0
        public async Task <IPlace[]> SearchGeoReverseAsync(IGeoSearchReverseParameters parameters)
        {
            var result = await _helpRequester.SearchGeoReverseAsync(parameters).ConfigureAwait(false);

            return(result?.Model?.Result.Places);
        }
Esempio n. 13
0
 public IEnumerable<IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     var query = _geoQueryGenerator.GetSearchGeoReverseQuery(parameters);
     return _twitterAccessor.ExecuteGETQueryWithPath<IEnumerable<IPlace>>(query, "result", "places");
 }
Esempio n. 14
0
 /// <summary>
 /// Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status.
 /// </summary>
 public static IEnumerable<IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return GeoController.SearchGeoReverse(parameters);
 }
Esempio n. 15
0
 public IEnumerable<IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return _geoQueryExecutor.SearchGeoReverse(parameters);
 }