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"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type InputStickeredMediaPhoto struct {
ID InputPhotoClass
}
const InputStickeredMediaPhotoTypeID = 0x4a992157
func (i InputStickeredMediaPhoto ) construct () InputStickeredMediaClass { return &i }
var (
_ bin .Encoder = &InputStickeredMediaPhoto {}
_ bin .Decoder = &InputStickeredMediaPhoto {}
_ bin .BareEncoder = &InputStickeredMediaPhoto {}
_ bin .BareDecoder = &InputStickeredMediaPhoto {}
_ InputStickeredMediaClass = &InputStickeredMediaPhoto {}
)
func (i *InputStickeredMediaPhoto ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == nil ) {
return false
}
return true
}
func (i *InputStickeredMediaPhoto ) String () string {
if i == nil {
return "InputStickeredMediaPhoto(nil)"
}
type Alias InputStickeredMediaPhoto
return fmt .Sprintf ("InputStickeredMediaPhoto%+v" , Alias (*i ))
}
func (i *InputStickeredMediaPhoto ) FillFrom (from interface {
GetID () (value InputPhotoClass )
}) {
i .ID = from .GetID ()
}
func (*InputStickeredMediaPhoto ) TypeID () uint32 {
return InputStickeredMediaPhotoTypeID
}
func (*InputStickeredMediaPhoto ) TypeName () string {
return "inputStickeredMediaPhoto"
}
func (i *InputStickeredMediaPhoto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputStickeredMediaPhoto" ,
ID : InputStickeredMediaPhotoTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputStickeredMediaPhoto ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStickeredMediaPhoto#4a992157 as nil" )
}
b .PutID (InputStickeredMediaPhotoTypeID )
return i .EncodeBare (b )
}
func (i *InputStickeredMediaPhoto ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStickeredMediaPhoto#4a992157 as nil" )
}
if i .ID == nil {
return fmt .Errorf ("unable to encode inputStickeredMediaPhoto#4a992157: field id is nil" )
}
if err := i .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputStickeredMediaPhoto#4a992157: field id: %w" , err )
}
return nil
}
func (i *InputStickeredMediaPhoto ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStickeredMediaPhoto#4a992157 to nil" )
}
if err := b .ConsumeID (InputStickeredMediaPhotoTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputStickeredMediaPhoto#4a992157: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputStickeredMediaPhoto ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStickeredMediaPhoto#4a992157 to nil" )
}
{
value , err := DecodeInputPhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode inputStickeredMediaPhoto#4a992157: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputStickeredMediaPhoto ) GetID () (value InputPhotoClass ) {
if i == nil {
return
}
return i .ID
}
type InputStickeredMediaDocument struct {
ID InputDocumentClass
}
const InputStickeredMediaDocumentTypeID = 0x438865b
func (i InputStickeredMediaDocument ) construct () InputStickeredMediaClass { return &i }
var (
_ bin .Encoder = &InputStickeredMediaDocument {}
_ bin .Decoder = &InputStickeredMediaDocument {}
_ bin .BareEncoder = &InputStickeredMediaDocument {}
_ bin .BareDecoder = &InputStickeredMediaDocument {}
_ InputStickeredMediaClass = &InputStickeredMediaDocument {}
)
func (i *InputStickeredMediaDocument ) Zero () bool {
if i == nil {
return true
}
if !(i .ID == nil ) {
return false
}
return true
}
func (i *InputStickeredMediaDocument ) String () string {
if i == nil {
return "InputStickeredMediaDocument(nil)"
}
type Alias InputStickeredMediaDocument
return fmt .Sprintf ("InputStickeredMediaDocument%+v" , Alias (*i ))
}
func (i *InputStickeredMediaDocument ) FillFrom (from interface {
GetID () (value InputDocumentClass )
}) {
i .ID = from .GetID ()
}
func (*InputStickeredMediaDocument ) TypeID () uint32 {
return InputStickeredMediaDocumentTypeID
}
func (*InputStickeredMediaDocument ) TypeName () string {
return "inputStickeredMediaDocument"
}
func (i *InputStickeredMediaDocument ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputStickeredMediaDocument" ,
ID : InputStickeredMediaDocumentTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (i *InputStickeredMediaDocument ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStickeredMediaDocument#438865b as nil" )
}
b .PutID (InputStickeredMediaDocumentTypeID )
return i .EncodeBare (b )
}
func (i *InputStickeredMediaDocument ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputStickeredMediaDocument#438865b as nil" )
}
if i .ID == nil {
return fmt .Errorf ("unable to encode inputStickeredMediaDocument#438865b: field id is nil" )
}
if err := i .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputStickeredMediaDocument#438865b: field id: %w" , err )
}
return nil
}
func (i *InputStickeredMediaDocument ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStickeredMediaDocument#438865b to nil" )
}
if err := b .ConsumeID (InputStickeredMediaDocumentTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputStickeredMediaDocument#438865b: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputStickeredMediaDocument ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputStickeredMediaDocument#438865b to nil" )
}
{
value , err := DecodeInputDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode inputStickeredMediaDocument#438865b: field id: %w" , err )
}
i .ID = value
}
return nil
}
func (i *InputStickeredMediaDocument ) GetID () (value InputDocumentClass ) {
if i == nil {
return
}
return i .ID
}
const InputStickeredMediaClassName = "InputStickeredMedia"
type InputStickeredMediaClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputStickeredMediaClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputStickeredMedia (buf *bin .Buffer ) (InputStickeredMediaClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputStickeredMediaPhotoTypeID :
v := InputStickeredMediaPhoto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputStickeredMediaClass: %w" , err )
}
return &v , nil
case InputStickeredMediaDocumentTypeID :
v := InputStickeredMediaDocument {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputStickeredMediaClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputStickeredMediaClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputStickeredMediaBox struct {
InputStickeredMedia InputStickeredMediaClass
}
func (b *InputStickeredMediaBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputStickeredMediaBox to nil" )
}
v , err := DecodeInputStickeredMedia (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputStickeredMedia = v
return nil
}
func (b *InputStickeredMediaBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputStickeredMedia == nil {
return fmt .Errorf ("unable to encode InputStickeredMediaClass as nil" )
}
return b .InputStickeredMedia .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .