//! Response types copy/pasted straight from the backend source code. use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct GetMediaFileSuccessResponse { pub success: bool, pub media_file: MediaFileInfo, } #[derive(Deserialize, Debug)] pub struct MediaFileInfo { pub token: String, /// Type of media will dictate which fields are populated and what /// the frontend should display (eg. video player vs audio player). pub media_type: String, /// If the file was generated as part of a batch, this is the token for the batch. pub maybe_batch_token: Option, /// URL to the media file pub public_bucket_path: String, //// Provenance Data //pub origin_product: MediaFileOriginProductCategory, //pub origin_category: MediaFileOriginCategory, //pub maybe_origin_model_type: Option, //pub maybe_origin_model_token: Option, //pub maybe_origin_filename: Option, /// Possible model info (if generated by inference) pub maybe_model_weight_info: Option, /// User info pub maybe_creator_user: Option, pub creator_set_visibility: String, /// Text transcripts for TTS, etc. pub maybe_text_transcript: Option, /// We can simulate media files for "tts_results" records. /// If this is set as true, this informs the frontend and API callers not to treat /// the token as a media file and improperly assume it can be used with the rest of /// the media file APIs. pub is_emulated_media_file: bool, /// Statistics about the media file pub stats: SimpleEntityStats, pub created_at: String, pub updated_at: String, //pub maybe_moderator_fields: Option, } #[derive(Deserialize, Debug)] pub struct GetMediaFileModelInfo { pub weight_token: String, pub weight_type: String, pub weight_category: String, pub title: String, /// Cover images are small descriptive images that can be set for any model. /// If a cover image is set, this is the path to the asset. pub maybe_cover_image_public_bucket_path: Option, /// NB: Technically this shouldn't be a nullable field, but since there are so many /// joins we'll relax that this must exist (for now). pub maybe_weight_creator: Option, } #[derive(Deserialize, Debug)] pub struct UserDetailsLight { /// The token for the user pub user_token: String, /// The unique username someone logs in with /// As of 2023-08-23, this is always lowercase pub username: String, /// As of 2023-08-23, this is the username with capitalization /// (In the future, a display name can be customized by the user.) pub display_name: String, /// Email hash for Gravatar /// Always set for now since login is email/username+password. /// In the future this will need to become an optional *OR* be filled with a bogus hash. pub gravatar_hash: String, /// For users without a gravatar, we show one of our own avatars. pub default_avatar: DefaultAvatarInfo, // In the future, we'll also support user-uploaded avatars that we store on our servers. } #[derive(Deserialize, Debug)] pub struct DefaultAvatarInfo { pub image_index: u8, pub color_index: u8, } #[derive(Deserialize, Debug)] pub struct SimpleEntityStats { /// Number of positive ratings (or "likes") for this item pub positive_rating_count: u32, /// Number of bookmarks for this item pub bookmark_count: u32, }