Skip to content

Releases: yupix/MiPAC

v0.5.1

03 Oct 12:34
26a59f9
Compare
Choose a tag to compare

Important

次のv0.6からpypiで提供されるMiPACは最新のMisskeyにのみ最適化されたものとなります。今後もv11やv12を利用する場合はこのリポジトリでsharedブランチを指定し、 pip install git+ 形式でインストールするようお願いします。最優先でv13をやっているため、まだ準備できていませんが、今後はバージョンごとにブランチを分けてそこでそのバージョンに特化した形で提供します

MeDetailed モデルが追加され、自身に関する情報より多く扱えるようになりました

今後は API を使用した際に自動でユーザーが自分自身かを判断し、自身であった場合は UserDetailed ではなく、 MeDetailed を返すようになります。
MeDetailedUserDetailed の共有体型の場合は isinstance を用いて判断が行えます。
また、RoleUser 等のように専用のユーザーモデルがある場合は MeRole のようなモデルを作成し、どちらかを返すようになります。

※まだ全てのメソッドに適応されたわけではなく、ごく一部のみの適応となっています。

async def main():
    async with Client("https://nr.akarinext.org", "token") as client:
        api = client.api
        users = await api.admin.action.show_users(username="yupix")
        for user in users:
            if isinstance(user, MeDetailed):
                print(user.is_admin)
  • LiteUser モデルに badge_roles プロパティーが追加されました

以下のエンドポイントがサポートされました

エンドポント MiPAC でのメソッド
/api/admin/invite/create api.admin.invite.action.create_invite
/api/admin/invite/list api.admin.invite.action.get_invite_list
/api/roles/list api.role.action.get_list
/api/roles/show api.role.action.get
/api/roles/users api.role.action.get_users
/api/roles/notes api.role.action.get_notes

Fixed 🛠️

  • RoleUser モデルで LiteUser を使用していましたが、正しくは UserDetailed

依存関係の更新 📦

  • aiohttp: 3.8.4 => 3.8.5

貢献者向け情報

axblack を使ったフォーマットを辞めました

理由としては axblack の更新が止まっており、また移行先である blue も更新が止まっているからです。今後は 通常の black を使用したフォーマット使用するようにお願いします。

Model には AbstractModel を継承してください

pagination_iterator 関数が新規に追加され、pagination の処理を楽に使えるようになりました。その際に Model 以外のクラスを受け取らないよう識別するのに使用します。

v0.5.0

26 Jul 00:55
7ccf797
Compare
Choose a tag to compare

New Features ✨

Clientasync with 構文がサポートされました

一時的にセッションを作成したい場合などに login メソッドや close_session メソッドを使用するのは非常に手間であるため、一時的にセッションを作成したいといった場合におすすめします。

async with Client('server url', 'token') as client:
    api = client.api
    async for emoji in api.admin.emoji.action.gets():
        print(emoji)

一意のIDを持つモデルで比較演算がサポートされました

サポートされた演算は __eq____ne__ の2つです。一意のIDと判断しにくい物は現状サポートしていません。
一意のIDがあるにもかかわらず、サポートされていないモデルがある際はIssueを作成してください。

note_one = await api.note.action.get('note one')
note_two = await api.note.action.get('note one')
note_three = await api.note.action.get('note two')
print(note_one == note_two, note_one != note_two)
print(note_one == note_three, note_one != note_three)

File モデルに api プロパティーが追加されました

今まではモデルに api プロパティーが無かったため、 api プロパティーからアクションにアクセスし、対象のメソッドに対してファイルIDなどといった引数を自分で渡す必要がありましたが、今後はモデルから直接実行できます。

-async for file in api.drive.file.action.get_files(get_all=True):
-  await api.drive.file.action.remove(file.id)
+async for file in api.drive.file.action.get_files(get_all=True):
+  await file.api.action.remove()

FileActionssave メソッドが追加されました

指定したパス、またはBufferにファイルをダウンロードできるようになりました。
パスを指定する場合

async for file in api.drive.file.action.get_files(get_all=True):
    await file.api.action.save(f'./test/{file.name}')

Bufferを指定する場合:

async for file in api.drive.file.action.get_files(get_all=True):
    with open(f'./test/{file.name}', mode='mb') as f:
      await file.api.action.save(f)

以下のエンドポイントがサポートされました

  • /api/admin/emoji/set-license-bulk
  • /api/antennas/create
  • /api/antennas/delete
  • /api/antennas/list
  • /api/antennas/notes
  • /api/antennas/show
  • /api/antennas/update
  • /api/clips/create
  • /api/clips/delete
  • /api/clips/list
  • /api/clips/show
  • /api/clips/update
  • /api/notes/clips
  • /api/clips/add-note
  • /api/clips/remove-note
  • /api/clips/notes
  • /api/clips/my-favorites
  • /api/users/clips
  • /api/channels/create
  • /api/channels/featured
  • /api/channels/follow
  • /api/channels/followed
  • /api/channels/owned
  • /api/channels/show
  • /api/channels/unfollow
  • /api/channels/update
  • /api/channels/favorite
  • /api/channels/unfavorite
  • /api/channels/my-favorites
  • /api/channels/search

Breaking changes 💔

全取得の際の引数 allget_all に変更されます。

影響を受けるのはキーワード引数を使用していた方です。位置引数を使用していた方は特に問題ありません。

-Client.api.admin.emoji.action.gets(all=True)
+Client.api.admin.emoji.action.gets(get_all=True)

NoteManager.get メソッドが削除されました

何故あったのか分かりませんが、Managerの責務から逸脱しているためです

NoteActionsに関する変更

  • NoteActions.get NoteActions.fetch メソッドにおいて note_id が optionalになっているのはおかしいため必須の引数に変更しました

Fixed 🛠️

  • 一部 all 引数が存在しないが、 built-inの all が存在することで動作していた箇所が修正されました
  • ClientNoteActions において note_id が無かった場合の例外処理が無かった為追加

Other notable changes 📜

  • 新しい実績をサポートしました
  • クリップがサポートされました
  • ロールの作成時に is_explorable を使用できるようになりました。
    • 最新のインスタンス等で無いと使用できない可能性があります
  • update_metaのリクエスト時に server_rules パラメータが使用できるようになりました
    • このパラメータは 13.11.3 以降のバージョン(13.11.3は含みません)を使用している場合は必須であり、それ以前のバージョンを使用している場合は指定するとエラーが発生する可能性があります。
  • NoteActions.get_repliesClientNoteActions.getriplies に移動され、 ClientNoteActions でも使用可能になりました。(NoteActionsはClientNoteActionsを継承しているため今後とも使用できます)
  • 全取得が以下のメソッドでサポートされました。それに伴い、一部のメソッドがジェネレーターになっています。
    • FederationActions.get_followers
    • FederationActions.get_following
    • FederationActions.get_users
    • AdminAnnouncementActions.gets
    • AdminRoleModelActions.get_users
    • AdminAdvertisingActions.get_list
    • AdminActions.get_moderation_logs
    • NoteActions.get_replies
    • NoteActions.gets
    • FileActions.get_files
    • ClientFolderActions.get_files
    • DriveActions.get_folders
  • Pagination クラスが追加されました
    • 基本的にユーザーが使うことは想定されていません
  • @omg-xtao can cancel setup_logging when init client.
  • models/user にあった FollowRequest クラスが削除されました

v0.4.99

18 Jun 02:30
7375330
Compare
Choose a tag to compare
v0.4.99 Pre-release
Pre-release
feat: apiのエラーでmessageだけでなく、生のエラーも表示するように

v0.4.3

25 Apr 08:40
7ae446e
Compare
Choose a tag to compare

Added

  • 以下のエンドポイントがサポートされます。
    • emoji
    • channels/favorite
    • channels/unfavorite
    • channels/my-favorites
  • 以下のクラスを追加
    • IChannelNote
    • PartialNote
  • Note クラスで tags を取得できるように
  • Client クラスのコンストラクタ引数に以下を追加
    • use_version
    • use_version_autodetect
  • ClientManager に属性 emoji を追加
  • Channelapi プロパティを追加
  • CustomEmojihost プロパティを追加
  • ChannelLiteapi プロパティを追加
  • Folderapi プロパティを追加
  • Fileapi プロパティを追加
    • Channel クラスは ChannelLite を継承しているため必然的にこちらにも api プロパティが増えています

Changed

  • FileActionsremove_file メソッドが非推奨になります。 今後は remove メソッドをご利用ください。
  • v0.5.0で削除されます。
  • INoteRequiredIPartialNote に変更されました
  • mipac.util モジュールは mipac.utils 配下の auth, cache, format, log, utilの 5 つに分離しました。そのため v0.5.0で削除されます。
    • 今後は mipac.utils.* をご利用ください

Fixed

  • FileActions クラスの show_file メソッドで引数にデフォルト値が入っていないのを修正
  • Note のプロパティで一部戻り値が正しくない
  • ChannelLite クラスに is_following プロパティは存在してはいけないので修正
    • tip: Channel クラスに移動されました

v0.4.2

21 Mar 19:19
21fbd83
Compare
Choose a tag to compare

Added

config.features が追加されました

MiPACはv13, v12, v11という大きな区切りでエンドポイントが利用可能かを確認しています。その都合上、v13でサポートされいた物、例えばチャットが13.7.0で廃止されたような場合、MiPACは最新のMisskeyに追従しているため、デフォルトの挙動を変更します。これにより、13.7.0に更新してなかったり、forkを使用していてチャットが存在する場合でもチャットを使用すると例外であるNotSupportVersionが発生してしまいます。その対策としてこの機能が追加されました。
このconfigの主な役割は以下の通りです。

  • 最新のMisskeyでは使用できないが、自身が使用しているサーバーのバージョンでは使用できる場合に該当する物を有効にすることで例外を返さず、使用できるようにする

使い方は以下の通りです。また、現在サポートされているfeatureはchatのみです。

async def main():
    client = Client(auth.currentUser.url, auth.currentUser.token)
    await client.http.login()
    api = client.api
    client.config.from_dict(features={'chat': True})

config.limits が追加されました

MiPACでは文字数等にデフォルトで最新のMisskeyの値を入れています。しかし、一部のForkで文字数の制限が緩和されている・制限されている場合に正しくエラーを返せなくなる可能性があります。その対策としてこの機能が追加されました。

また、自分で作成・使用しているForkでこれ存在するからデフォルトでサポートしてくれない?という物がありましたら、Issueを作成してくだされば検討します。

  • Note周りのメソッドでvisibilityの型を正確に
  • 以下のエンドポイントがサポートされます。
    • i/claim-achievement
    • blocking/create
    • blocking/delete
    • blocking/list
    • admin/ad/create
    • admin/ad/delete
    • admin/ad/list
    • admin/ad/update
  • Added IT_ACHIEVEMENT_NAME fixed variable.
  • Added class the given below.
    • Channel
      • IChannelLite
      • ChannelLite
      • ChannelActions
      • ChannelManager
    • Blocking
      • BlockingUser
      • IBlockingUser
      • BlockingActions
      • BlockingManager
    • Ad
      • AdminAdvertisingModelActions
      • AdminAdvertisingActions
      • Ad
      • IAd
      • AdminAdvertisingModelManager
      • AdminAdvertisingManager
  • Added block attribute to UserManager.
  • Added channel attribute to ClientManager.
  • Added reaction_emojis property to Note.
  • Added reaction_acceptance property to Note.

Changed

  • chatがv13で廃止された為v13を利用している際は例外を返すように変更しました。
    • v13だが、forkやchatが廃止される前のバージョンを使用していてチャットが使用したい際は新しい機能である config.features をご利用ください
  • aiohttpのバージョンを 3.8.4に固定
  • Tokenを使用しなくてもAPIが一部使用できるようになりました。当然ですが、認証が必要なAPIを使用した場合はエラーが出ます。
  • Config.from_dict の引数が全てキーワード引数になりました。これは今後Configに引数が増えた際など、変更に強くするためです。

Removed

  • サポートする気が無いため、sphinxを用いたドキュメントを削除

Fixed

  • Note.replyのキーがrenoteになっていて取得不可になっていた

v0.4.1

13 Mar 14:55
10441d4
Compare
Choose a tag to compare

Added

バージョンの自動検出機能が追加されました(β)

これはデフォルトで有効になっており、有効の間は自動的に /api/meta からバージョンを推論します。機能としては以下の通りです

  • 11, 12, 13にヒットした場合それらにバージョンを変更する

    • ヒットしなかった場合は何もしない
      Misskey公式のバージョンニングを元に判断している為、独自のバージョニングを行っているフォーク等では正常に動作しない可能性があります。その際は client.config.use_version_autodetect = False とすることで無効にすることが可能です。また、手動でバージョンを設定する場合もoffにしてください。
      一部のAPIはバージョンとフォークの種類で判断しています。そのため公式のバージョン的には使用できないが、フォークの機能として存在するという場合は報告をくださればサポートします。
  • Added role property to AdminManager.

  • Added remove_none argument to request method.

  • Added method toClientActions class the given below.

    • get_announcements
  • Added class the given below.

    • AdminUserActions
    • AnnouncementCommon
    • Announcement
    • AnnouncementSystem
    • IMetaAnnouncement
    • IAnnouncementSystem
    • AdminAnnouncementClientActions
    • AdminAnnouncementActions
    • AdminAnnouncementManager
    • IModerationLog
    • ModerationLog
    • ServerInfoCpu
    • ServerInfoMem
    • ServerInfoFs
    • ServerInfoNet
    • ServerInfo
    • IServerInfoCpu
    • IServerInfoMem
    • IServerInfoFs
    • IServerInfoNet
    • IServerInfo
    • ITableStats
    • IIndexStat
    • IndexStat
    • IUserIP
    • UserIP
    • FederationActions
    • FederationManager
    • IFederationInstanceStat
    • IFederationFollowCommon
    • IFederationFollower
    • IFederationFollowing
  • Roles

    • IRolePolicieValue
    • IRolePolicies
    • IRole
    • RolePolicyValue
    • RolePolicies
    • Role
    • AdminRoleActions
    • AdminRolesManager
    • IRoleUser
    • RoleUser
  • Achievements

    • added IAchievementNf class.
    • added NotificationAchievement class.
    • added Achievement class.
    • added get_achievements method at UserActions class.
    • added achievements property at UserDetailed class.
  • Note

    • content field auto convert empty string to None

Changed

  • Maximum number of characters has been changed from 79 to 99
    • The main reason for this change is to solve the problem that the MiPAC code is inevitably longer because of the method chain. We have kept it to the maximum of pep8.
  • Changed a method that was returning an AsyncIterator to return an AsyncGenerator.
    • Generator is more correct than Iterator because it is the correct usage.
  • Changed class name the given below.
    • IAnnouncement -> IMetaAnnouncement
  • cache decorator no longer uses dynamic_args decorator

Removed

  • Delete dynamic_args decorator.
  • Delete debug log.

v0.4.0

18 Jan 08:21
2d6e4e0
Compare
Choose a tag to compare

Added

  • added DocString.
  • added get_state method at ClientNoteActions class.
  • added INoteState class.
  • added NoteState class.
  • added IBasePoll class.
  • added ICreatePoll class.
  • added MiPoll class.
  • added PollManager class.
  • added PollActions class.
  • added AdminEmojiActions class.
  • added AdminManager class.
  • added AdminModeratorManager class.
  • added ActiveUsersChart class.
  • added IDriveChart class.
  • added IDriveLocalChart class.
  • added IDriveRemoteChart class.
  • added get_exception_from_id function.
  • Return an exception appropriate for the error encountered.
  • @omg-xtao added users_search_by_username_and_host method at UserActions class #24.
  • @omg-xtao added note_translate method at UserActions class #24.
  • @omg-xtao added users_search method at UserActions class #24.
  • added new ClientActions class.
  • added avatar_color property at LiteUser class.
    • Note: Since avatar_color is deprecated in v13, only None is returned for v13 instances.
  • added un_renote method at ClientNoteActions class.
  • added get_children method at ClientNoteActions class.
  • added invalidate method at FollowActions class.
  • added cancel method at FollowRequestActions class.
  • added mute attribute at UserManager class.
  • added MuteManager class.
  • added MuteActions class.
  • added MuteUser class.
  • added IMuteUser class.
  • added AdminActions class.
  • added ICustomEmojiLiteRequired class.
  • The following methods are added to the AdminEmojiActions class.
    • gets
    • gets_remote
  • added some meta class.
    • ICPU
    • IPolicies
    • IAnnouncement
    • IV12Features
    • IV11Features
    • IFeatures
    • IV12AdminMeta
    • ISharedAdminMeta
    • ILiteV12Meta
    • ILiteV11Meta
    • IMetaCommonV12
    • ICommonV11
    • IMetaCommon
    • ILiteMeta
    • IV12Meta
    • IMeta
    • IAdminMeta
    • Policies
    • Features
    • Meta
    • AdminMeta
    • CPU
    • MetaCommon
    • LiteMeta
  • added some federation class.
    • IFederationInstanceRequired
    • IFederationInstance
    • FederationInstance
  • added some notification classes.
    • Notification
    • NotificationFollow
    • NotificationFollowRequest
    • NotificationNote
    • NotificationPollEnd
    • NotificationReaction
    • IUserNf
    • INoteNf
    • IPollEndNf

Changed

  • rename ActiveUsersChartPayload class to IActiveUsersChart class.
  • rename DriveLocalChartPayload class to IDriveLocalChart class.
  • rename DriveRemoteChartPayload class to IDriveRemoteChart .class.
  • rename DriveChartPayload class to IDriveChart class.
  • The attribute emojis for Note and LiteUser is obsolete in misskey v13, so v13 will return an empty list.
  • config is now a global variable.
    • If you want to change the config, please use Client.config.from_dict.
  • CustomEmoji now inherits PartialCustomEmoji.
  • PartialCustomEmoji url has been changed to return str | None to match v13.
  • AdminManager's get_invite method has been moved to `AdminActions.
  • BREAKING CHANGE ClientActions has been changed to ClientManager
  • BREAKING CHANGE Some paths will be changed as follows
    • manager.admin -> manager.admins
    • manager.admin.manager -> manager.admins.admin
    • actions.admin -> actions.admins
  • BREAKING CHANGE
    • The action property in the model has been changed to api.
      • Change note.action.send to note.api.action.send.
    • Moved the reaction attribute of ClientActions to NoteManager.
      • Change api.reaction to api.note.reaction.
    • Moved methods from AdminEmojiManager to AdminEmojiActions.
      • Change api.admin.emoji.add to api.admin.emoji.action.add.
    • Moved methods from AdminModeratorManager to AdminModeratorActions.
      • Change api.admin.moderator.add to api.admin.moderator.action.add.
    • Moved methods from ChartManager to ChartActions.
      • Change api.chart.get_active_user to api.chat.action.get_active_user.
    • Moved methods from FollowManager to FollowActions.
      • Change api.user.follow.add to api.user.follow.action.add.
    • Moved methods from FollowRequestManager to FollowRequestActions.
      • api.user.follow.action.get_all.
    • Moved some attributes of NoteActions to NoteManager.
      • Change api.note.action.reaction.add to api.note.reaction.action.add.
    • Moved the reaction attribute of NoteActions to ClientNoteManager.
      • Change api.note.action.reaction to api.note.reaction.action.
      • Change api.note.action.favorite to api.note.favorite.action.

Fixed

  • can't delete emoji with v12.
  • fixed ChatMessage model.
    • For v13, the url is automatically generated. (Although it returns None by type, it never actually returns None.
  • fixed Chat action.
  • fixed Chat action.

Removed

  • The following attributes have been removed api.user.action.note
  • Delete RawActiveUsersChart class.
  • Delete RawDriveLocalChart class.
  • Delete RawDriveRemoteChart class.
  • Delete RawDriveChart class.
  • Delete get_user method at FollowRequestActions class.
  • removed some meta classes.
    • LiteInstanceMeta
    • IInstanceMetaLite
    • IInstanceFeatures
    • IInstancePolicies
    • InstanceMeta

What's Changed

New Contributors

Full Changelog: 0.3.1...0.4.0

v0.3.99

25 Dec 13:32
968c894
Compare
Choose a tag to compare
v0.3.99 Pre-release
Pre-release

Added

  • 💡 added DocString.
  • ✨ added get_state method a ClientNoteActions class.
  • ✨ added INoteState class.
  • ✨ added NoteState class.
  • ✨ added IBasePoll class.
  • ✨ added ICreatePoll class.
  • ✨ added MiPoll class.
  • ✨ added PollManager class.
  • ✨ added PollActions class.
  • ✨ added AdminEmojiActions class.
  • ✨ added AdminManager class.
  • ✨ added AdminModeratorManager class.
  • ✨ added ActiveUsersChart class.
  • ✨ added IDriveChart class.
  • ✨ added IDriveLocalChart class.
  • ✨ added IDriveRemoteChart class.
  • ✨ added attribute is_official at Config class.
    • 💡 became is_ayuskey attribute is deprecated(I'll remove with v0.4.0)
  • ✨ added get_exception_from_id function.
  • ✨ Return an exception appropriate for the error encountered.
  • @omg-xtao added users_search_by_username_and_host method a UserActions class #24.
  • @omg-xtao added note_translate method a UserActions class #24.
  • @omg-xtao added users_search method a UserActions class #24.

Changed

  • 🚚 rename ActiveUsersChartPayload class to IActiveUsersChart class.
  • 🚚 rename DriveLocalChartPayload class to IDriveLocalChart class.
  • 🚚 rename DriveRemoteChartPayload class to IDriveRemoteChart .class.
  • 🚚 rename DriveChartPayload class to IDriveChart class.
  • 💥 BREAKING CHANGE
    • The action property in the model has been changed to api.
      • 💡 Change note.action.send to note.api.action.send.
    • Moved the reaction attribute of ClientActions to NoteManager.
      • 💡 Change api.reaction to api.note.reaction.
    • Moved methods from AdminEmojiManager to AdminEmojiActions.
      • 💡 Change api.admin.emoji.add to api.admin.emoji.action.add.
    • Moved methods from AdminModeratorManager to AdminModeratorActions.
      • 💡 Change api.admin.moderator.add to api.admin.moderator.action.add.
    • Moved methods from ChartManager to ChartActions.
      • 💡 Change api.chart.get_active_user to api.chat.action.get_active_user.
    • Moved methods from FollowManager to FollowActions.
      • 💡 Change api.user.follow.add to api.user.follow.action.add.
    • Moved methods from FollowRequestManager to FollowRequestActions.
      • 💡 api.user.follow.action.get_all.
    • Moved some attributes of NoteActions to NoteManager.
      • 💡 Change api.note.action.reaction.add to api.note.reaction.action.add.
    • Moved the reaction attribute of NoteActions to ClientNoteManager.
      • 💡 Change api.note.action.reaction to api.note.reaction.action.
      • 💡 Change api.note.action.favorite to api.note.favorite.action.

Fixed

  • 🐛 can't delete emoji with v12.

Removed

  • 🔥 The following attributes have been removed api.user.action.note
  • 🔥 Delete RawActiveUsersChart class.
  • 🔥 Delete RawDriveLocalChart class.
  • 🔥 Delete RawDriveRemoteChart class.
  • 🔥 Delete RawDriveChart class.

What's Changed

Full Changelog: 0.3.1...0.3.99

v0.3.1

24 Dec 08:07
f773a8e
Compare
Choose a tag to compare

Added

  • added NoteDeleted class.
  • added INoteUpdatedDeleteBody class.
  • added INoteUpdatedDelete class.
  • str_to_datetime 関数を追加

Fixed

  • PartialReaction クラスで user_id が取得できない
  • INoteUpdatedReaction の型が間違っている

v0.3.0

24 Dec 05:21
de60f38
Compare
Choose a tag to compare

Fixed

  • fix INoteUpdated type

Changed

  • BREAKING CHANGE Required Python version is 3.11