Пример #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());
        }
Пример #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();
        }
Пример #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)}");
            }
        }
Пример #4
0
 public void Validate(IGeoSearchReverseParameters parameters)
 {
     _helpClientParametersValidator.Validate(parameters);
 }
Пример #5
0
 public Task <ITwitterResult <SearchGeoSearchResultDTO> > SearchGeoReverseAsync(IGeoSearchReverseParameters parameters, ITwitterRequest request)
 {
     return(_helpQueryExecutor.SearchGeoReverseAsync(parameters, request));
 }
Пример #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));
 }
Пример #7
0
        public async Task <IPlace[]> SearchGeoReverse(IGeoSearchReverseParameters parameters)
        {
            var result = await _helpRequester.SearchGeoReverse(parameters).ConfigureAwait(false);

            return(result?.DataTransferObject?.Result.Places);
        }
Пример #8
0
        public IEnumerable <IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
        {
            var query = _geoQueryGenerator.GetSearchGeoReverseQuery(parameters);

            return(_twitterAccessor.ExecuteGETQueryWithPath <IEnumerable <IPlace> >(query, "result", "places"));
        }
Пример #9
0
 public IEnumerable <IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return(_geoQueryExecutor.SearchGeoReverse(parameters));
 }
Пример #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));
 }
Пример #11
0
 public Task <ITwitterResult <SearchGeoSearchResultDTO> > SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     _validator.Validate(parameters);
     return(ExecuteRequest(request => _helpController.SearchGeoReverse(parameters, request)));
 }
Пример #12
0
        public async Task <IPlace[]> SearchGeoReverseAsync(IGeoSearchReverseParameters parameters)
        {
            var result = await _helpRequester.SearchGeoReverseAsync(parameters).ConfigureAwait(false);

            return(result?.Model?.Result.Places);
        }
Пример #13
0
 public IEnumerable<IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     var query = _geoQueryGenerator.GetSearchGeoReverseQuery(parameters);
     return _twitterAccessor.ExecuteGETQueryWithPath<IEnumerable<IPlace>>(query, "result", "places");
 }
Пример #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);
 }
Пример #15
0
 public IEnumerable<IPlace> SearchGeoReverse(IGeoSearchReverseParameters parameters)
 {
     return _geoQueryExecutor.SearchGeoReverse(parameters);
 }