Twitter4J 4.0.7 リリース

Twitter4J 4.0.7をthe Maven Central Repositoryにアップロードしました。

このバージョンはdestroyDirectMessageの挙動を除き*ほぼ*以前の4.0.xリリースと互換があります。

4.0.6からの違いはこちらでご確認ください。

これはJava 6, 7をサポートする最後のリリースとなる予定です。

次期リリースからはJava 8以降が必要となります。

#Twitter4J 4.0.7-SNAPSHOT リリース – DMを利用するアプリは要移行

最新のTwitter4JスナップショットビルドがTwitter4J.orgのリポジトリよりご利用いただけます。

Twitterは2018年8月16日に古き良きDMのエンドポイントを廃止します。

ダイレクトメッセージを扱うアプリケーションを引き続き稼働させるにはTwitter4J 4.0.7に移行してください。
バージョン4.0.7はごく一部を除きこれまでのバージョンと互換性があります。プロジェクトを再ビルドする必要はあります。

こちらで4.0.6から4.0.7でのAPIの変更を確認していただけます。

次のメソッドは非推奨となりました。
ResponseList getDirectMessages()
ResponseList getDirectMessages(Paging paging)
ResponseList getSentDirectMessages()
ResponseList getSentDirectMessages(Paging paging)

しかしながら、内部的にこれらの非推奨となったメソッドは新しいAPIを呼び出しています。つまり、Twitter4Jをバージョンアップしておけばアプリは今週の大量虐殺後も引き続き稼働しますのでご安心ください。

4.1か5.0かわかりませんが今後のリリースでこれらの非推奨メソッドは削除されますので適宜DirectMessageList getDirectMessages(int count)を使うように書き換えてください。

またdestroyDirectMessage(long id)は全てのgetterがUnsupportedOperationExceptionをスローするダミーオブジェクトを返しますので注意してください。。新しいエンドポイントは戻り値がないためです。

releasing #Twitter4J 4.0.7-SNAPSHOT – Apps using DM need to migrate

Latest Twitter4J snapshot build is now available at our in-house repository.

Twitter is going to sunset good old DM endpoints on August 16th, 2018.

In order to keep your chatbot working properly, you’ll need to migrate to Twitter4J 4.0.7.
This version is compatible with previous version with a slight exception. Rebuilding your application is required.

Here you can see the full list of API changes between 4.0.6 and 4.0.7.

The following methods are now deprecated.
ResponseList getDirectMessages()
ResponseList getDirectMessages(Paging paging)
ResponseList getSentDirectMessages()
ResponseList getSentDirectMessages(Paging paging)

The above deprecated methods are now internally invoking the latest and greatest end points. This means, your application will be working correctly without any changes even after the massacre coming this week.

But they will be removed in the future release – 4.1.0, 5.0.0 or whatever.
Please migrate to DirectMessageList getDirectMessages(int count) in a timely manner.

Note that destroyDirectMessage(long id) returns an object with dummy getters which throw UnsupportedOperationException, because the new endpoint doesn’t return any value.