1 |
use serde::{Deserialize, Serialize};
|
2 |
|
3 |
use crate::model::{instance::Instance, user::User};
|
4 |
|
5 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
6 |
pub struct UserMessage {
|
7 |
pub instance: Instance,
|
8 |
pub message: UserMessageKind,
|
9 |
}
|
10 |
|
11 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
12 |
pub enum UserMessageKind {
|
13 |
Request(UserMessageRequest),
|
14 |
Response(UserMessageResponse),
|
15 |
}
|
16 |
|
17 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
18 |
pub enum UserMessageRequest {
|
19 |
DisplayName(UserDisplayNameRequest),
|
20 |
DisplayImage(UserDisplayImageRequest),
|
21 |
Bio(UserBioRequest),
|
22 |
}
|
23 |
|
24 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
25 |
pub enum UserMessageResponse {
|
26 |
DisplayName(UserDisplayImageResponse),
|
27 |
DisplayImage(UserDisplayImageResponse),
|
28 |
Bio(UserBioResponse),
|
29 |
}
|
30 |
|
31 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
32 |
pub struct UserDisplayNameRequest {
|
33 |
pub user: User,
|
34 |
}
|
35 |
|
36 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
37 |
pub struct UserDisplayNameResponse {
|
38 |
pub display_name: String,
|
39 |
}
|
40 |
|
41 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
42 |
pub struct UserDisplayImageRequest {
|
43 |
pub user: User,
|
44 |
}
|
45 |
|
46 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
47 |
pub struct UserDisplayImageResponse {
|
48 |
pub image_url: String,
|
49 |
}
|
50 |
|
51 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
52 |
pub struct UserBioRequest {
|
53 |
pub user: User,
|
54 |
}
|
55 |
|
56 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
57 |
pub struct UserBioResponse {
|
58 |
pub bio: String,
|
59 |
}
|
60 |
|