Example #1
0
        //public AuthHeaderFilter(
        //    ConsumerInfo consumerInfo,
        //    RequestTokenResponse requestToken,
        //    string requestUrl,
        //    SortedDictionary<string, string> requestParameters,
        //    HttpMessageHandler handler)
        //    : this(consumerInfo, requestToken, null, requestUrl, requestParameters, handler)
        //{
        //}

        public AuthHeaderFilter(
            ConsumerInfo consumerInfo,
            AccessTokenResponse accessToken,
            string requestUrl,
            SortedDictionary <string, string> requestParameters)
            : this(consumerInfo, null, accessToken, requestUrl, requestParameters, new HttpClientHandler())
        {
        }
Example #2
0
        //public AuthHeaderFilter(
        //    ConsumerInfo consumerInfo,
        //    AccessTokenResponse accessToken,
        //    string requestUrl,
        //    SortedDictionary<string, string> requestParameters,
        //    HttpMessageHandler handler)
        //    : this(consumerInfo, null, accessToken, requestUrl, requestParameters, handler)
        //{
        //}

        private AuthHeaderFilter(
            ConsumerInfo consumerInfo,
            RequestTokenResponse requestToken,
            AccessTokenResponse accessToken,
            string requestUrl,
            SortedDictionary <string, string> requestParameters,
            HttpMessageHandler handler)
            : base(handler)
        {
            this.consumerInfo      = consumerInfo;
            this.requestToken      = requestToken;
            this.accessToken       = accessToken;
            this.requestUrl        = requestUrl;
            this.requestParameters = requestParameters;
        }
Example #3
0
        // https://dev.twitter.com/docs/api/1.1/post/statuses/update
        public async Task <string> UpdateStatus(
            AccessTokenResponse oAuthAcessToken,
            string tweetString)
        {
            string response = String.Empty;

            SortedDictionary <string, string> requestParams = new SortedDictionary <string, string>();

            requestParams.Add(StatusParameter, tweetString);

            var handler = new AuthHeaderFilter(this.consumerInfo, oAuthAcessToken, UpdateStatusUrl, requestParams);

            response = await PostRequest(UpdateStatusUrl, requestParams, handler);

            // result
            // {"created_at":"Sun Jun 29 00:44:49 +0000 2014","id":483048408681152513,"id_str":"483048408681152513","text":"\u30c6\u30b9\u30c8PG\u304b\u3089Tweet at 2014\/06\/29 09:44:39.061 (1509971026)","source":"\u003ca href=\"http:\/\/app.strawhat.net\/TwitterSimpleClient\" rel=\"nofollow\"\u003eTwitterSimpleClient\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":15244042,"id_str":"15244042","name":"\u306e\u3076@\u3054\u6ce8\u6587\u306f\u3072\u3050\u307e\u3067\u3059\u304b","screen_name":"kumar0001","location":"Japan\/Nagoya","description":"\u30c6\u30c7\u30a3\u30d9\u30a2\u5236\u4f5c\uff08\u8da3\u5473\uff09\u3068SE\uff08\u672c\u696d\uff09\u3084\u3063\u3066\u308b\u4e09\u5341\u8def\u7537\u3067\u3059\u3002\u30c4\u30a4\u30fc\u30c8\u306e\u30b8\u30e3\u30f3\u30eb\u304c\u3044\u308d\u3044\u308d\u306a\u306e\u3067\u3054\u6ce8\u610f\u3092\u3000\u300a\u30ad\u30fc\u30ef\u30fc\u30c9\u300b\u30c6\u30c7\u30a3\u30d9\u30a2\u5236\u4f5c, \u718a(\u30b0\u30ea\u30ba\u30ea\u30fc\u30fb\u30a2\u30e1\u30ea\u30ab\u30af\u30ed\u30af\u30de)\uff0f\u30d6\u30bf, A\u30c1\u30e3\u30f3\u30cd\u30eb, IT(C#\/WP8\/Silverlight\/WPF), \u30ed\u30fc\u30bc\u30f3\u30e1\u30a4\u30c7\u30f3, \u72fc\u3068\u9999\u8f9b\u6599","url":"http:\/\/t.co\/kZjLv4nMsC","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/kZjLv4nMsC","expanded_url":"http:\/\/www.strawhat.net\/","display_url":"strawhat.net","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":658,"friends_count":749,"listed_count":48,"created_at":"Thu Jun 26 13:50:28 +0000 2008","favourites_count":6947,"utc_offset":32400,"time_zone":"Tokyo","geo_enabled":false,"verified":false,"statuses_count":87359,"lang":"ja","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"9AE4E8","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme16\/bg.gif","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme16\/bg.gif","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/461630005156392960\/BARks8-s_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/461630005156392960\/BARks8-s_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/15244042\/1398896172","profile_link_color":"0084B4","profile_sidebar_border_color":"BDDCAD","profile_sidebar_fill_color":"DDFFCC","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false,"lang":"ja"}

            return(response);
        }