public string GetSearchTweetsV2Query(ISearchTweetsV2Parameters parameters)
        {
            var query = new StringBuilder("https://api.twitter.com/2/tweets/search/recent");

            query.AddParameterToQuery("query", parameters.Query);
            query.AddParameterToQuery("end_time", parameters.EndTime?.ToString("yyy-MM-ddThh:mm:ssZ"));
            query.AddParameterToQuery("max_results", parameters.PageSize);
            query.AddParameterToQuery("next_token", parameters.NextToken);
            query.AddParameterToQuery("since_id", parameters.SinceId);
            query.AddParameterToQuery("start_time", parameters.StartTime?.ToString("yyy-MM-ddThh:mm:ssZ"));
            query.AddParameterToQuery("until_id", parameters.UntilId);
            _tweetsV2QueryGenerator.AddTweetFieldsParameters(parameters, query);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Exemplo n.º 2
0
        public Task StartAsync(IStartFilteredStreamV2Parameters parameters)
        {
            var query = new StringBuilder("https://api.twitter.com/2/tweets/search/stream");

            _tweetsV2QueryGenerator.AddTweetFieldsParameters(parameters, query);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(base.StartAsync(query.ToString(), json =>
            {
                try
                {
                    var response = _client.Json.Deserialize <FilteredStreamTweetV2Response>(json);
                    return new FilteredStreamTweetV2EventArgs(response, json);
                }
                catch (Exception)
                {
                    return null;
                }
            }));
        }