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

Audit Log Change variants are undocumented #2112

Open
vilgotf opened this issue Feb 3, 2023 · 1 comment
Open

Audit Log Change variants are undocumented #2112

vilgotf opened this issue Feb 3, 2023 · 1 comment
Labels
c-model Affects the model crate d-api Change related to Discord's API.

Comments

@vilgotf
Copy link
Member

vilgotf commented Feb 3, 2023

Whilst discussing #2110 in Discord (https://discord.com/channels/745809834183753828/1070716906098671706) it came up that Discord no longer documents the AuditLogChange variants. We should therefore, as usually, remove the variants ourselves too, transforming it into a struct where new_value and old_value can be of any type.

I can think of three ways to achieve this:

  1. Expose the values as serde_json::Value or simd_json::value::owned::Value. Downside: new feature flags for twilight-model.
  2. Expose the values as serde_value::Value (which is already a dependency). Downside: awkward to use for users.
  3. Expose the values as raw JSON (of type String) by deserializing and reserializing them back to strings (trickier than it seems to optimize out). This is what Remora does, as can be seen here Remora/Remora.Discord@ddb3ddb.
@vilgotf vilgotf added c-model Affects the model crate d-api Change related to Discord's API. labels Feb 3, 2023
@vilgotf
Copy link
Member Author

vilgotf commented Apr 11, 2023

As an alternative to serde_json::Value, serde_json::value::RawValue could be used instead. Potentially hidden and only accessible through a str reference getter method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-model Affects the model crate d-api Change related to Discord's API.
Projects
None yet
Development

No branches or pull requests

1 participant