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 UpdatesGetChannelDifferenceRequest struct {
Flags bin .Fields
Force bool
Channel InputChannelClass
Filter ChannelMessagesFilterClass
Pts int
Limit int
}
const UpdatesGetChannelDifferenceRequestTypeID = 0x3173d78
var (
_ bin .Encoder = &UpdatesGetChannelDifferenceRequest {}
_ bin .Decoder = &UpdatesGetChannelDifferenceRequest {}
_ bin .BareEncoder = &UpdatesGetChannelDifferenceRequest {}
_ bin .BareDecoder = &UpdatesGetChannelDifferenceRequest {}
)
func (g *UpdatesGetChannelDifferenceRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Force == false ) {
return false
}
if !(g .Channel == nil ) {
return false
}
if !(g .Filter == nil ) {
return false
}
if !(g .Pts == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *UpdatesGetChannelDifferenceRequest ) String () string {
if g == nil {
return "UpdatesGetChannelDifferenceRequest(nil)"
}
type Alias UpdatesGetChannelDifferenceRequest
return fmt .Sprintf ("UpdatesGetChannelDifferenceRequest%+v" , Alias (*g ))
}
func (g *UpdatesGetChannelDifferenceRequest ) FillFrom (from interface {
GetForce () (value bool )
GetChannel () (value InputChannelClass )
GetFilter () (value ChannelMessagesFilterClass )
GetPts () (value int )
GetLimit () (value int )
}) {
g .Force = from .GetForce ()
g .Channel = from .GetChannel ()
g .Filter = from .GetFilter ()
g .Pts = from .GetPts ()
g .Limit = from .GetLimit ()
}
func (*UpdatesGetChannelDifferenceRequest ) TypeID () uint32 {
return UpdatesGetChannelDifferenceRequestTypeID
}
func (*UpdatesGetChannelDifferenceRequest ) TypeName () string {
return "updates.getChannelDifference"
}
func (g *UpdatesGetChannelDifferenceRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.getChannelDifference" ,
ID : UpdatesGetChannelDifferenceRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Force" ,
SchemaName : "force" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Filter" ,
SchemaName : "filter" ,
},
{
Name : "Pts" ,
SchemaName : "pts" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *UpdatesGetChannelDifferenceRequest ) SetFlags () {
if !(g .Force == false ) {
g .Flags .Set (0 )
}
}
func (g *UpdatesGetChannelDifferenceRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode updates.getChannelDifference#3173d78 as nil" )
}
b .PutID (UpdatesGetChannelDifferenceRequestTypeID )
return g .EncodeBare (b )
}
func (g *UpdatesGetChannelDifferenceRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode updates.getChannelDifference#3173d78 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.getChannelDifference#3173d78: field flags: %w" , err )
}
if g .Channel == nil {
return fmt .Errorf ("unable to encode updates.getChannelDifference#3173d78: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.getChannelDifference#3173d78: field channel: %w" , err )
}
if g .Filter == nil {
return fmt .Errorf ("unable to encode updates.getChannelDifference#3173d78: field filter is nil" )
}
if err := g .Filter .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.getChannelDifference#3173d78: field filter: %w" , err )
}
b .PutInt (g .Pts )
b .PutInt (g .Limit )
return nil
}
func (g *UpdatesGetChannelDifferenceRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode updates.getChannelDifference#3173d78 to nil" )
}
if err := b .ConsumeID (UpdatesGetChannelDifferenceRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: %w" , err )
}
return g .DecodeBare (b )
}
func (g *UpdatesGetChannelDifferenceRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode updates.getChannelDifference#3173d78 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: field flags: %w" , err )
}
}
g .Force = g .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: field channel: %w" , err )
}
g .Channel = value
}
{
value , err := DecodeChannelMessagesFilter (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: field filter: %w" , err )
}
g .Filter = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: field pts: %w" , err )
}
g .Pts = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.getChannelDifference#3173d78: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *UpdatesGetChannelDifferenceRequest ) SetForce (value bool ) {
if value {
g .Flags .Set (0 )
g .Force = true
} else {
g .Flags .Unset (0 )
g .Force = false
}
}
func (g *UpdatesGetChannelDifferenceRequest ) GetForce () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *UpdatesGetChannelDifferenceRequest ) GetChannel () (value InputChannelClass ) {
if g == nil {
return
}
return g .Channel
}
func (g *UpdatesGetChannelDifferenceRequest ) GetFilter () (value ChannelMessagesFilterClass ) {
if g == nil {
return
}
return g .Filter
}
func (g *UpdatesGetChannelDifferenceRequest ) GetPts () (value int ) {
if g == nil {
return
}
return g .Pts
}
func (g *UpdatesGetChannelDifferenceRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *UpdatesGetChannelDifferenceRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Channel .AsNotEmpty ()
}
func (g *UpdatesGetChannelDifferenceRequest ) GetFilterAsNotEmpty () (*ChannelMessagesFilter , bool ) {
return g .Filter .AsNotEmpty ()
}
func (c *Client ) UpdatesGetChannelDifference (ctx context .Context , request *UpdatesGetChannelDifferenceRequest ) (UpdatesChannelDifferenceClass , error ) {
var result UpdatesChannelDifferenceBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .ChannelDifference , 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 .