-
Notifications
You must be signed in to change notification settings - Fork 101
/
thumbnailFormat.go
executable file
·223 lines (179 loc) · 6.6 KB
/
thumbnailFormat.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
// AUTOGENERATED - DO NOT EDIT
package tdlib
import (
"encoding/json"
"fmt"
)
// ThumbnailFormat Describes format of the thumbnail
type ThumbnailFormat interface {
GetThumbnailFormatEnum() ThumbnailFormatEnum
}
// ThumbnailFormatEnum Alias for abstract ThumbnailFormat 'Sub-Classes', used as constant-enum here
type ThumbnailFormatEnum string
// ThumbnailFormat enums
const (
ThumbnailFormatJpegType ThumbnailFormatEnum = "thumbnailFormatJpeg"
ThumbnailFormatPngType ThumbnailFormatEnum = "thumbnailFormatPng"
ThumbnailFormatWebpType ThumbnailFormatEnum = "thumbnailFormatWebp"
ThumbnailFormatGifType ThumbnailFormatEnum = "thumbnailFormatGif"
ThumbnailFormatTgsType ThumbnailFormatEnum = "thumbnailFormatTgs"
ThumbnailFormatMpeg4Type ThumbnailFormatEnum = "thumbnailFormatMpeg4"
)
func unmarshalThumbnailFormat(rawMsg *json.RawMessage) (ThumbnailFormat, error) {
if rawMsg == nil {
return nil, nil
}
var objMap map[string]interface{}
err := json.Unmarshal(*rawMsg, &objMap)
if err != nil {
return nil, err
}
switch ThumbnailFormatEnum(objMap["@type"].(string)) {
case ThumbnailFormatJpegType:
var thumbnailFormatJpeg ThumbnailFormatJpeg
err := json.Unmarshal(*rawMsg, &thumbnailFormatJpeg)
return &thumbnailFormatJpeg, err
case ThumbnailFormatPngType:
var thumbnailFormatPng ThumbnailFormatPng
err := json.Unmarshal(*rawMsg, &thumbnailFormatPng)
return &thumbnailFormatPng, err
case ThumbnailFormatWebpType:
var thumbnailFormatWebp ThumbnailFormatWebp
err := json.Unmarshal(*rawMsg, &thumbnailFormatWebp)
return &thumbnailFormatWebp, err
case ThumbnailFormatGifType:
var thumbnailFormatGif ThumbnailFormatGif
err := json.Unmarshal(*rawMsg, &thumbnailFormatGif)
return &thumbnailFormatGif, err
case ThumbnailFormatTgsType:
var thumbnailFormatTgs ThumbnailFormatTgs
err := json.Unmarshal(*rawMsg, &thumbnailFormatTgs)
return &thumbnailFormatTgs, err
case ThumbnailFormatMpeg4Type:
var thumbnailFormatMpeg4 ThumbnailFormatMpeg4
err := json.Unmarshal(*rawMsg, &thumbnailFormatMpeg4)
return &thumbnailFormatMpeg4, err
default:
return nil, fmt.Errorf("Error UnMarshaling, unknown type:" + objMap["@type"].(string))
}
}
// ThumbnailFormatJpeg The thumbnail is in JPEG format
type ThumbnailFormatJpeg struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatJpeg
func (thumbnailFormatJpeg *ThumbnailFormatJpeg) MessageType() string {
return "thumbnailFormatJpeg"
}
// NewThumbnailFormatJpeg creates a new ThumbnailFormatJpeg
//
func NewThumbnailFormatJpeg() *ThumbnailFormatJpeg {
thumbnailFormatJpegTemp := ThumbnailFormatJpeg{
tdCommon: tdCommon{Type: "thumbnailFormatJpeg"},
}
return &thumbnailFormatJpegTemp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatJpeg *ThumbnailFormatJpeg) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatJpegType
}
// ThumbnailFormatPng The thumbnail is in PNG format. It will be used only for background patterns
type ThumbnailFormatPng struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatPng
func (thumbnailFormatPng *ThumbnailFormatPng) MessageType() string {
return "thumbnailFormatPng"
}
// NewThumbnailFormatPng creates a new ThumbnailFormatPng
//
func NewThumbnailFormatPng() *ThumbnailFormatPng {
thumbnailFormatPngTemp := ThumbnailFormatPng{
tdCommon: tdCommon{Type: "thumbnailFormatPng"},
}
return &thumbnailFormatPngTemp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatPng *ThumbnailFormatPng) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatPngType
}
// ThumbnailFormatWebp The thumbnail is in WEBP format. It will be used only for some stickers
type ThumbnailFormatWebp struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatWebp
func (thumbnailFormatWebp *ThumbnailFormatWebp) MessageType() string {
return "thumbnailFormatWebp"
}
// NewThumbnailFormatWebp creates a new ThumbnailFormatWebp
//
func NewThumbnailFormatWebp() *ThumbnailFormatWebp {
thumbnailFormatWebpTemp := ThumbnailFormatWebp{
tdCommon: tdCommon{Type: "thumbnailFormatWebp"},
}
return &thumbnailFormatWebpTemp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatWebp *ThumbnailFormatWebp) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatWebpType
}
// ThumbnailFormatGif The thumbnail is in static GIF format. It will be used only for some bot inline results
type ThumbnailFormatGif struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatGif
func (thumbnailFormatGif *ThumbnailFormatGif) MessageType() string {
return "thumbnailFormatGif"
}
// NewThumbnailFormatGif creates a new ThumbnailFormatGif
//
func NewThumbnailFormatGif() *ThumbnailFormatGif {
thumbnailFormatGifTemp := ThumbnailFormatGif{
tdCommon: tdCommon{Type: "thumbnailFormatGif"},
}
return &thumbnailFormatGifTemp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatGif *ThumbnailFormatGif) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatGifType
}
// ThumbnailFormatTgs The thumbnail is in TGS format. It will be used only for animated sticker sets
type ThumbnailFormatTgs struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatTgs
func (thumbnailFormatTgs *ThumbnailFormatTgs) MessageType() string {
return "thumbnailFormatTgs"
}
// NewThumbnailFormatTgs creates a new ThumbnailFormatTgs
//
func NewThumbnailFormatTgs() *ThumbnailFormatTgs {
thumbnailFormatTgsTemp := ThumbnailFormatTgs{
tdCommon: tdCommon{Type: "thumbnailFormatTgs"},
}
return &thumbnailFormatTgsTemp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatTgs *ThumbnailFormatTgs) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatTgsType
}
// ThumbnailFormatMpeg4 The thumbnail is in MPEG4 format. It will be used only for some animations and videos
type ThumbnailFormatMpeg4 struct {
tdCommon
}
// MessageType return the string telegram-type of ThumbnailFormatMpeg4
func (thumbnailFormatMpeg4 *ThumbnailFormatMpeg4) MessageType() string {
return "thumbnailFormatMpeg4"
}
// NewThumbnailFormatMpeg4 creates a new ThumbnailFormatMpeg4
//
func NewThumbnailFormatMpeg4() *ThumbnailFormatMpeg4 {
thumbnailFormatMpeg4Temp := ThumbnailFormatMpeg4{
tdCommon: tdCommon{Type: "thumbnailFormatMpeg4"},
}
return &thumbnailFormatMpeg4Temp
}
// GetThumbnailFormatEnum return the enum type of this object
func (thumbnailFormatMpeg4 *ThumbnailFormatMpeg4) GetThumbnailFormatEnum() ThumbnailFormatEnum {
return ThumbnailFormatMpeg4Type
}