ro-py/ro.py

Split up methods for different item types into different "providers"

Opened this issue · 6 comments

Right now, the Client has a lot of methods and is kind of polluted.

Assets:
    get_asset()
    get_base_asset()
Badges:
    get_badge()
    get_base_badge()
Groups:
    get_group()
    get_base_group()
Places:
    get_place()
    get_places()
Plugins:
    get_plugin()
    get_plugins()
Universes:
    get_universe()
    get_universes()
Users:
    get_user()
    get_user_by_username()
    get_users()
    get_users_by_usernames()
    get_base_user()
    get_authenticated_user()
    user_search()

Maybe we could split these up into sub-providers, where each one deals with items of a certain type.

# Current syntax
user = await client.get_user(1)
# Proposed syntax (one of the following)
user = await client.users.get(1)
user = await client.users.by_id(1)

I think this is a good idea (if we are not looking at backward compatibility).
Maybe we could also make one method of fetching users and then detect whenever to use ID or username (I'm not really confident about it though)

You still haven't explained what this base system is

To my opinion, it does not make sense since it would only make the code longer you need to write to get done what you want to do.

You still haven't explained what this base system is

https://ro.py.jmk.gg/bases/

I like it, my only concern is backward compatibility

If we were to do this, it would be very clear that the change is hugely breaking