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

feat(model): Implement user applications #2323

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

feat(model): Implement user applications #2323

wants to merge 9 commits into from

Conversation

Erk-
Copy link
Member

@Erk- Erk- commented Mar 18, 2024

This pr implements the newly added user applications, this have had some testing done, but is still missing quite a bit of documentation and maybe a bit of bike-shedding about type names and/or layout.

@github-actions github-actions bot added c-cache Affects the cache crate c-http Affects the http crate c-model Affects the model crate c-standby Affects the standby crate c-util Affects the util crate c-validate Affects the validate crate t-feature Addition of a new feature labels Mar 18, 2024
Copy link
Member

@laralove143 laralove143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were too many

nit: these should be sorted alphabetically

comments so i stopped repeating them on every instance, besides that there are just things to discuss

twilight-http/src/request/application/command/mod.rs Outdated Show resolved Hide resolved
twilight-model/src/application/command/mod.rs Outdated Show resolved Hide resolved
twilight-model/src/application/interaction/mod.rs Outdated Show resolved Hide resolved
twilight-model/src/application/interaction/mod.rs Outdated Show resolved Hide resolved
twilight-model/src/application/interaction/resolved.rs Outdated Show resolved Hide resolved
pub kind: InteractionType,
pub user_id: Id<UserMarker>,
pub authorizing_integration_owners:
ApplicationIntegrationMap<AnonymizableId<GuildMarker>, Id<UserMarker>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need the complexity of generics here, we could follow ddocs and create a AuthorizingIntegrationOwners struct with fields kind: ApplicationIntegrationType and id: AuthorizingIntegrationOwnerId where AuthorizingIntegrationOwners is an enum with Guild(Option<Id<GuildMarker>>) and User(Id<UserMarker>)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a enum, instead if we should do it as in the docs we should have a hashmap with 2 possible enum keys and then different Id type depending on if it is one or the other, I think this is the easiest way to make it work nicely.

Copy link
Member

@laralove143 laralove143 Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we're adding complexity to be DRY here, i think it's worth a few added LOC to separate ApplicationIntegrationMap to different structs such as:

// for InteractionMetadata and Interaction
enum AuthorizingIntegrationOwners {
    GuildInstall(AuthorizingIntegrationOwnersGuild),
    UserInstall(Id<UserMarker>),
}

enum AuthorizingIntegrationOwnersGuild {
    Guild(Id<GuildMarker>),
    Dm,
}

and for ApplicationIntegrationTypeConfig, unless im missing something we only ever use it as ApplicationIntegrationMap<ApplicationIntegrationTypeConfig> so we can just unnest it

@Erk- Erk- marked this pull request as ready for review August 5, 2024 15:49
@Erk-
Copy link
Member Author

Erk- commented Aug 5, 2024

I think this is ready for a wider review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-cache Affects the cache crate c-http Affects the http crate c-model Affects the model crate c-standby Affects the standby crate c-util Affects the util crate c-validate Affects the validate crate t-feature Addition of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants