示例#1
0
 public override IObservable<TwitterStatus> Upload(Authorize.AuthenticateInfo authInfo, string status,
     byte[] attachedImageBin, long? in_reply_to_status_id = null,
     double? geo_lat = null, double? geo_long = null)
 {
     var param = new Dictionary<string, object>()
     {
         {"key", ApplicationKey},
         {"message", status},
     }.Parametalize();
     return new MultipartableOAuthClient(ApiEndpoint.DefaultConsumerKey, ApiEndpoint.DefaultConsumerSecret,
         authInfo.AccessToken)
     {
         Url = ApiEndpointUriString,
     }
     .AsOAuthEcho()
     .GetResponse(param.Select(p => new UploadContent(p.Key, p.Value))
         .Append(UploadContent.FromBinary("media", "attach.png", attachedImageBin)))
     .ReadString()
     .Select(s =>
     {
         using (var reader = new StringReader(s))
         {
             var doc = XDocument.Load(reader);
             return doc.Element("image").Element("url").ParseString();
         }
     })
     .SelectMany(s => authInfo.Update(status + " " + s, in_reply_to_status_id, geo_lat, geo_long));
 }