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 ChannelAdminLogEvent struct {
ID int64
Date int
UserID int64
Action ChannelAdminLogEventActionClass
}
const ChannelAdminLogEventTypeID = 0x1fad68cd
var (
_ bin .Encoder = &ChannelAdminLogEvent {}
_ bin .Decoder = &ChannelAdminLogEvent {}
_ bin .BareEncoder = &ChannelAdminLogEvent {}
_ bin .BareDecoder = &ChannelAdminLogEvent {}
)
func (c *ChannelAdminLogEvent ) Zero () bool {
if c == nil {
return true
}
if !(c .ID == 0 ) {
return false
}
if !(c .Date == 0 ) {
return false
}
if !(c .UserID == 0 ) {
return false
}
if !(c .Action == nil ) {
return false
}
return true
}
func (c *ChannelAdminLogEvent ) String () string {
if c == nil {
return "ChannelAdminLogEvent(nil)"
}
type Alias ChannelAdminLogEvent
return fmt .Sprintf ("ChannelAdminLogEvent%+v" , Alias (*c ))
}
func (c *ChannelAdminLogEvent ) FillFrom (from interface {
GetID () (value int64 )
GetDate () (value int )
GetUserID () (value int64 )
GetAction () (value ChannelAdminLogEventActionClass )
}) {
c .ID = from .GetID ()
c .Date = from .GetDate ()
c .UserID = from .GetUserID ()
c .Action = from .GetAction ()
}
func (*ChannelAdminLogEvent ) TypeID () uint32 {
return ChannelAdminLogEventTypeID
}
func (*ChannelAdminLogEvent ) TypeName () string {
return "channelAdminLogEvent"
}
func (c *ChannelAdminLogEvent ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channelAdminLogEvent" ,
ID : ChannelAdminLogEventTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Action" ,
SchemaName : "action" ,
},
}
return typ
}
func (c *ChannelAdminLogEvent ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelAdminLogEvent#1fad68cd as nil" )
}
b .PutID (ChannelAdminLogEventTypeID )
return c .EncodeBare (b )
}
func (c *ChannelAdminLogEvent ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode channelAdminLogEvent#1fad68cd as nil" )
}
b .PutLong (c .ID )
b .PutInt (c .Date )
b .PutLong (c .UserID )
if c .Action == nil {
return fmt .Errorf ("unable to encode channelAdminLogEvent#1fad68cd: field action is nil" )
}
if err := c .Action .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channelAdminLogEvent#1fad68cd: field action: %w" , err )
}
return nil
}
func (c *ChannelAdminLogEvent ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelAdminLogEvent#1fad68cd to nil" )
}
if err := b .ConsumeID (ChannelAdminLogEventTypeID ); err != nil {
return fmt .Errorf ("unable to decode channelAdminLogEvent#1fad68cd: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChannelAdminLogEvent ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode channelAdminLogEvent#1fad68cd to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelAdminLogEvent#1fad68cd: field id: %w" , err )
}
c .ID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channelAdminLogEvent#1fad68cd: field date: %w" , err )
}
c .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channelAdminLogEvent#1fad68cd: field user_id: %w" , err )
}
c .UserID = value
}
{
value , err := DecodeChannelAdminLogEventAction (b )
if err != nil {
return fmt .Errorf ("unable to decode channelAdminLogEvent#1fad68cd: field action: %w" , err )
}
c .Action = value
}
return nil
}
func (c *ChannelAdminLogEvent ) GetID () (value int64 ) {
if c == nil {
return
}
return c .ID
}
func (c *ChannelAdminLogEvent ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
func (c *ChannelAdminLogEvent ) GetUserID () (value int64 ) {
if c == nil {
return
}
return c .UserID
}
func (c *ChannelAdminLogEvent ) GetAction () (value ChannelAdminLogEventActionClass ) {
if c == nil {
return
}
return c .Action
}
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 .