Yortw / tweetmoasharp

TweetSharp is a fast, clean wrapper around the Twitter API.
Other
72 stars 22 forks source link

NuGet package contains old assemblies? #71

Closed trydis closed 6 years ago

trydis commented 6 years ago

Updated to the 5.0.0 package and tried to send a DM.

This resulted in the following exception:

{System.Net.WebException: The remote server returned an error: (415) Unsupported Media Type.   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)   at Hammock.Web.WebQuery.PostAsyncResponseCallback(IAsyncResult asyncResult)}

Looked at the source code, downloaded the NuGet package and decompiled the dll.

This is what I see:

public virtual Task<TwitterAsyncResult<TwitterDirectMessageResult>> SendDirectMessageAsync(SendDirectMessageOptions options)
{
      return this.WithHammockTask<TwitterDirectMessageResult>(this._client, WebMethod.Post, "direct_messages/events/new", (object) this.FormatAsString, (object) "?recipient_id=", (object) options.Recipientid, (object) "&text=", (object) options.Text, (object) "&media_type=", (object) options.Mediatype, (object) "&media_id=", (object) options.Mediaid, (object) "&quick_replies=", (object) options.Quickreplies);
}

It looks like the old version, not the latest:

public virtual TwitterDirectMessageResult SendDirectMessage(SendDirectMessageOptions options)
{
    var generator = new SendDirectMessageBodyGenerator();

    return WithHammock<TwitterDirectMessageResult>(_client, WebMethod.Post, "direct_messages/events/new" + FormatAsString, generator.GenerateBody(options), generator.ContentType);
}

So I'm wondering if the latest NuGet package contains old assemblies?

trydis commented 6 years ago

Ooops, I compared the async with the sync version.

I see that the async version hasn't been updated in the latest version:

public virtual  Task<TwitterAsyncResult<TwitterDirectMessageResult>> SendDirectMessageAsync(SendDirectMessageOptions options)
{
    var recipientId = options.Recipientid;
    var text = options.Text;
    var mediaType = options.Mediatype;
    var mediaId = options.Mediaid;
    var quickReplies = options.Quickreplies;

    return WithHammockTask<TwitterDirectMessageResult>(_client, WebMethod.Post, "direct_messages/events/new", FormatAsString, "?recipient_id=", recipientId, "&text=", text, "&media_type=", mediaType, "&media_id=", mediaId, "&quick_replies=", quickReplies);
}

I will use the sync version for now.

Yortw commented 6 years ago

Ah, my fault, sorry about this. I've just pushed a 5.1.0 package that I believe fixes this. Thanks.