Beispiel #1
0
        /***************************************************/
        private static string SearchStandard(Credentials credentials, string query)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            string          url             = "https://api.twitter.com/1.1/search/tweets.json";
            OAuthParameters OAuthParameters = Create.OAuthParameters(credentials);

            string basestring = buildBaseString(query, OAuthParameters, url);

            OAuthParameters.AddOAuthSignature(basestring);

            //Tell Twitter we don't do the 100 continue thing
            ServicePointManager.Expect100Continue = false;
            string authheader = authorizationHeaderParams(OAuthParameters);

            var client  = new RestClient(url);
            var request = new RestRequest(Method.GET);

            request.AddHeader("content-type", "application/x-www-form-urlencoded");
            request.AddHeader("Authorization", authheader);
            request.AddQueryParameter("q", query);
            IRestResponse response = client.Execute(request);

            return(response.ToResults("statuses"));
        }