public string Get(string id, string token)
        {
            Console.WriteLine(id);
            //string uid = User.Identity.GetUserId();
            //Console.WriteLine(uid);
            //TwitterRestClient restClient = new TwitterRestClient(httpVerb.GET);
            //restClient.endpoint = twEndpoint.getpostsEndpoint(id);
            //string response = restClient.makeRequest();
            //return response;
            //string ConsumerKey = "npU8x3dfRNhnvCgTjg6gz9O62";
            //string ConsumerKeySecret = "eAXEcDQ7togqXZlUhZUkXMlfJrRFVuAwhkrxgBl1ggCpnkay3H";
            //string OauthSignatureMethod = "HMAC-SHA1";
            //string AccessToken = "1268709200420638720-Huq2PohLDEk001YNIFQUERjtn7r0V1";
            //string AccessTokenSecret = "4RMJCtf76Adtj7HiZsvXAq7j0sHRqi1NOwFAIN4NyxPHH";
            //string OauthVersion = "1.0";
            Keys keys = new Keys(id, token);

            string AuthSign = keys.createHeader(twEndpoint.getTimeline(), "GET");

            twEndpoint.Signature(AuthSign);
            RestClient restClient = new RestClient(httpVerb.GET);

            restClient.endpoint = twEndpoint.getTimeline();
            return(restClient.makeRequest(httpVerb.GET, twEndpoint.getEndpoint()));
        }
        public string Get(string id, string token)
        {
            Console.WriteLine(id);
            Keys keys = new Keys(id, token);

            string AuthSign = keys.createHeader(twEndpoint.getFriends(), "GET");

            twEndpoint.Signature(AuthSign);
            RestClient restClient = new RestClient(httpVerb.GET);

            restClient.endpoint = twEndpoint.getFriends();
            return(restClient.makeRequest(httpVerb.GET, twEndpoint.getEndpoint()));
        }
Beispiel #3
0
        public string Post([FromBody] JObject id)
        {
            Console.WriteLine(id);
            string token   = (string)id["token"];
            string message = (string)id["message"];
            string secret  = (string)id["secret"];

            Keys keys = new Keys(token, secret);

            string AuthSign = keys.createHeader(twEndpoint.postTweet(), "POST", message);

            twEndpoint.Signature(AuthSign);
            RestClient restClient = new RestClient(httpVerb.POST);

            restClient.endpoint = twEndpoint.postTweet();
            return(restClient.makeRequest(httpVerb.POST, twEndpoint.getEndpoint(), message));

            //RestClient restClient = new RestClient(httpVerb.POST);
            //return restClient.tweetRequest(secret, message, token);
        }