1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use serde::{Deserialize, Serialize};
/// This object represents a channel chat.
/// # Notes
/// This object represents a chat from original chat type `channel`.
/// # Documentation
/// <https://core.telegram.org/bots/api#chat>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ChatChannel {
/// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
pub id: i64,
/// Title, for supergroups, channels and group chats
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<Box<str>>,
/// Username, for private chats, supergroups and channels if available
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<Box<str>>,
/// `true`, if the chat is the direct messages chat of a channel
#[serde(skip_serializing_if = "Option::is_none")]
pub is_direct_messages: Option<bool>,
}
impl ChatChannel {
/// Creates a new `ChatChannel`.
///
/// # Arguments
/// * `id` - Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<i64>>(id: T0) -> Self {
Self {
id: id.into(),
title: None,
username: None,
is_direct_messages: None,
}
}
/// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
#[must_use]
pub fn id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.id = val.into();
this
}
/// Title, for supergroups, channels and group chats
#[must_use]
pub fn title<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.title = Some(val.into());
this
}
/// Title, for supergroups, channels and group chats
#[must_use]
pub fn title_option<T: Into<Box<str>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.title = val.map(Into::into);
this
}
/// Username, for private chats, supergroups and channels if available
#[must_use]
pub fn username<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.username = Some(val.into());
this
}
/// Username, for private chats, supergroups and channels if available
#[must_use]
pub fn username_option<T: Into<Box<str>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.username = val.map(Into::into);
this
}
/// `true`, if the chat is the direct messages chat of a channel
#[must_use]
pub fn is_direct_messages<T: Into<bool>>(self, val: T) -> Self {
let mut this = self;
this.is_direct_messages = Some(val.into());
this
}
/// `true`, if the chat is the direct messages chat of a channel
#[must_use]
pub fn is_direct_messages_option<T: Into<bool>>(self, val: Option<T>) -> Self {
let mut this = self;
this.is_direct_messages = val.map(Into::into);
this
}
}