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