Client¶
aiordr provides a client that can be used to interact with the API and receive webook events.
- aiordr.client.DeveloperModes¶
alias of
Literal
[‘devmode_success’, ‘devmode_fail’, ‘devmode_wsfail’]
This module contains the client for interfacing with the o!rdr API.
- class aiordr.client.ordrClient(**kwargs: Any)¶
- socket¶
- on_render_added(func: Callable) Callable ¶
Returns a callable that is called when a render is added, to be used as: @client.on_render_added() async def render_added(event: RenderAddEvent):
- on_render_progress(func: Callable) Callable ¶
Returns a callable that is called when a render is updated, to be used as: @client.on_render_progress() async def render_progress(event: RenderProgressEvent):
- on_render_fail(func: Callable) Callable ¶
Returns a callable that is called when a render fails, to be used as: @client.on_render_fail() async def render_fail(event: RenderFailEvent):
- on_render_finish(func: Callable) Callable ¶
Returns a callable that is called when a render finishes, to be used as: @client.on_render_finish() async def render_finish(event: RenderFinishEvent):
- async get_custom_skin(skin_id: int) SkinCompact ¶
Get custom skin information.
- Parameters:
skin_id (
int
) – Skin ID- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Returns:
Skin information
- Return type:
aiordr.models.skin.SkinCompact
- async get_skins(page: int = 1, page_size: int = 5, **kwargs: Any) SkinsResponse ¶
Get custom skins.
- Parameters:
page (
int
) – Page numberpage_size (
int
) – Page size**kwargs – See below
- Keyword Arguments:
- search (
str
) – Optional, search query
- search (
- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Returns:
Skins
- Return type:
aiordr.models.skins.SkinsResponse
- async get_render_list(page: int = 1, page_size: int = 5, **kwargs: Any) RendersResponse ¶
Get render list.
- Parameters:
page (
int
) – Page numberpage_size (
int
) – Page size**kwargs – See below
- Keyword Arguments:
- ordr_username (
str
) – Optional, username of the user who ordered the render
- ordr_username (
- replay_username (
str
) – Optional, username of the user from the replay
- replay_username (
- render_id (
int
) – Optional, ID of the render
- render_id (
- no_bots (
bool
) – Optional, whether to exclude bot renders
- no_bots (
- link (
str
) – Optional, the path of a shortlink (e.g. pov8n for https://link.issou.best/pov8n)
- link (
- beatmapset_id (
int
) – Optional, ID of the beatmapset
- beatmapset_id (
- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Returns:
Renders
- Return type:
aiordr.models.renders.RendersResponse
- async get_server_list() list[RenderServer] ¶
Get the list of available servers.
- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Returns:
List of servers
- Return type:
list[aiordr.models.server.RenderServer]
- async get_server_online_count() int ¶
Get the number of online servers.
- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Returns:
Number of online servers
- Return type:
int
- async create_render(username: str, skin: str | int, **kwargs: Any) RenderCreateResponse ¶
Create a render.
- Parameters:
username (
str
) – Username of the user who ordered the renderskin (
Union[str, int]
) – Skin ID or name**kwargs – See below
- Keyword Arguments:
- replay_file (
typing.IO
) – Optional, replay file
- replay_file (
- replay_url (
str
) – Optional, replay URL, used if replay_file is not provided
- replay_url (
- render_options (
aiordr.models.render.RenderOptions
) – Optional, render options
- render_options (
- custom_skin (
bool
) – Optional, whether the provided skin is a custom skin ID (default: false)
- custom_skin (
- Raises:
aiordr.exceptions.APIException
: Contains status code, error message, and error code- Raises:
TypeError
: If render_options is not a RenderOptions object- Returns:
Render create response
- Return type:
aiordr.models.render.RenderCreateResponse
- async connect() None ¶
Connects to the websocket server.
- Returns:
None
- async aclose() None ¶
Closes the client.
- Returns:
None