Skip to content

Commit dce855b

Browse files
authored
Merge branch 'main' into official-api
2 parents 7377e9c + 8f0befe commit dce855b

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# RecNetPy
2-
> **RecNetPy** is an API wrapper built in Python for pulling data from [RecNet](https://rec.net/). **RecNetPy** aims to be easy to use yet powerful. It's the same wrapper used to power [RecNetBot](https://github.com/RecNetBot-Development/RecNetBot)!
2+
> **RecNetPy** is a [Rec Room](https://devportal.rec.net/) API wrapper built in Python. **RecNetPy** aims to be easy to use yet powerful. It's the same wrapper used to power [RecNetBot](https://github.com/RecNetBot-Development/RecNetBot)!
33
44
[![NPM Version][pip-image]][pip-url]
55
[![Downloads Stats][pip-downloads]][pip-url]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
aiohttp==3.8.5
1+
aiohttp==3.9.2
22
sphinx==5.2.3
33
python-dateutil==2.8.2

src/recnetpy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from .client import Client
1+
from .client import Client
2+
from .managers.room_manager import RoomInclude
3+
from .dataclasses import *

src/recnetpy/dataclasses/account.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
if TYPE_CHECKING:
99
from . import Event, Image, Room
10-
from ..misc.api_responses import AccountResponse, ProgressionResponse, BioResponse, RoomResponse
10+
from ..misc.api_responses import AccountResponse, ProgressionResponse, BioResponse
1111
from ..rest import Response
1212

1313

@@ -17,7 +17,7 @@
1717

1818
class Account(BaseDataClass['AccountResponse']):
1919
"""
20-
This dataclass represents a RecNet account.
20+
This dataclass represents a Rec Room account.
2121
"""
2222

2323
#: This is an account's unique identifier

src/recnetpy/managers/room_manager.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import TYPE_CHECKING, List, Optional
22

3+
from enum import Enum
34
from . import BaseManager
45
from ..dataclasses import Room
56
from ..misc import stringify_bulk
@@ -8,12 +9,35 @@
89
from ..misc.api_responses import RoomResponse, RoomSearchResponse
910
from ..rest import Response
1011

12+
class RoomInclude(Enum):
13+
"""
14+
Enum which corresponds to the room include parameter values
15+
"""
16+
SUBROOMS = 2
17+
ROLES = 4
18+
TAGS = 8
19+
PROMO_CONTENT = 32
20+
SCORES = 64
21+
LOADING_SCREENS = 256
22+
23+
def sum_enum_list(enums: List[Enum]) -> int:
24+
"""
25+
Sums a list of integer enums
26+
27+
:param enums: A list of enums that have integer values
28+
:return: Sum of the enums' values
29+
"""
30+
sum = 0
31+
for i in enums:
32+
sum += i.value
33+
return sum
34+
1135
class RoomManager(BaseManager['Room', 'RoomResponse']):
1236
"""
1337
This is a factory object for creating room objects. Its the
1438
main interface for fetching room related data.
1539
"""
16-
async def get(self, name: str, include: int = 0) -> 'Room':
40+
async def get(self, name: str, include: int | List[RoomInclude] = 0) -> 'Room':
1741
"""
1842
Gets room data by their name, and returns it as an room object.
1943
Returns nothing if the room doesn't exist or is private.
@@ -44,7 +68,7 @@ async def get(self, name: str, include: int = 0) -> 'Room':
4468
return self.create_dataclass(room_data, room_data)
4569
return None
4670

47-
async def fetch(self, id: int, include: int = 0) -> 'Room':
71+
async def fetch(self, id: int, include: int | List[RoomInclude] = 0) -> 'Room':
4872
"""
4973
Gets room data by their id, and returns it as an room object.
5074
Returns nothing if the room doesn't exist or is private.

0 commit comments

Comments
 (0)