use serde::{Deserialize, Serialize}; use crate::model::{instance::Instance, repository::Repository, user::User}; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserMessage { pub instance: Instance, pub message: UserMessageKind, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum UserMessageKind { Request(UserMessageRequest), Response(UserMessageResponse), } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum UserMessageRequest { DisplayName(UserDisplayNameRequest), DisplayImage(UserDisplayImageRequest), Bio(UserBioRequest), Repositories(UserRepositoriesRequest), } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum UserMessageResponse { DisplayName(UserDisplayNameResponse), DisplayImage(UserDisplayImageResponse), Bio(UserBioResponse), Repositories(UserRepositoriesResponse), } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserDisplayNameRequest { pub user: User, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserDisplayNameResponse { pub display_name: Option, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserDisplayImageRequest { pub user: User, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserDisplayImageResponse { pub image_url: Option, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserBioRequest { pub user: User, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserBioResponse { pub bio: Option, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserRepositoriesRequest { pub user: User, } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct UserRepositoriesResponse { pub repositories: Vec, }