-
-
Notifications
You must be signed in to change notification settings - Fork 129
/
tl_channels_get_participants_gen.go
319 lines (292 loc) · 7.9 KB
/
tl_channels_get_participants_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
// 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/tdjson"
"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{}
_ = tdjson.Encoder{}
)
// ChannelsGetParticipantsRequest represents TL type `channels.getParticipants#77ced9d0`.
// Get the participants of a supergroup/channel¹
//
// Links:
// 1) https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/channels.getParticipants for reference.
type ChannelsGetParticipantsRequest struct {
// Channel
Channel InputChannelClass
// Which participant types to fetch
Filter ChannelParticipantsFilterClass
// Offset¹
//
// Links:
// 1) https://core.telegram.org/api/offsets
Offset int
// Limit¹
//
// Links:
// 1) https://core.telegram.org/api/offsets
Limit int
// Hash¹
//
// Links:
// 1) https://core.telegram.org/api/offsets
Hash int64
}
// ChannelsGetParticipantsRequestTypeID is TL type id of ChannelsGetParticipantsRequest.
const ChannelsGetParticipantsRequestTypeID = 0x77ced9d0
// Ensuring interfaces in compile-time for ChannelsGetParticipantsRequest.
var (
_ bin.Encoder = &ChannelsGetParticipantsRequest{}
_ bin.Decoder = &ChannelsGetParticipantsRequest{}
_ bin.BareEncoder = &ChannelsGetParticipantsRequest{}
_ bin.BareDecoder = &ChannelsGetParticipantsRequest{}
)
func (g *ChannelsGetParticipantsRequest) Zero() bool {
if g == nil {
return true
}
if !(g.Channel == nil) {
return false
}
if !(g.Filter == nil) {
return false
}
if !(g.Offset == 0) {
return false
}
if !(g.Limit == 0) {
return false
}
if !(g.Hash == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (g *ChannelsGetParticipantsRequest) String() string {
if g == nil {
return "ChannelsGetParticipantsRequest(nil)"
}
type Alias ChannelsGetParticipantsRequest
return fmt.Sprintf("ChannelsGetParticipantsRequest%+v", Alias(*g))
}
// FillFrom fills ChannelsGetParticipantsRequest from given interface.
func (g *ChannelsGetParticipantsRequest) FillFrom(from interface {
GetChannel() (value InputChannelClass)
GetFilter() (value ChannelParticipantsFilterClass)
GetOffset() (value int)
GetLimit() (value int)
GetHash() (value int64)
}) {
g.Channel = from.GetChannel()
g.Filter = from.GetFilter()
g.Offset = from.GetOffset()
g.Limit = from.GetLimit()
g.Hash = from.GetHash()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*ChannelsGetParticipantsRequest) TypeID() uint32 {
return ChannelsGetParticipantsRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*ChannelsGetParticipantsRequest) TypeName() string {
return "channels.getParticipants"
}
// TypeInfo returns info about TL type.
func (g *ChannelsGetParticipantsRequest) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "channels.getParticipants",
ID: ChannelsGetParticipantsRequestTypeID,
}
if g == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Channel",
SchemaName: "channel",
},
{
Name: "Filter",
SchemaName: "filter",
},
{
Name: "Offset",
SchemaName: "offset",
},
{
Name: "Limit",
SchemaName: "limit",
},
{
Name: "Hash",
SchemaName: "hash",
},
}
return typ
}
// Encode implements bin.Encoder.
func (g *ChannelsGetParticipantsRequest) Encode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode channels.getParticipants#77ced9d0 as nil")
}
b.PutID(ChannelsGetParticipantsRequestTypeID)
return g.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (g *ChannelsGetParticipantsRequest) EncodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't encode channels.getParticipants#77ced9d0 as nil")
}
if g.Channel == nil {
return fmt.Errorf("unable to encode channels.getParticipants#77ced9d0: field channel is nil")
}
if err := g.Channel.Encode(b); err != nil {
return fmt.Errorf("unable to encode channels.getParticipants#77ced9d0: field channel: %w", err)
}
if g.Filter == nil {
return fmt.Errorf("unable to encode channels.getParticipants#77ced9d0: field filter is nil")
}
if err := g.Filter.Encode(b); err != nil {
return fmt.Errorf("unable to encode channels.getParticipants#77ced9d0: field filter: %w", err)
}
b.PutInt(g.Offset)
b.PutInt(g.Limit)
b.PutLong(g.Hash)
return nil
}
// Decode implements bin.Decoder.
func (g *ChannelsGetParticipantsRequest) Decode(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode channels.getParticipants#77ced9d0 to nil")
}
if err := b.ConsumeID(ChannelsGetParticipantsRequestTypeID); err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: %w", err)
}
return g.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (g *ChannelsGetParticipantsRequest) DecodeBare(b *bin.Buffer) error {
if g == nil {
return fmt.Errorf("can't decode channels.getParticipants#77ced9d0 to nil")
}
{
value, err := DecodeInputChannel(b)
if err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: field channel: %w", err)
}
g.Channel = value
}
{
value, err := DecodeChannelParticipantsFilter(b)
if err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: field filter: %w", err)
}
g.Filter = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: field offset: %w", err)
}
g.Offset = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: field limit: %w", err)
}
g.Limit = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode channels.getParticipants#77ced9d0: field hash: %w", err)
}
g.Hash = value
}
return nil
}
// GetChannel returns value of Channel field.
func (g *ChannelsGetParticipantsRequest) GetChannel() (value InputChannelClass) {
if g == nil {
return
}
return g.Channel
}
// GetFilter returns value of Filter field.
func (g *ChannelsGetParticipantsRequest) GetFilter() (value ChannelParticipantsFilterClass) {
if g == nil {
return
}
return g.Filter
}
// GetOffset returns value of Offset field.
func (g *ChannelsGetParticipantsRequest) GetOffset() (value int) {
if g == nil {
return
}
return g.Offset
}
// GetLimit returns value of Limit field.
func (g *ChannelsGetParticipantsRequest) GetLimit() (value int) {
if g == nil {
return
}
return g.Limit
}
// GetHash returns value of Hash field.
func (g *ChannelsGetParticipantsRequest) GetHash() (value int64) {
if g == nil {
return
}
return g.Hash
}
// GetChannelAsNotEmpty returns mapped value of Channel field.
func (g *ChannelsGetParticipantsRequest) GetChannelAsNotEmpty() (NotEmptyInputChannel, bool) {
return g.Channel.AsNotEmpty()
}
// ChannelsGetParticipants invokes method channels.getParticipants#77ced9d0 returning error if any.
// Get the participants of a supergroup/channel¹
//
// Links:
// 1) https://core.telegram.org/api/channel
//
// Possible errors:
// 400 CHANNEL_INVALID: The provided channel is invalid.
// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
// 400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//
// See https://core.telegram.org/method/channels.getParticipants for reference.
// Can be used by bots.
func (c *Client) ChannelsGetParticipants(ctx context.Context, request *ChannelsGetParticipantsRequest) (ChannelsChannelParticipantsClass, error) {
var result ChannelsChannelParticipantsBox
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
return nil, err
}
return result.ChannelParticipants, nil
}