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 ChannelsGetAdminLogRequest struct {
Flags bin .Fields
Channel InputChannelClass
Q string
EventsFilter ChannelAdminLogEventsFilter
Admins []InputUserClass
MaxID int64
MinID int64
Limit int
}
const ChannelsGetAdminLogRequestTypeID = 0x33ddf480
var (
_ bin .Encoder = &ChannelsGetAdminLogRequest {}
_ bin .Decoder = &ChannelsGetAdminLogRequest {}
_ bin .BareEncoder = &ChannelsGetAdminLogRequest {}
_ bin .BareDecoder = &ChannelsGetAdminLogRequest {}
)
func (g *ChannelsGetAdminLogRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Channel == nil ) {
return false
}
if !(g .Q == "" ) {
return false
}
if !(g .EventsFilter .Zero ()) {
return false
}
if !(g .Admins == nil ) {
return false
}
if !(g .MaxID == 0 ) {
return false
}
if !(g .MinID == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *ChannelsGetAdminLogRequest ) String () string {
if g == nil {
return "ChannelsGetAdminLogRequest(nil)"
}
type Alias ChannelsGetAdminLogRequest
return fmt .Sprintf ("ChannelsGetAdminLogRequest%+v" , Alias (*g ))
}
func (g *ChannelsGetAdminLogRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetQ () (value string )
GetEventsFilter () (value ChannelAdminLogEventsFilter , ok bool )
GetAdmins () (value []InputUserClass , ok bool )
GetMaxID () (value int64 )
GetMinID () (value int64 )
GetLimit () (value int )
}) {
g .Channel = from .GetChannel ()
g .Q = from .GetQ ()
if val , ok := from .GetEventsFilter (); ok {
g .EventsFilter = val
}
if val , ok := from .GetAdmins (); ok {
g .Admins = val
}
g .MaxID = from .GetMaxID ()
g .MinID = from .GetMinID ()
g .Limit = from .GetLimit ()
}
func (*ChannelsGetAdminLogRequest ) TypeID () uint32 {
return ChannelsGetAdminLogRequestTypeID
}
func (*ChannelsGetAdminLogRequest ) TypeName () string {
return "channels.getAdminLog"
}
func (g *ChannelsGetAdminLogRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.getAdminLog" ,
ID : ChannelsGetAdminLogRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "EventsFilter" ,
SchemaName : "events_filter" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Admins" ,
SchemaName : "admins" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "MaxID" ,
SchemaName : "max_id" ,
},
{
Name : "MinID" ,
SchemaName : "min_id" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *ChannelsGetAdminLogRequest ) SetFlags () {
if !(g .EventsFilter .Zero ()) {
g .Flags .Set (0 )
}
if !(g .Admins == nil ) {
g .Flags .Set (1 )
}
}
func (g *ChannelsGetAdminLogRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getAdminLog#33ddf480 as nil" )
}
b .PutID (ChannelsGetAdminLogRequestTypeID )
return g .EncodeBare (b )
}
func (g *ChannelsGetAdminLogRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getAdminLog#33ddf480 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field flags: %w" , err )
}
if g .Channel == nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field channel: %w" , err )
}
b .PutString (g .Q )
if g .Flags .Has (0 ) {
if err := g .EventsFilter .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field events_filter: %w" , err )
}
}
if g .Flags .Has (1 ) {
b .PutVectorHeader (len (g .Admins ))
for idx , v := range g .Admins {
if v == nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field admins element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getAdminLog#33ddf480: field admins element with index %d: %w" , idx , err )
}
}
}
b .PutLong (g .MaxID )
b .PutLong (g .MinID )
b .PutInt (g .Limit )
return nil
}
func (g *ChannelsGetAdminLogRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getAdminLog#33ddf480 to nil" )
}
if err := b .ConsumeID (ChannelsGetAdminLogRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ChannelsGetAdminLogRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getAdminLog#33ddf480 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field flags: %w" , err )
}
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field channel: %w" , err )
}
g .Channel = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field q: %w" , err )
}
g .Q = value
}
if g .Flags .Has (0 ) {
if err := g .EventsFilter .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field events_filter: %w" , err )
}
}
if g .Flags .Has (1 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field admins: %w" , err )
}
if headerLen > 0 {
g .Admins = make ([]InputUserClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field admins: %w" , err )
}
g .Admins = append (g .Admins , value )
}
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field max_id: %w" , err )
}
g .MaxID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field min_id: %w" , err )
}
g .MinID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.getAdminLog#33ddf480: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *ChannelsGetAdminLogRequest ) GetChannel () (value InputChannelClass ) {
if g == nil {
return
}
return g .Channel
}
func (g *ChannelsGetAdminLogRequest ) GetQ () (value string ) {
if g == nil {
return
}
return g .Q
}
func (g *ChannelsGetAdminLogRequest ) SetEventsFilter (value ChannelAdminLogEventsFilter ) {
g .Flags .Set (0 )
g .EventsFilter = value
}
func (g *ChannelsGetAdminLogRequest ) GetEventsFilter () (value ChannelAdminLogEventsFilter , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .EventsFilter , true
}
func (g *ChannelsGetAdminLogRequest ) SetAdmins (value []InputUserClass ) {
g .Flags .Set (1 )
g .Admins = value
}
func (g *ChannelsGetAdminLogRequest ) GetAdmins () (value []InputUserClass , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (1 ) {
return value , false
}
return g .Admins , true
}
func (g *ChannelsGetAdminLogRequest ) GetMaxID () (value int64 ) {
if g == nil {
return
}
return g .MaxID
}
func (g *ChannelsGetAdminLogRequest ) GetMinID () (value int64 ) {
if g == nil {
return
}
return g .MinID
}
func (g *ChannelsGetAdminLogRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *ChannelsGetAdminLogRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Channel .AsNotEmpty ()
}
func (g *ChannelsGetAdminLogRequest ) MapAdmins () (value InputUserClassArray , ok bool ) {
if !g .Flags .Has (1 ) {
return value , false
}
return InputUserClassArray (g .Admins ), true
}
func (c *Client ) ChannelsGetAdminLog (ctx context .Context , request *ChannelsGetAdminLogRequest ) (*ChannelsAdminLogResults , error ) {
var result ChannelsAdminLogResults
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .