[4.x] Rewrite REST interaction execution
Currently rest interactions have a suboptimal approach for controlling the interaction (API calls, parsing & casting) itself. While it works fine as an overload to the global IXInteraction types, casting to the interface to global types is irrelevant because socket and rest interactions are not compatible and no cache applies. Because of this, we are a lot more free to rethink the best flow for rest interactions, as we don't need to respect the strategy of matching the socket flow.
Requirements for a better REST interaction approach:
- Partial (interaction only) types that can be used to remove the requirement of API calls to populate entity parameters.
- Example:
async Task Bla(IRestUser/PartialRestUser partialUser) { } // does not require API calls, because the interaction metadata already contains the data to populate this entity. async Task Bla(RestUser user) { } // Fetches a full user from API from the provided user ID. This guarantees a complete entity with no missing properties. async Task Bla(IRestChannel/PartialRestChannel partialChannel) {} ... // and so forth - Removing the need for API calls completely, and explicitly implement global interface overloads in the interaction framework so they're inaccessible to restcontext.
-
Instead of exposing these values, we can expose only the guild ID and channel ID, instead of the guild and channel. This could also be done to the global type, where socket will implement the guild and channel by the passed ID by themselves.
-
- Removing async entity creation. This allows us to implement a cleaner approach to parsing interactions manually, as sync handlers will be able to delegate properly as well.
-
This is only doable if we implement the directly above mentioned restriction.
-
- Enforce sync execution inside the interaction framework by default, when executing a rest interaction.