Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Replace file_{[unique_]id,size} fields with FileMeta #253

Merged
merged 1 commit into from
Oct 1, 2022

Conversation

WaffleLapkin
Copy link
Contributor

TL;DR, before:

pub struct Struct {
    /// An identifier for this file.
    pub file_id: String,

    /// Unique identifier for this file, which is supposed to be the same over
    /// time and for different bots. Can't be used to download or reuse the
    /// file.
    pub file_unique_id: String,

    /// File size in bytes.
    #[serde(default = "crate::types::file::file_size_fallback")]
    pub file_size: u32,

    // other fields...
}

after:

pub struct Struct {
    /// Metadata of the {media} file.
    #[deref]
    #[serde(flatten)]
    pub file: FileMeta,

    // other fields...
}

I'm not certain that we should do this refactoring, but reusing FileMeta seems nice.

In some cases we can even use PhotoSize but I don't think it's worth it (also PhotoSize for videos would be confusing, I think).

@WaffleLapkin WaffleLapkin merged commit a304ea4 into master Oct 1, 2022
@WaffleLapkin WaffleLapkin deleted the flatten_meta branch October 1, 2022 11:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants