-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fixtures_test.go
264 lines (206 loc) · 6.67 KB
/
fixtures_test.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
// Copyright (c) 2022-2024 Xelaj Software
//
// This file is a part of tl package.
// See https://github.com/xelaj/tl/blob/master/LICENSE_README.md for details.
//revive:disable:add-constant fixtures must have constants
//revive:disable:max-public-structs for test purposes
package tl_test
import (
. "github.com/xelaj/tl"
)
type GenericRequest[T any] struct {
MsgID int64
_ null `tl:"flag,bitflag"`
IsSpecificType bool `tl:",omitempty:flag:0,implicit"`
Msg T `tl:",omitempty:flag:1"`
}
func (*GenericRequest[T]) CRC() uint32 { return uint32(0x77553311) }
type MultipleChats struct {
Chats []Chat
}
func (*MultipleChats) CRC() uint32 { return uint32(0xff1144cc) }
type Chat struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Creator bool `tl:",omitempty:flag:0,implicit"`
Kicked bool `tl:",omitempty:flag:1,implicit"`
Left bool `tl:",omitempty:flag:2,implicit"`
Deactivated bool `tl:",omitempty:flag:5,implicit"`
ID int32
Title string
Photo string
ParticipantsCount int32
Date int32
Version int32
AdminRights *Rights `tl:",omitempty:flag:14"`
BannedRights *Rights `tl:",omitempty:flag:18"`
_ null `tl:"flag2,bitflag"`
CustomField bool `tl:",omitempty:flag2:0,implicit"`
}
func (*Chat) CRC() uint32 { return uint32(0x3bda1bde) }
type AuthSentCode struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Type AuthSentCodeType
PhoneCodeHash string
NextType AuthCodeType `tl:",omitempty:flag:1"`
Timeout *int32 `tl:",omitempty:flag:2"`
}
func (*AuthSentCode) CRC() uint32 { return uint32(0x5e002502) }
type SomeNullStruct null
func (*SomeNullStruct) CRC() uint32 { return uint32(0xc4f9186b) }
type AuthSentCodeType interface {
Object
_AuthSentCodeType()
}
type AuthSentCodeTypeApp struct {
Length int32
}
var _ AuthSentCodeType = (*AuthSentCodeTypeApp)(nil)
func (*AuthSentCodeTypeApp) CRC() uint32 { return uint32(0x3dbb5986) }
func (*AuthSentCodeTypeApp) _AuthSentCodeType() {}
type Rights struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
DeleteMessages bool `tl:",omitempty:flag:3,implicit"`
BanUsers bool `tl:",omitempty:flag:4,implicit"`
}
func (*Rights) CRC() uint32 { return uint32(0x5fb224d5) }
type AuthCodeType uint32
const (
AuthCodeTypeSms AuthCodeType = 1923290508
AuthCodeTypeCall AuthCodeType = 1948046307
AuthCodeTypeFlashCall AuthCodeType = 577556219
)
func (e AuthCodeType) String() string {
switch e {
case AuthCodeTypeSms:
return "auth.codeTypeSms"
case AuthCodeTypeCall:
return "auth.codeTypeCall"
case AuthCodeTypeFlashCall:
return "auth.codeTypeFlashCall"
default:
return "<UNKNOWN auth.CodeType>"
}
}
func (e AuthCodeType) CRC() uint32 { return uint32(e) }
type PollResults struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Min bool `tl:",omitempty:flag:0,implicit"`
Results []*PollAnswerVoters `tl:",omitempty:flag:1"`
TotalVoters *int32 `tl:",omitempty:flag:2"`
RecentVoters []int32 `tl:",omitempty:flag:3"`
Solution *string `tl:",omitempty:flag:4"`
SolutionEntities []MessageEntity `tl:",omitempty:flag:4"`
}
func (*PollResults) CRC() uint32 { return uint32(0xbadcc1a3) }
type PollAnswerVoters struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Chosen bool `tl:",omitempty:flag:0,implicit"`
Correct bool `tl:",omitempty:flag:1,implicit"`
Option []byte
Voters int32
}
func (*PollAnswerVoters) CRC() uint32 { return uint32(0x3b6ddad2) }
type MessageEntity interface {
Object
_MessageEntity()
}
type AccountInstallThemeParams struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Dark bool `tl:",omitempty:flag:0,implicit"`
Format *string `tl:",omitempty:flag:1"`
Theme InputTheme `tl:",omitempty:flag:1"`
}
func (*AccountInstallThemeParams) CRC() uint32 { return uint32(0x7ae43737) }
type InputTheme interface {
Object
_InputTheme()
}
type InputThemeObj struct {
ID int64
AccessHash int64
}
var _ InputTheme = (*InputThemeObj)(nil)
func (*InputThemeObj) CRC() uint32 { return uint32(0x3c5693e9) }
func (*InputThemeObj) _InputTheme() {}
type AccountUnregisterDeviceParams struct {
TokenType int32
Token string
OtherUids []int32
}
func (*AccountUnregisterDeviceParams) CRC() uint32 { return uint32(0x3076c4bf) }
type AnyStructWithAnyType struct {
SomeInt int32
Data any
}
func (*AnyStructWithAnyType) CRC() uint32 { return uint32(0xfdfd4646) }
type AnyStructWithAnyObject struct {
SomeInt int32
Data Object
}
func (*AnyStructWithAnyObject) CRC() uint32 { return uint32(0xfd46fd46) }
type InvokeWithLayerParams struct {
Layer int32
Query Object
}
func (*InvokeWithLayerParams) CRC() uint32 { return 0xda9b0d0d }
type InitConnectionParams struct {
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
APIID int32
DeviceModel string
SystemVersion string
AppVersion string
SystemLangCode string
LangPack string
LangCode string
Proxy Object `tl:",omitempty:flag:0"`
Params Object `tl:",omitempty:flag:1"`
Query Object
}
func (*InitConnectionParams) CRC() uint32 { return 0xc1cd5ea9 }
type ResPQ struct {
Nonce *Int128
ServerNonce *Int128
Pq []byte
Fingerprints []int64
}
func (*ResPQ) CRC() uint32 { return 0x05162463 }
type ResPQRaw struct {
Nonce [16]byte
ServerNonce [16]byte
Pq []byte
Fingerprints []int64
}
func (*ResPQRaw) CRC() uint32 { return 0x05162464 }
// issue #59 fixtures
type Poll struct {
ID int64
//nolint:revive // tl works with unexported tags
_ null `tl:"flag,bitflag"`
Closed bool `tl:",omitempty:flag:0,implicit"`
PublicVoters bool `tl:",omitempty:flag:1,implicit"`
MultipleChoice bool `tl:",omitempty:flag:2,implicit"`
Quiz bool `tl:",omitempty:flag:3,implicit"`
Question string
Answers []*PollAnswer
ClosePeriod *int32 `tl:",omitempty:flag:4"`
CloseDate *int32 `tl:",omitempty:flag:5"`
}
func (*Poll) CRC() uint32 { return 0x86e18161 }
type PollAnswer struct {
Text string
Option []byte
}
func (*PollAnswer) CRC() uint32 { return 0x6ca9c2e9 }
type DHParamsOk struct {
Nonce *Int128
ServerNonce *Int128
EncryptedAnswer []byte
}
func (*DHParamsOk) CRC() uint32 { return 0xd0e8075c }