-
-
Notifications
You must be signed in to change notification settings - Fork 129
/
tl_messages_edit_exported_chat_invite_gen.go
332 lines (301 loc) · 8.77 KB
/
tl_messages_edit_exported_chat_invite_gen.go
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
)
// MessagesEditExportedChatInviteRequest represents TL type `messages.editExportedChatInvite#2e4ffbe`.
//
// See https://core.telegram.org/method/messages.editExportedChatInvite for reference.
type MessagesEditExportedChatInviteRequest struct {
// Flags field of MessagesEditExportedChatInviteRequest.
Flags bin.Fields
// Revoked field of MessagesEditExportedChatInviteRequest.
Revoked bool
// Peer field of MessagesEditExportedChatInviteRequest.
Peer InputPeerClass
// Link field of MessagesEditExportedChatInviteRequest.
Link string
// ExpireDate field of MessagesEditExportedChatInviteRequest.
//
// Use SetExpireDate and GetExpireDate helpers.
ExpireDate int
// UsageLimit field of MessagesEditExportedChatInviteRequest.
//
// Use SetUsageLimit and GetUsageLimit helpers.
UsageLimit int
}
// MessagesEditExportedChatInviteRequestTypeID is TL type id of MessagesEditExportedChatInviteRequest.
const MessagesEditExportedChatInviteRequestTypeID = 0x2e4ffbe
func (e *MessagesEditExportedChatInviteRequest) Zero() bool {
if e == nil {
return true
}
if !(e.Flags.Zero()) {
return false
}
if !(e.Revoked == false) {
return false
}
if !(e.Peer == nil) {
return false
}
if !(e.Link == "") {
return false
}
if !(e.ExpireDate == 0) {
return false
}
if !(e.UsageLimit == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (e *MessagesEditExportedChatInviteRequest) String() string {
if e == nil {
return "MessagesEditExportedChatInviteRequest(nil)"
}
type Alias MessagesEditExportedChatInviteRequest
return fmt.Sprintf("MessagesEditExportedChatInviteRequest%+v", Alias(*e))
}
// FillFrom fills MessagesEditExportedChatInviteRequest from given interface.
func (e *MessagesEditExportedChatInviteRequest) FillFrom(from interface {
GetRevoked() (value bool)
GetPeer() (value InputPeerClass)
GetLink() (value string)
GetExpireDate() (value int, ok bool)
GetUsageLimit() (value int, ok bool)
}) {
e.Revoked = from.GetRevoked()
e.Peer = from.GetPeer()
e.Link = from.GetLink()
if val, ok := from.GetExpireDate(); ok {
e.ExpireDate = val
}
if val, ok := from.GetUsageLimit(); ok {
e.UsageLimit = val
}
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*MessagesEditExportedChatInviteRequest) TypeID() uint32 {
return MessagesEditExportedChatInviteRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*MessagesEditExportedChatInviteRequest) TypeName() string {
return "messages.editExportedChatInvite"
}
// TypeInfo returns info about TL type.
func (e *MessagesEditExportedChatInviteRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "messages.editExportedChatInvite",
ID: MessagesEditExportedChatInviteRequestTypeID,
}
if e == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Revoked",
SchemaName: "revoked",
Null: !e.Flags.Has(2),
},
{
Name: "Peer",
SchemaName: "peer",
},
{
Name: "Link",
SchemaName: "link",
},
{
Name: "ExpireDate",
SchemaName: "expire_date",
Null: !e.Flags.Has(0),
},
{
Name: "UsageLimit",
SchemaName: "usage_limit",
Null: !e.Flags.Has(1),
},
}
return typ
}
// Encode implements bin.Encoder.
func (e *MessagesEditExportedChatInviteRequest) Encode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode messages.editExportedChatInvite#2e4ffbe as nil")
}
b.PutID(MessagesEditExportedChatInviteRequestTypeID)
return e.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (e *MessagesEditExportedChatInviteRequest) EncodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode messages.editExportedChatInvite#2e4ffbe as nil")
}
if !(e.Revoked == false) {
e.Flags.Set(2)
}
if !(e.ExpireDate == 0) {
e.Flags.Set(0)
}
if !(e.UsageLimit == 0) {
e.Flags.Set(1)
}
if err := e.Flags.Encode(b); err != nil {
return fmt.Errorf("unable to encode messages.editExportedChatInvite#2e4ffbe: field flags: %w", err)
}
if e.Peer == nil {
return fmt.Errorf("unable to encode messages.editExportedChatInvite#2e4ffbe: field peer is nil")
}
if err := e.Peer.Encode(b); err != nil {
return fmt.Errorf("unable to encode messages.editExportedChatInvite#2e4ffbe: field peer: %w", err)
}
b.PutString(e.Link)
if e.Flags.Has(0) {
b.PutInt(e.ExpireDate)
}
if e.Flags.Has(1) {
b.PutInt(e.UsageLimit)
}
return nil
}
// SetRevoked sets value of Revoked conditional field.
func (e *MessagesEditExportedChatInviteRequest) SetRevoked(value bool) {
if value {
e.Flags.Set(2)
e.Revoked = true
} else {
e.Flags.Unset(2)
e.Revoked = false
}
}
// GetRevoked returns value of Revoked conditional field.
func (e *MessagesEditExportedChatInviteRequest) GetRevoked() (value bool) {
return e.Flags.Has(2)
}
// GetPeer returns value of Peer field.
func (e *MessagesEditExportedChatInviteRequest) GetPeer() (value InputPeerClass) {
return e.Peer
}
// GetLink returns value of Link field.
func (e *MessagesEditExportedChatInviteRequest) GetLink() (value string) {
return e.Link
}
// SetExpireDate sets value of ExpireDate conditional field.
func (e *MessagesEditExportedChatInviteRequest) SetExpireDate(value int) {
e.Flags.Set(0)
e.ExpireDate = value
}
// GetExpireDate returns value of ExpireDate conditional field and
// boolean which is true if field was set.
func (e *MessagesEditExportedChatInviteRequest) GetExpireDate() (value int, ok bool) {
if !e.Flags.Has(0) {
return value, false
}
return e.ExpireDate, true
}
// SetUsageLimit sets value of UsageLimit conditional field.
func (e *MessagesEditExportedChatInviteRequest) SetUsageLimit(value int) {
e.Flags.Set(1)
e.UsageLimit = value
}
// GetUsageLimit returns value of UsageLimit conditional field and
// boolean which is true if field was set.
func (e *MessagesEditExportedChatInviteRequest) GetUsageLimit() (value int, ok bool) {
if !e.Flags.Has(1) {
return value, false
}
return e.UsageLimit, true
}
// Decode implements bin.Decoder.
func (e *MessagesEditExportedChatInviteRequest) Decode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode messages.editExportedChatInvite#2e4ffbe to nil")
}
if err := b.ConsumeID(MessagesEditExportedChatInviteRequestTypeID); err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: %w", err)
}
return e.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (e *MessagesEditExportedChatInviteRequest) DecodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode messages.editExportedChatInvite#2e4ffbe to nil")
}
{
if err := e.Flags.Decode(b); err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: field flags: %w", err)
}
}
e.Revoked = e.Flags.Has(2)
{
value, err := DecodeInputPeer(b)
if err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: field peer: %w", err)
}
e.Peer = value
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: field link: %w", err)
}
e.Link = value
}
if e.Flags.Has(0) {
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: field expire_date: %w", err)
}
e.ExpireDate = value
}
if e.Flags.Has(1) {
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode messages.editExportedChatInvite#2e4ffbe: field usage_limit: %w", err)
}
e.UsageLimit = value
}
return nil
}
// Ensuring interfaces in compile-time for MessagesEditExportedChatInviteRequest.
var (
_ bin.Encoder = &MessagesEditExportedChatInviteRequest{}
_ bin.Decoder = &MessagesEditExportedChatInviteRequest{}
_ bin.BareEncoder = &MessagesEditExportedChatInviteRequest{}
_ bin.BareDecoder = &MessagesEditExportedChatInviteRequest{}
)
// MessagesEditExportedChatInvite invokes method messages.editExportedChatInvite#2e4ffbe returning error if any.
//
// See https://core.telegram.org/method/messages.editExportedChatInvite for reference.
func (c *Client) MessagesEditExportedChatInvite(ctx context.Context, request *MessagesEditExportedChatInviteRequest) (MessagesExportedChatInviteClass, error) {
var result MessagesExportedChatInviteBox
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
return nil, err
}
return result.ExportedChatInvite, nil
}