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 InputAppEvent struct {
Time float64
Type string
Peer int64
Data JSONValueClass
}
const InputAppEventTypeID = 0x1d1b1245
var (
_ bin .Encoder = &InputAppEvent {}
_ bin .Decoder = &InputAppEvent {}
_ bin .BareEncoder = &InputAppEvent {}
_ bin .BareDecoder = &InputAppEvent {}
)
func (i *InputAppEvent ) Zero () bool {
if i == nil {
return true
}
if !(i .Time == 0 ) {
return false
}
if !(i .Type == "" ) {
return false
}
if !(i .Peer == 0 ) {
return false
}
if !(i .Data == nil ) {
return false
}
return true
}
func (i *InputAppEvent ) String () string {
if i == nil {
return "InputAppEvent(nil)"
}
type Alias InputAppEvent
return fmt .Sprintf ("InputAppEvent%+v" , Alias (*i ))
}
func (i *InputAppEvent ) FillFrom (from interface {
GetTime () (value float64 )
GetType () (value string )
GetPeer () (value int64 )
GetData () (value JSONValueClass )
}) {
i .Time = from .GetTime ()
i .Type = from .GetType ()
i .Peer = from .GetPeer ()
i .Data = from .GetData ()
}
func (*InputAppEvent ) TypeID () uint32 {
return InputAppEventTypeID
}
func (*InputAppEvent ) TypeName () string {
return "inputAppEvent"
}
func (i *InputAppEvent ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputAppEvent" ,
ID : InputAppEventTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Time" ,
SchemaName : "time" ,
},
{
Name : "Type" ,
SchemaName : "type" ,
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Data" ,
SchemaName : "data" ,
},
}
return typ
}
func (i *InputAppEvent ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputAppEvent#1d1b1245 as nil" )
}
b .PutID (InputAppEventTypeID )
return i .EncodeBare (b )
}
func (i *InputAppEvent ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputAppEvent#1d1b1245 as nil" )
}
b .PutDouble (i .Time )
b .PutString (i .Type )
b .PutLong (i .Peer )
if i .Data == nil {
return fmt .Errorf ("unable to encode inputAppEvent#1d1b1245: field data is nil" )
}
if err := i .Data .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputAppEvent#1d1b1245: field data: %w" , err )
}
return nil
}
func (i *InputAppEvent ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputAppEvent#1d1b1245 to nil" )
}
if err := b .ConsumeID (InputAppEventTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputAppEvent#1d1b1245: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputAppEvent ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputAppEvent#1d1b1245 to nil" )
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode inputAppEvent#1d1b1245: field time: %w" , err )
}
i .Time = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputAppEvent#1d1b1245: field type: %w" , err )
}
i .Type = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputAppEvent#1d1b1245: field peer: %w" , err )
}
i .Peer = value
}
{
value , err := DecodeJSONValue (b )
if err != nil {
return fmt .Errorf ("unable to decode inputAppEvent#1d1b1245: field data: %w" , err )
}
i .Data = value
}
return nil
}
func (i *InputAppEvent ) GetTime () (value float64 ) {
if i == nil {
return
}
return i .Time
}
func (i *InputAppEvent ) GetType () (value string ) {
if i == nil {
return
}
return i .Type
}
func (i *InputAppEvent ) GetPeer () (value int64 ) {
if i == nil {
return
}
return i .Peer
}
func (i *InputAppEvent ) GetData () (value JSONValueClass ) {
if i == nil {
return
}
return i .Data
}
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 .