titanium_model/builder/
emoji.rs1#[derive(Debug, Clone, serde::Serialize, Default)]
3pub struct CreateEmoji {
4 pub name: String,
5 pub image: String, #[serde(skip_serializing_if = "Vec::is_empty")]
7 pub roles: Vec<crate::Snowflake>,
8}
9
10#[derive(Debug, Clone)]
12pub struct CreateEmojiBuilder {
13 params: CreateEmoji,
14}
15
16impl CreateEmojiBuilder {
17 pub fn new(name: impl Into<String>, image_data: impl Into<String>) -> Self {
20 Self {
21 params: CreateEmoji {
22 name: name.into(),
23 image: image_data.into(),
24 roles: Vec::new(),
25 },
26 }
27 }
28
29 pub fn role(mut self, role_id: impl Into<crate::Snowflake>) -> Self {
31 self.params.roles.push(role_id.into());
32 self
33 }
34
35 #[must_use]
37 pub fn build(self) -> CreateEmoji {
38 self.params
39 }
40}
41
42#[derive(Debug, Clone, serde::Serialize, Default)]
44pub struct ModifyEmoji {
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub name: Option<String>,
47 #[serde(skip_serializing_if = "Option::is_none")]
48 pub roles: Option<Vec<crate::Snowflake>>,
49}
50
51#[derive(Debug, Clone, Default)]
53pub struct ModifyEmojiBuilder {
54 params: ModifyEmoji,
55}
56
57impl ModifyEmojiBuilder {
58 #[must_use]
60 pub fn new() -> Self {
61 Self::default()
62 }
63
64 pub fn name(mut self, name: impl Into<String>) -> Self {
66 self.params.name = Some(name.into());
67 self
68 }
69
70 #[must_use]
72 pub fn roles(mut self, roles: Vec<crate::Snowflake>) -> Self {
73 self.params.roles = Some(roles);
74 self
75 }
76
77 #[must_use]
79 pub fn build(self) -> ModifyEmoji {
80 self.params
81 }
82}