Chore/update docstring (#142)

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring

* chore: update docstring
develop
sousuke0422 3 months ago committed by GitHub
parent 77b665b56c
commit 9cd073b032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -22,8 +22,9 @@ class SharedAntennaActions(AbstractAction):
self._client: ClientManager = client
async def delete(self, *, antenna_id: str) -> bool:
"""
Delete antenna from identifier
"""Delete antenna from identifier
Endpoint: `/api/antennas/delete`
Parameters
----------
@ -44,6 +45,8 @@ class SharedAntennaActions(AbstractAction):
async def show(self, *, antenna_id: str) -> Antenna:
"""Show antenna from identifier
Endpoint: `/api/antennas/show`
Parameters
----------
antenna_id : str | None, optional
@ -70,6 +73,30 @@ class SharedAntennaActions(AbstractAction):
*,
antenna_id: str,
) -> list[Note]:
"""ノートを取得します
Endpoint: `/api/antennas/notes`
Parameters
----------
antenna_id : str
アンテナのID
limit : int, optional
一度に取得する件数, default=10
since_id : str | None
指定したIDのートより後のートを取得します, default=None
until_id : str | None
指定したIDのートより前のートを取得します, default=None
since_date : str | None
指定した日付のノートより後のノートを取得します, default=None
until_date : str | None
指定した日付のノートより前のノートを取得します, default=None
Returns
-------
list[Note]
取得したノートのリスト
"""
body = remove_dict_empty(
{
"antennaId": antenna_id,
@ -96,6 +123,30 @@ class SharedAntennaActions(AbstractAction):
*,
antenna_id: str,
) -> AsyncGenerator[Note, None]:
"""すべてのノートを取得します
Endpoint: `/api/antennas/notes`
Parameters
----------
antenna_id : str
アンテナのID
limit : int, optional
一度に取得する件数, default=10
since_id : str | None, optional
指定したIDのートより後のートを取得します, default=None
until_id : str | None, optional
指定したIDのートより前のートを取得します, default=None
since_date : str | None, optional
指定した日付のノートより後のノートを取得します, default=None
until_date : str | None, optional
指定した日付のノートより前のノートを取得します, default=None
Yields
------
Iterator[AsyncGenerator[Note, None]]
取得したノートのリスト
"""
body = remove_dict_empty(
{
"antennaId": antenna_id,
@ -133,6 +184,8 @@ class SharedAntennaActions(AbstractAction):
) -> Antenna:
"""Update an antenna.
Endpoint: `/api/antennas/update`
Parameters
----------
name : str
@ -200,8 +253,9 @@ class ClientAntennaActions(SharedAntennaActions):
@override
async def delete(self) -> bool:
"""
Delete antenna from identifier
"""Delete antenna from identifier
Endpoint: `/api/antennas/delete`
Returns
-------
@ -214,6 +268,8 @@ class ClientAntennaActions(SharedAntennaActions):
async def show(self) -> Antenna:
"""Show antenna from identifier
Endpoint: `/api/antennas/show`
Returns
-------
Antenna
@ -231,6 +287,29 @@ class ClientAntennaActions(SharedAntennaActions):
since_date: str | None = None,
until_date: str | None = None,
) -> list[Note]:
"""ノートを取得します
Endpoint: `/api/antennas/notes`
Parameters
----------
limit : int, optional
一度に取得する件数, default=10
since_id : str | None, optional
指定したIDのートより後のートを取得します, by default None
until_id : str | None, optional
指定したIDのートより前のートを取得します, by default None
since_date : str | None, optional
指定した日付のノートより後のノートを取得します, by default None
until_date : str | None, optional
指定した日付のノートより前のノートを取得します, by default None
Returns
-------
list[Note]
取得したノートのリスト
"""
return await super().get_notes(
limit=limit,
since_id=since_id,
@ -249,6 +328,29 @@ class ClientAntennaActions(SharedAntennaActions):
since_date: str | None = None,
until_date: str | None = None,
) -> AsyncGenerator[Note, None]:
"""すべてのノートを取得します
Endpoint: `/api/antennas/notes`
Parameters
----------
limit : int, optional
一度に取得する件数, default=10
since_id : str | None, optional
指定したIDのートより後のートを取得します, default=None
until_id : str | None, optional
指定したIDのートより前のートを取得します, default=None
since_date : str | None, optional
指定した日付のノートより後のノートを取得します, default=None
until_date : str | None, optional
指定した日付のノートより前のノートを取得します, default=None
Yields
------
AsyncGenerator[Note, None]
取得したノートのリスト
"""
async for i in super().get_all_notes(
limit, since_id, until_id, since_date, until_date, antenna_id=self.__antenna_id
):
@ -270,6 +372,8 @@ class ClientAntennaActions(SharedAntennaActions):
) -> Antenna:
"""Update an antenna.
Endpoint: `/api/antennas/update`
Parameters
----------
name : str
@ -333,6 +437,8 @@ class AntennaActions(SharedAntennaActions):
) -> Antenna:
"""Create an antenna.
Endpoint: `/api/antennas/create`
Parameters
----------
name : str
@ -402,6 +508,15 @@ class AntennaActions(SharedAntennaActions):
return Antenna(res_antenna, client=self._client)
async def get_list(self) -> list[Antenna]:
"""アンテナの一覧を取得します
Endpoint: `/api/antennas/list`
Returns
-------
list[Antenna]
アンテナのリスト
"""
res_antennas: list[IAntenna] = await self._session.request(
Route("POST", "/api/antennas/list"), auth=True
)

@ -20,12 +20,40 @@ class SharedBlockingActions(AbstractAction):
self._client: ClientManager = client
async def add(self, *, user_id: str) -> UserDetailedNotMe | MeDetailed:
"""ユーザーをブロックします
Endpoint: `/api/blocking/create`
Parameters
----------
user_id : str
対象のユーザー
Returns
-------
UserDetailedNotMe | MeDetailed
ブロック対象のユーザー情報
"""
res: IUserDetailed = await self._session.request(
Route("POST", "/api/blocking/create"), auth=True, json={"userId": user_id}, lower=True
)
return packed_user(res, client=self._client)
async def remove(self, *, user_id: str) -> UserDetailedNotMe | MeDetailed:
"""ユーザーのブロックを解除します
Endpoint: `/api/blocking/delete`
Parameters
----------
user_id : str
対象のユーザー
Returns
-------
UserDetailedNotMe | MeDetailed
ブロック解除対象のユーザー情報
"""
res: IUserDetailed = await self._session.request(
Route("POST", "/api/blocking/delete"), auth=True, json={"userId": user_id}, lower=True
)
@ -44,10 +72,28 @@ class ClientBlockingActions(SharedBlockingActions):
@override
async def add(self) -> UserDetailedNotMe | MeDetailed:
"""ユーザーをブロックします
Endpoint: `/api/blocking/create`
Returns
-------
UserDetailedNotMe | MeDetailed
ブロック対象のユーザー情報
"""
return await super().add(user_id=self.__user_id)
@override
async def remove(self) -> UserDetailedNotMe | MeDetailed:
"""ユーザーのブロックを解除します
Endpoint: `/api/blocking/delete`
Returns
-------
UserDetailedNotMe | MeDetailed
ブロック解除対象のユーザー情報
"""
return await super().remove(user_id=self.__user_id)
@ -65,6 +111,24 @@ class BlockingActions(SharedBlockingActions):
until_id: str | None = None,
limit: int = 100,
) -> list[Blocking]:
"""ブロックしているユーザーの一覧を取得します
Endpoint: `/api/blocking/list`
Parameters
----------
since_id : str | None, optional
指定したIDのユーザーより後のユーザーを取得します, default=None
until_id : str | None, optional
指定したIDのユーザーより前のユーザーを取得します, default=None
limit : int, optional
一度に取得する件数, default=100
Returns
-------
list[Blocking]
ブロックしているユーザーの一覧
"""
body = {"limit": limit, "sinceId": since_id, "untilId": until_id}
raw_blocking_list = await self._session.request(
Route("POST", "/api/blocking/list"), json=body, auth=True
@ -76,6 +140,24 @@ class BlockingActions(SharedBlockingActions):
async def get_all_list(
self, limit: int = 30, since_id: str | None = None, until_id: str | None = None
) -> AsyncGenerator[Blocking, None]:
"""すべてのブロックしているユーザーの一覧を取得します
Endpoint: `/api/blocking/list`
Parameters
----------
limit : int, optional
一度に取得する件数, default=30
since_id : str | None, optional
指定したIDのユーザーより前のユーザーを取得します, default=None
until_id : str | None, optional
指定したIDのユーザーより前のユーザーを取得します, default=None
Yields
------
AsyncGenerator[Blocking, None]
ブロックしているユーザーの一覧
"""
pagination = Pagination[IBlocking](
self._session,
Route("POST", "/api/blocking/list"),

@ -43,40 +43,40 @@ class SharedChannelActions(AbstractAction):
*,
channel_id: str,
) -> Note:
"""Send a note
"""ノートを投稿します
Endpoint: `/api/notes/create`
Parameters
----------
text : str, optional
Text of the note, by default None
ノートのテキスト, default=None
visibility : INoteVisibility, optional
Visibility of the note, by default "public"
ノートの公開範囲, default="public"
visible_user_ids : list[str], optional
Visible user IDs, by default None
公開するユーザーのIDs, default=None
cw : str, optional
CW of the note, by default None
ートのCW, default=None
local_only : bool, optional
Whether the note is local only, by default False
ノートをローカルのみにするかどうか, default=False
reaction_acceptance : IReactionAcceptance, optional
Reaction acceptance of the note, by default None
ノートにリアクションを受け入れるか, default=None
extract_mentions : bool, optional
Whether to extract mentions, by default True
メンションを抽出するかどうか, default=True
extract_hashtags : bool, optional
Whether to extract hashtags, by default True
ハッシュタグを抽出するかどうか, default=True
extract_emojis : bool, optional
Whether to extract emojis, by default True
絵文字を抽出するかどうか, default=True
reply_id : str, optional
Reply ID, by default None
リプライのID, default=None
renote_id : str, optional
Renote ID, by default None
ートのID, default=None
files : list[MiFile | File | str], optional
Files, by default None
添付するファイル, default=None
poll : MiPoll, optional
Poll, by default None
アンケート, default=None
channel_id : str, optional
ID of the channel, by default None
チャンネルのID, default=None
Returns
-------
@ -101,19 +101,19 @@ class SharedChannelActions(AbstractAction):
)
async def follow(self, *, channel_id: str) -> bool:
"""Follow a channel
"""チャンネルをフォローします
Endpoint: `/api/channels/follow`
Parameters
----------
channel_id : str, optional
ID of the channel, by default None
チャンネルのID, default=None
Returns
-------
bool
Whether the channel is followed
チャンネルをフォローしたかどうか
"""
data = {"channelId": channel_id}
@ -373,38 +373,38 @@ class ClientChannelActions(SharedChannelActions):
files: list[MiFile | File | str] | None = None,
poll: MiPoll | None = None,
) -> Note:
"""Send a note
"""ノートを投稿します
Endpoint: `/api/notes/create`
Parameters
----------
text : str, optional
Text of the note, by default None
ノートのテキスト, default=None
visibility : INoteVisibility, optional
Visibility of the note, by default "public"
ノートの公開範囲, default="public"
visible_user_ids : list[str], optional
Visible user IDs, by default None
公開するユーザーのIDを持つリスト, default=None
cw : str, optional
CW of the note, by default None
ノートが閲覧注意NSFWであるか, default=None
local_only : bool, optional
Whether the note is local only, by default False
ノートをローカルのみにするか否か, default=False
reaction_acceptance : IReactionAcceptance, optional
Reaction acceptance of the note, by default None
ノートにリアクションを受け入れるか否か, default=None
extract_mentions : bool, optional
Whether to extract mentions, by default True
メンションを抽出するかであるか, default=True
extract_hashtags : bool, optional
Whether to extract hashtags, by default True
ハッシュタグを抽出するかであるか, default=True
extract_emojis : bool, optional
Whether to extract emojis, by default True
絵文字を抽出するかであるか, default=True
reply_id : str, optional
Reply ID, by default None
返信元のートID, default=None
renote_id : str, optional
Renote ID, by default None
ート元のID, default=None
files : list[MiFile | File | str], optional
Files, by default None
添付するファイル, default=None
poll : MiPoll, optional
Poll, by default None
アンケート, default=None
Returns
-------
@ -430,14 +430,14 @@ class ClientChannelActions(SharedChannelActions):
@override
async def follow(self) -> bool:
"""Follow a channel
"""チャンネルをフォローします
Endpoint: `/api/channels/follow`
Returns
-------
bool
Whether the channel is followed
チャンネルをフォローしているかどうか
"""
return await super().follow(channel_id=self._channel_id)

@ -47,13 +47,13 @@ class SharedClipActions(AbstractAction):
Parameters
----------
clip_id : str | None, optional, by default None
clip_id : str | None, optional, default=None
The clip id
limit : int, optional, by default 10
limit : int, optional, default=10
The number of notes to get
since_id : str | None, optional, by default None
since_id : str | None, optional, default=None
The note id to get notes after
until_id : str | None, optional, by default None
until_id : str | None, optional, default=None
The note id to get notes before
Yields
@ -77,7 +77,7 @@ class SharedClipActions(AbstractAction):
Parameters
----------
clip_id : str | None, optional, by default None
clip_id : str | None, optional, default=None
The clip id
note_id : str
The note id
@ -98,7 +98,7 @@ class SharedClipActions(AbstractAction):
Parameters
----------
clip_id : str | None, optional, by default None
clip_id : str | None, optional, default=None
The clip id
note_id : str
The note id
@ -119,7 +119,7 @@ class SharedClipActions(AbstractAction):
Parameters
----------
clip_id : str | None, optional, by default None
clip_id : str | None, optional, default=None
The clip id
Returns
@ -145,14 +145,14 @@ class SharedClipActions(AbstractAction):
Parameters
----------
clip_id : str | None, optional, by default None
clip_id : str | None, optional, default=None
The clip id
name : str
The clip name
is_public : bool, optional
Whether the clip is public, by default None
Whether the clip is public, default=None
description : str, optional
The clip description, by default None
The clip description, default=None
Returns
-------
@ -193,13 +193,13 @@ class ClientClipActions(SharedClipActions):
Parameters
----------
limit : int, optional, by default 10
limit : int, optional, default=10
The number of notes to get
since_id : str | None, optional, by default None
since_id : str | None, optional, default=None
The note id to get notes after
until_id : str | None, optional, by default None
until_id : str | None, optional, default=None
The note id to get notes before
get_all : bool, optional, by default False
get_all : bool, optional, default=False
Whether to get all notes
Yields
@ -269,9 +269,9 @@ class ClientClipActions(SharedClipActions):
name : str
The clip name
is_public : bool, optional
Whether the clip is public, by default None
Whether the clip is public, default=None
description : str, optional
The clip description, by default None
The clip description, default=None
Returns
-------
@ -310,9 +310,9 @@ class ClipActions(SharedClipActions):
name : str
The clip name
is_public : bool, optional
Whether the clip is public, by default False
Whether the clip is public, default=False
description : str, optional
The clip description, by default None
The clip description, default=None
Returns
-------

@ -73,13 +73,13 @@ class RoleActions(AbstractAction):
role_id : str
The ID of the role to get users.
since_id : str, optional
The ID of the user to get users after, by default None
The ID of the user to get users after, default=None
until_id : str, optional
The ID of the user to get users before, by default None
The ID of the user to get users before, default=None
limit : int, optional
The number of users to get, by default 10
The number of users to get, default=10
get_all : bool, optional
Whether to get all users, by default False
Whether to get all users, default=False
Yields
------
@ -125,17 +125,17 @@ class RoleActions(AbstractAction):
role_id : str
The ID of the role to get notes.
limit : int, optional
The number of notes to get, by default 10
The number of notes to get, default=10
since_id : str, optional
The ID of the note to get notes after, by default None
The ID of the note to get notes after, default=None
until_id : str, optional
The ID of the note to get notes before, by default None
The ID of the note to get notes before, default=None
since_data : int, optional
The timestamp of the note to get notes after, by default None
The timestamp of the note to get notes after, default=None
until_data : int, optional
The timestamp of the note to get notes before, by default None
The timestamp of the note to get notes before, default=None
get_all : bool, optional
Whether to get all notes, by default False
Whether to get all notes, default=False
Yields
------

Loading…
Cancel
Save