Managers#
- class recnetpy.managers.AccountManager(client: Client)#
This is a factory object for creating account objects. Its the main interface for fetching account related data.
- create_dataclass(id: int, data: Optional[AccountResponse] = None) Account#
Creates an account object:
- Parameters
id – An account id.
data – An account api response.
- Returns
Returns an account object.
- create_from_data_list(data: List[AccountResponse]) List[Account]#
Creates a list of account objects based on a list of data.
- Parameters
data – A list of an account api responses.
- Returns
A list of account objects.
- async fetch(id: int) Optional[Account]#
Gets user data by their id, and returns it as an account object. Returns nothing if an account with the specified id doesn’t exist.
- Parameters
id – The id of the RecNet user.
- Returns
An account object representing the data or nothing if not found.
- async fetch_many(ids: List[int]) List[Account]#
Gets a list of users by a list of ids, and returns a list of account object. Accounts that couldn’t be found will be silently ignored.
- Parameters
ids – A list of ids.
- Returns
A list of account objects.
- async get(name: str) Optional[Account]#
Gets user data by their username, and returns it as an account object. Returns nothing if the account doesn’t exist.
- Parameters
name – The username of the RecNet user.
- Returns
An account object representing the data or nothing if not found.
- class recnetpy.managers.BaseManager(client: Client)#
The base class used by all managers. This class is only to be inherited, and shouldn’t be created manually.
- abstract create_dataclass(id: int, data: Optional[RT] = None) BDC#
Creates an object from the managers corresponding dataclass.
- Parameters
id – The unique number associated with each data response.
data – The data from an API response associated with the dataclass.
- Returns
Returns an object representing the data from the data response.
- abstract create_from_data_list(data: List[RT]) List[BDC]#
Creates a list of objects from a list of data.
- Parameters
data – A list of data from an API response associated with the dataclass.
- Returns
A list of objects.
- dataclass: Type[BDC]#
This is the dataclass the manager is responsible for creating.
- abstract async fetch(id: int) BDC#
Fetches the data for an object by its id, and returns the class representing the data.
- Parameters
id – The unique number associated with each data response.
- Retun
Returns an object representing the data from the data response.
- rec_net: RouteManager#
This is an interface for the HTTP manager.
- class recnetpy.managers.EventManager(client: Client)#
This is a factory object for creating eveny objects. Its the main interface for fetching event related data.
- create_dataclass(id: int, data: Optional[EventResponse] = None) Event#
Creates an event object:
- Parameters
id – An event id.
data – An event api response.
- Returns
Returns an event object.
- create_from_data_list(data: List[EventResponse]) List[Event]#
Creates a list of event objects based on a list of data.
- Parameters
data – A list of an event api responses.
- Returns
A list of event objects.
- async fetch(id: int) Optional[Event]#
Gets event data by their id, and returns it as an event object. Returns nothing if the event doesn’t exist or is private.
- Parameters
id – The id of the event.
- Returns
An event object representing the data or nothing if not found.
- async fetch_many(ids: List[int]) List[Event]#
Gets a list of events by a list of event ids, and returns a list of event object. Events that couldn’t be found will be silently ignored.
- Parameters
ids – A list of ids.
- Returns
A list of event objects.
- async from_account(id: int, take: int = 16, skip: int = 0) List[Event]#
Gets a list of events created by a player. If no event or the respective account is found, an empty list will be returned.
- Parameters
id – An account id.
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of event objects.
- async get_events(take: int = 16, skip: int = 0, sort: int = 0) List[Event]#
Gets a list of events currently happening.
- Parameters
take – The number of results to return.
skip – The number of results to skip.
sort – An integer that describes how the results are to be sorted.
- Returns
A list of event objects.
- async in_room(id: int, take: int = 16, skip: int = 0) List[Event]#
Gets a list of events happening in a room. If no event or the respective room is found, an empty list will be returned.
- Parameters
query – A room id.
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of event objects.
- async search(query: str, take: int = 16, skip: int = 0, sort: int = 0) List[Event]#
Searches RecNet for events based on a query, and returns a list of event objects. If no event is found, an empty list will be returned.
- Parameters
query – A search query string.
take – The number of results to return.
skip – The number of results to skip.
sort – An integer that describes how the results are to be sorted.
- Returns
A list of event objects.
- class recnetpy.managers.ImageManager(client: Client)#
This is a factory object for creating image objects. Its the main interface for fetching image related data.
- create_dataclass(id: int, data: Optional[ImageResponse] = None) Image#
Creates an image object:
- Parameters
id – An image id.
data – An image api response.
- Returns
Returns an image object.
- create_from_data_list(data: List[ImageResponse]) List[Image]#
Creates a list of image objects based on a list of data.
- Parameters
data – A list of an image api responses.
- Returns
A list of image objects.
- async during_event(id: int, take: int = 16, skip: int = 0) List[Image]#
Gets a list of images taken during an event. If no image or the respective event is found, an empty list will be returned.
- Parameters
id – A event id.
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of image objects.
- async fetch(id: int) Optional[Image]#
Gets image data by their id, and returns it as an image object. Returns nothing if the image doesn’t exist or is private.
- Parameters
id – The id of the image.
- Returns
An image object representing the data or nothing if not found.
- async fetch_many(ids: List[int]) List[Image]#
Gets a list of images by a list of image ids, and returns a list of image object. Images that couldn’t be found will be silently ignored.
- Parameters
ids – A list of ids.
- Returns
A list of image objects.
- async from_account(id: int, take: int = 16, skip: int = 0, sort: int = 0) List[Image]#
Gets a list of images taken by a player. If no image or the respective account is found, an empty list will be returned.
- Parameters
id – A player id.
take – The number of results to return.
skip – The number of results to skip.
sort – An integer that describes how the results are to be sorted.
- Returns
A list of image objects.
- async front_page(take: int = 16, skip: int = 0) List[Image]#
Gets a list of the most popular images on RecNet.
- Parameters
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of image objects.
- async in_room(id: int, take: int = 16, skip: int = 0, sort: int = 0) List[Image]#
Gets a list of images taken in a room. If no image or the respective room is found, an empty list will be returned.
- Parameters
id – A room id.
take – The number of results to return.
skip – The number of results to skip.
sort – An integer that describes how the results are to be sorted.
- Returns
A list of image objects.
- async player_feed(id: int, take: int = 16, skip: int = 0) List[Image]#
Gets a list of images taken of a player. If no image or the respective account is found, an empty list will be returned.
- Parameters
id – A player id.
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of image objects.
- class recnetpy.managers.InventionManager(client: Client)#
This is a factory object for creating invention objects. Its the main interface for fetching invention related data.
- create_dataclass(id: int, data: Optional[InventionResponse] = None) Invention#
Creates an invention object:
- Parameters
id – An invention id.
data – An invention api response.
- Returns
Returns an invention object.
- create_from_data_list(data: List[InventionResponse]) List[Invention]#
Creates a list of invention objects based on a list of data.
- Parameters
data – A list of an invention api responses.
- Returns
A list of invention objects.
- async featured(take: int = 16, skip: int = 0) List[Invention]#
Gets a list of the featured inventions on RecNet.
- Parameters
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of invention objects.
- async fetch(id: int) Optional[Invention]#
Gets invention data by their id, and returns it as an invention object. Returns nothing if the invention doesn’t exist or is private.
- Parameters
id – The id of the invention.
- Returns
An invention object representing the data or nothing if not found.
- class recnetpy.managers.RoomManager(client: Client)#
This is a factory object for creating room objects. Its the main interface for fetching room related data.
- create_dataclass(id: int, data: Optional[RoomResponse] = None) Room#
Creates an room object:
- Parameters
id – An room id.
data – An room api response.
- Returns
Returns an room object.
- create_from_data_list(data: List[RoomResponse]) List[Room]#
Creates a list of room objects based on a list of data.
- Parameters
data – A list of an room api responses.
- Returns
A list of room objects.
- async created_by(id: int) List[Room]#
Gets a list of rooms created by a player. If no room or the respective account is found, an empty list will be returned.
- Parameters
id – An account id.
- Returns
A list of room objects.
- async fetch(id: int, include: int = 0) Room#
Gets room data by their id, and returns it as an room object. Returns nothing if the room doesn’t exist or is private.
Include param values:Value
Resolve
2
Subrooms
4
Roles
8
Tags
32
Promotional content
64
Scores
256
Loading screens
- Parameters
id – The id of the room.
include – An integer that add additional information to the response.
- Returns
An room object representing the data.
- async fetch_many(ids: List[int]) List[Room]#
Gets a list of rooms by a list of ids, and returns a list of room objects. Room that couldn’t be found or are private will be silently ignored.
- Parameters
ids – A list of ids.
- Returns
A list of room objects.
- async get(name: str, include: int = 0) Room#
Gets room data by their name, and returns it as an room object. Returns nothing if the room doesn’t exist or is private.
Include param values:Value
Resolve
2
Subrooms
4
Roles
8
Tags
32
Promotional content
64
Scores
256
Loading screens
- Parameters
name – The name of the room.
include – An integer that add additional information to the response.
- Returns
An room object representing the data or nothing if not found.
- async get_many(names: List[str]) List[Room]#
Gets a list of rooms by a list of names, and returns a list of rooms object. Room that couldn’t be found or are private will be silently ignored.
- Parameters
names – A list of room names.
- Returns
A list of room objects.
- async hot(take: int = 16, skip: int = 0) List[Room]#
Gets a list of the most popular rooms on RecNet.
- Parameters
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of room objects.
- async owned_by(id: int) List[Room]#
Gets a list of rooms owned by a player. If no room or the respective account is found, an empty list will be returned.
- Parameters
id – An account id.
- Returns
A list of room objects.
- async search(query: str, take: int = 16, skip: int = 0) List[Room]#
Searches RecNet for rooms based on a query, and returns a list of room objects. If no room is found, an empty list will be returned.
- Parameters
query – A search query string.
take – The number of results to return.
skip – The number of results to skip.
- Returns
A list of room objects.