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
use serde::{Deserialize, Serialize};
use crate::entities::user::User;
/// Represents an invite link for a chat.
///
/// API Reference: [link](https://core.telegram.org/bots/api/#chatinvitelink)
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ChatInviteLink {
/// The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
pub invite_link: String,
/// Creator of the link
pub creator: User,
/// *True*, if users joining the chat via the link need to be approved by chat administrators
pub creates_join_request: bool,
/// *True*, if the link is primary
pub is_primary: bool,
/// *True*, if the link is revoked
pub is_revoked: bool,
/// *Optional*. Invite link name
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// *Optional*. Point in time (Unix timestamp) when the link will expire or has been expired
#[serde(default, skip_serializing_if = "Option::is_none")]
pub expire_date: Option<i64>,
/// *Optional*. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
#[serde(default, skip_serializing_if = "Option::is_none")]
pub member_limit: Option<i64>,
/// *Optional*. Number of pending join requests created using this link
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pending_join_request_count: Option<i64>,
/// *Optional*. The number of seconds the subscription will be active for before the next payment
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_period: Option<i64>,
/// *Optional*. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_price: Option<i64>,
}
// Divider: all content below this line will be preserved after code regen
use super::misc::chat_id::ChatId;
use crate::{api::API, methods::revoke_chat_invite_link::RevokeChatInviteLinkRequest};
impl ChatInviteLink {
pub fn revoke<'a>(
&'a self,
api: &'a API,
chat_id: impl Into<ChatId>,
) -> RevokeChatInviteLinkRequest<'a> {
api.revoke_chat_invite_link(chat_id.into(), &self.invite_link)
}
}