Releases: yupix/MiPAC
v0.5.1
Important
次のv0.6からpypiで提供されるMiPACは最新のMisskeyにのみ最適化されたものとなります。今後もv11やv12を利用する場合はこのリポジトリでshared
ブランチを指定し、 pip install git+
形式でインストールするようお願いします。最優先でv13をやっているため、まだ準備できていませんが、今後はバージョンごとにブランチを分けてそこでそのバージョンに特化した形で提供します
MeDetailed
モデルが追加され、自身に関する情報より多く扱えるようになりました
今後は API を使用した際に自動でユーザーが自分自身かを判断し、自身であった場合は UserDetailed
ではなく、 MeDetailed
を返すようになります。
MeDetailed
と UserDetailed
の共有体型の場合は 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
New Features ✨
Client
で async 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()
FileActions
に save
メソッドが追加されました
指定したパス、または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 💔
全取得の際の引数 all
が get_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_replies
がClientNoteActions.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
v0.4.3
Added
- 以下のエンドポイントがサポートされます。
emoji
channels/favorite
channels/unfavorite
channels/my-favorites
- 以下のクラスを追加
IChannelNote
PartialNote
Note
クラスでtags
を取得できるようにClient
クラスのコンストラクタ引数に以下を追加use_version
use_version_autodetect
ClientManager
に属性emoji
を追加Channel
にapi
プロパティを追加CustomEmoji
にhost
プロパティを追加ChannelLite
にapi
プロパティを追加Folder
にapi
プロパティを追加File
にapi
プロパティを追加Channel
クラスはChannelLite
を継承しているため必然的にこちらにもapi
プロパティが増えています
Changed
FileActions
のremove_file
メソッドが非推奨になります。 今後はremove
メソッドをご利用ください。v0.5.0
で削除されます。INoteRequired
がIPartialNote
に変更されました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
クラスに移動されました
- tip:
v0.4.2
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
- Channel
- Added
block
attribute toUserManager
. - Added
channel
attribute toClientManager
. - Added
reaction_emojis
property toNote
. - Added
reaction_acceptance
property toNote
.
Changed
- chatがv13で廃止された為v13を利用している際は例外を返すように変更しました。
- v13だが、forkやchatが廃止される前のバージョンを使用していてチャットが使用したい際は新しい機能である
config.features
をご利用ください
- v13だが、forkやchatが廃止される前のバージョンを使用していてチャットが使用したい際は新しい機能である
- aiohttpのバージョンを
3.8.4
に固定 - Tokenを使用しなくてもAPIが一部使用できるようになりました。当然ですが、認証が必要なAPIを使用した場合はエラーが出ます。
Config.from_dict
の引数が全てキーワード引数になりました。これは今後Configに引数が増えた際など、変更に強くするためです。
Removed
- サポートする気が無いため、sphinxを用いたドキュメントを削除
Fixed
Note.reply
のキーがrenote
になっていて取得不可になっていた
v0.4.1
Added
バージョンの自動検出機能が追加されました(β)
これはデフォルトで有効になっており、有効の間は自動的に /api/meta
からバージョンを推論します。機能としては以下の通りです
-
11, 12, 13にヒットした場合それらにバージョンを変更する
- ヒットしなかった場合は何もしない
Misskey公式のバージョンニングを元に判断している為、独自のバージョニングを行っているフォーク等では正常に動作しない可能性があります。その際はclient.config.use_version_autodetect = False
とすることで無効にすることが可能です。また、手動でバージョンを設定する場合もoffにしてください。
一部のAPIはバージョンとフォークの種類で判断しています。そのため公式のバージョン的には使用できないが、フォークの機能として存在するという場合は報告をくださればサポートします。
- ヒットしなかった場合は何もしない
-
Added
role
property toAdminManager
. -
Added
remove_none
argument to request method. -
Added method to
ClientActions
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 atUserActions
class. - added
achievements
property atUserDetailed
class.
- added
-
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 anAsyncGenerator
.- Generator is more correct than Iterator because it is the correct usage.
- Changed class name the given below.
IAnnouncement
->IMetaAnnouncement
cache
decorator no longer usesdynamic_args
decorator
Removed
- Delete
dynamic_args
decorator. - Delete debug log.
v0.4.0
Added
- added DocString.
- added
get_state
method atClientNoteActions
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 atUserActions
class #24. - @omg-xtao added
note_translate
method atUserActions
class #24. - @omg-xtao added
users_search
method atUserActions
class #24. - added new
ClientActions
class. - added
avatar_color
property atLiteUser
class.- Note: Since avatar_color is deprecated in v13, only None is returned for v13 instances.
- added
un_renote
method atClientNoteActions
class. - added
get_children
method atClientNoteActions
class. - added
invalidate
method atFollowActions
class. - added
cancel
method atFollowRequestActions
class. - added
mute
attribute atUserManager
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 toIActiveUsersChart
class. - rename
DriveLocalChartPayload
class toIDriveLocalChart
class. - rename
DriveRemoteChartPayload
class toIDriveRemoteChart
.class. - rename
DriveChartPayload
class toIDriveChart
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
.
- If you want to change the config, please use
- 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 toClientManager
- 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 toapi
.- Change
note.action.send
tonote.api.action.send
.
- Change
- Moved the reaction attribute of
ClientActions
toNoteManager
.- Change
api.reaction
toapi.note.reaction
.
- Change
- Moved methods from
AdminEmojiManager
toAdminEmojiActions
.- Change
api.admin.emoji.add
toapi.admin.emoji.action.add
.
- Change
- Moved methods from
AdminModeratorManager
toAdminModeratorActions
.- Change
api.admin.moderator.add
toapi.admin.moderator.action.add
.
- Change
- Moved methods from
ChartManager
toChartActions
.- Change
api.chart.get_active_user
toapi.chat.action.get_active_user
.
- Change
- Moved methods from
FollowManager
toFollowActions
.- Change
api.user.follow.add
toapi.user.follow.action.add
.
- Change
- Moved methods from
FollowRequestManager
toFollowRequestActions
.api.user.follow.action.get_all
.
- Moved some attributes of
NoteActions
toNoteManager
.- Change
api.note.action.reaction.add
toapi.note.reaction.action.add
.
- Change
- Moved the reaction attribute of
NoteActions
toClientNoteManager
.- Change
api.note.action.reaction
toapi.note.reaction.action
. - Change
api.note.action.favorite
toapi.note.favorite.action
.
- Change
- The
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 atFollowRequestActions
class. - removed some meta classes.
LiteInstanceMeta
IInstanceMetaLite
IInstanceFeatures
IInstancePolicies
InstanceMeta
What's Changed
- ⚡️ refactor: errors classes by @omg-xtao in #22
- ✨ feat: upload_file by @omg-xtao in #23
- ✨ More features by @omg-xtao in #24
- 🚑️ fix: upload_file TypeError by @omg-xtao in #25
- ✨ feat: add method #MP-28 by @omg-xtao in #26
- ✨ added some notification classes by @omg-xtao in #27
- 🎨 chore: notification classes api by @omg-xtao in #28
- Add license scan report and status by @fossabot in #30
- Feat/support v13 by @yupix in #31
- Feat/support v13 by @yupix in #32
- fix:
ChatMessage
model by @omg-xtao in #33 - fix:
Chat
action by @omg-xtao in #35 - Refactory/meta by @yupix in #34
New Contributors
Full Changelog: 0.3.1...0.4.0
v0.3.99
Added
- 💡 added DocString.
- ✨ added
get_state
method aClientNoteActions
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
atConfig
class.- 💡 became
is_ayuskey
attribute is deprecated(I'll remove with v0.4.0)
- 💡 became
- ✨ added
get_exception_from_id
function. - ✨ Return an exception appropriate for the error encountered.
- ✨ @omg-xtao added
users_search_by_username_and_host
method aUserActions
class #24. - ✨ @omg-xtao added
note_translate
method aUserActions
class #24. - ✨ @omg-xtao added
users_search
method aUserActions
class #24.
Changed
- 🚚 rename
ActiveUsersChartPayload
class toIActiveUsersChart
class. - 🚚 rename
DriveLocalChartPayload
class toIDriveLocalChart
class. - 🚚 rename
DriveRemoteChartPayload
class toIDriveRemoteChart
.class. - 🚚 rename
DriveChartPayload
class toIDriveChart
class. - 💥 BREAKING CHANGE
- The
action
property in the model has been changed toapi
.- 💡 Change
note.action.send
tonote.api.action.send
.
- 💡 Change
- Moved the reaction attribute of
ClientActions
toNoteManager
.- 💡 Change
api.reaction
toapi.note.reaction
.
- 💡 Change
- Moved methods from
AdminEmojiManager
toAdminEmojiActions
.- 💡 Change
api.admin.emoji.add
toapi.admin.emoji.action.add
.
- 💡 Change
- Moved methods from
AdminModeratorManager
toAdminModeratorActions
.- 💡 Change
api.admin.moderator.add
toapi.admin.moderator.action.add
.
- 💡 Change
- Moved methods from
ChartManager
toChartActions
.- 💡 Change
api.chart.get_active_user
toapi.chat.action.get_active_user
.
- 💡 Change
- Moved methods from
FollowManager
toFollowActions
.- 💡 Change
api.user.follow.add
toapi.user.follow.action.add
.
- 💡 Change
- Moved methods from
FollowRequestManager
toFollowRequestActions
.- 💡
api.user.follow.action.get_all
.
- 💡
- Moved some attributes of
NoteActions
toNoteManager
.- 💡 Change
api.note.action.reaction.add
toapi.note.reaction.action.add
.
- 💡 Change
- Moved the reaction attribute of
NoteActions
toClientNoteManager
.- 💡 Change
api.note.action.reaction
toapi.note.reaction.action
. - 💡 Change
api.note.action.favorite
toapi.note.favorite.action
.
- 💡 Change
- The
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
- ⚡️ refactor: errors classes by @omg-xtao in #22
- ✨ feat: upload_file by @omg-xtao in #23
- ✨ More features by @omg-xtao in #24
- 🚑️ fix: upload_file TypeError by @omg-xtao in #25
Full Changelog: 0.3.1...0.3.99