Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method to upgrade a REST object to a Gateway object #589

Open
1 task done
A5rocks opened this issue May 8, 2021 · 4 comments
Open
1 task done

Method to upgrade a REST object to a Gateway object #589

A5rocks opened this issue May 8, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@A5rocks
Copy link
Contributor

A5rocks commented May 8, 2021

Summary

A method that upgrades from a REST object to a Gateway object.

Problem

Some of the Gateway objects are better (see for example is_large on GatewayGuild, etc.) However, to convert a REST object to a Gateway one, you need to use cache methods. That's annoying.

Ideal implementation

RESTXXX.upgrade(self) -> Optional[GatewayXXX]

Just calls the respective cache methods.

Checklist

  • I have searched the issue tracker and have made sure it's not a duplicate.
    If it is a follow up of another issue, I have specified it.
@A5rocks A5rocks added the enhancement New feature or request label May 8, 2021
@A5rocks
Copy link
Contributor Author

A5rocks commented May 8, 2021

Now that I check it out, only RESTGuild and GatewayGuild have this distinction, this feature request might not be worth it.

However, there's some non-RESTXXX things that are not on REST -- take for example, https://hikari-py.github.io/hikari/hikari/messages.html#hikari.messages.Message.guild_id. Maybe a Message.upgrade(self) -> Optional[Message] would be nice?

@A5rocks A5rocks changed the title Method to upgrade from RESTXXX to Optional[GatewayXXX] Method to upgrade a REST object to a Gateway object May 8, 2021
@davfsa
Copy link
Member

davfsa commented May 8, 2021

After seeing issues like this one and #582 or #587 I am starting to think our models are a bit of a mess and should be restructured as well as clearly documented the steps of action for new models

cc @FasterSpeeding

@FasterSpeeding
Copy link
Collaborator

FasterSpeeding commented May 8, 2021

This'd likely be called get_self not upgrade to fit in with our the format for fetch vs get methods and to match the current fetch_self method naming standard present in the lib. Also would probably be a method on partial guild with rest guild inheriting it

@FasterSpeeding
Copy link
Collaborator

FasterSpeeding commented May 8, 2021

After seeing issues like this one and #582 or #587 I am starting to think our models are a bit of a mess and should be restructured as well as clearly documented the steps of action for new models

Most of the models seem fine to me, #582 mostly just changes events with the only models within its scope being the guild and message models which funnily enough are also the only models relevant to this and #587. Message and guild do unique stuff which isn't really representative of how models are handled in their current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants