/
tl_input_bot_inline_message_id_gen.go
205 lines (183 loc) · 4.69 KB
/
tl_input_bot_inline_message_id_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
// 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{}
)
// InputBotInlineMessageID represents TL type `inputBotInlineMessageID#890c3d89`.
// Represents a sent inline message from the perspective of a bot
//
// See https://core.telegram.org/constructor/inputBotInlineMessageID for reference.
type InputBotInlineMessageID struct {
// DC ID to use when working with this inline message
DCID int
// ID of message
ID int64
// Access hash of message
AccessHash int64
}
// InputBotInlineMessageIDTypeID is TL type id of InputBotInlineMessageID.
const InputBotInlineMessageIDTypeID = 0x890c3d89
// Ensuring interfaces in compile-time for InputBotInlineMessageID.
var (
_ bin.Encoder = &InputBotInlineMessageID{}
_ bin.Decoder = &InputBotInlineMessageID{}
_ bin.BareEncoder = &InputBotInlineMessageID{}
_ bin.BareDecoder = &InputBotInlineMessageID{}
)
func (i *InputBotInlineMessageID) Zero() bool {
if i == nil {
return true
}
if !(i.DCID == 0) {
return false
}
if !(i.ID == 0) {
return false
}
if !(i.AccessHash == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (i *InputBotInlineMessageID) String() string {
if i == nil {
return "InputBotInlineMessageID(nil)"
}
type Alias InputBotInlineMessageID
return fmt.Sprintf("InputBotInlineMessageID%+v", Alias(*i))
}
// FillFrom fills InputBotInlineMessageID from given interface.
func (i *InputBotInlineMessageID) FillFrom(from interface {
GetDCID() (value int)
GetID() (value int64)
GetAccessHash() (value int64)
}) {
i.DCID = from.GetDCID()
i.ID = from.GetID()
i.AccessHash = from.GetAccessHash()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputBotInlineMessageID) TypeID() uint32 {
return InputBotInlineMessageIDTypeID
}
// TypeName returns name of type in TL schema.
func (*InputBotInlineMessageID) TypeName() string {
return "inputBotInlineMessageID"
}
// TypeInfo returns info about TL type.
func (i *InputBotInlineMessageID) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "inputBotInlineMessageID",
ID: InputBotInlineMessageIDTypeID,
}
if i == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "DCID",
SchemaName: "dc_id",
},
{
Name: "ID",
SchemaName: "id",
},
{
Name: "AccessHash",
SchemaName: "access_hash",
},
}
return typ
}
// Encode implements bin.Encoder.
func (i *InputBotInlineMessageID) Encode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputBotInlineMessageID#890c3d89 as nil")
}
b.PutID(InputBotInlineMessageIDTypeID)
return i.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (i *InputBotInlineMessageID) EncodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't encode inputBotInlineMessageID#890c3d89 as nil")
}
b.PutInt(i.DCID)
b.PutLong(i.ID)
b.PutLong(i.AccessHash)
return nil
}
// Decode implements bin.Decoder.
func (i *InputBotInlineMessageID) Decode(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputBotInlineMessageID#890c3d89 to nil")
}
if err := b.ConsumeID(InputBotInlineMessageIDTypeID); err != nil {
return fmt.Errorf("unable to decode inputBotInlineMessageID#890c3d89: %w", err)
}
return i.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (i *InputBotInlineMessageID) DecodeBare(b *bin.Buffer) error {
if i == nil {
return fmt.Errorf("can't decode inputBotInlineMessageID#890c3d89 to nil")
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode inputBotInlineMessageID#890c3d89: field dc_id: %w", err)
}
i.DCID = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode inputBotInlineMessageID#890c3d89: field id: %w", err)
}
i.ID = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode inputBotInlineMessageID#890c3d89: field access_hash: %w", err)
}
i.AccessHash = value
}
return nil
}
// GetDCID returns value of DCID field.
func (i *InputBotInlineMessageID) GetDCID() (value int) {
return i.DCID
}
// GetID returns value of ID field.
func (i *InputBotInlineMessageID) GetID() (value int64) {
return i.ID
}
// GetAccessHash returns value of AccessHash field.
func (i *InputBotInlineMessageID) GetAccessHash() (value int64) {
return i.AccessHash
}