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 MessagesGetChatInviteImportersRequest struct {
Flags bin .Fields
Requested bool
Peer InputPeerClass
Link string
Q string
OffsetDate int
OffsetUser InputUserClass
Limit int
}
const MessagesGetChatInviteImportersRequestTypeID = 0xdf04dd4e
var (
_ bin .Encoder = &MessagesGetChatInviteImportersRequest {}
_ bin .Decoder = &MessagesGetChatInviteImportersRequest {}
_ bin .BareEncoder = &MessagesGetChatInviteImportersRequest {}
_ bin .BareDecoder = &MessagesGetChatInviteImportersRequest {}
)
func (g *MessagesGetChatInviteImportersRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Requested == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .Link == "" ) {
return false
}
if !(g .Q == "" ) {
return false
}
if !(g .OffsetDate == 0 ) {
return false
}
if !(g .OffsetUser == nil ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *MessagesGetChatInviteImportersRequest ) String () string {
if g == nil {
return "MessagesGetChatInviteImportersRequest(nil)"
}
type Alias MessagesGetChatInviteImportersRequest
return fmt .Sprintf ("MessagesGetChatInviteImportersRequest%+v" , Alias (*g ))
}
func (g *MessagesGetChatInviteImportersRequest ) FillFrom (from interface {
GetRequested () (value bool )
GetPeer () (value InputPeerClass )
GetLink () (value string , ok bool )
GetQ () (value string , ok bool )
GetOffsetDate () (value int )
GetOffsetUser () (value InputUserClass )
GetLimit () (value int )
}) {
g .Requested = from .GetRequested ()
g .Peer = from .GetPeer ()
if val , ok := from .GetLink (); ok {
g .Link = val
}
if val , ok := from .GetQ (); ok {
g .Q = val
}
g .OffsetDate = from .GetOffsetDate ()
g .OffsetUser = from .GetOffsetUser ()
g .Limit = from .GetLimit ()
}
func (*MessagesGetChatInviteImportersRequest ) TypeID () uint32 {
return MessagesGetChatInviteImportersRequestTypeID
}
func (*MessagesGetChatInviteImportersRequest ) TypeName () string {
return "messages.getChatInviteImporters"
}
func (g *MessagesGetChatInviteImportersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getChatInviteImporters" ,
ID : MessagesGetChatInviteImportersRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Requested" ,
SchemaName : "requested" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Link" ,
SchemaName : "link" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "Q" ,
SchemaName : "q" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "OffsetDate" ,
SchemaName : "offset_date" ,
},
{
Name : "OffsetUser" ,
SchemaName : "offset_user" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *MessagesGetChatInviteImportersRequest ) SetFlags () {
if !(g .Requested == false ) {
g .Flags .Set (0 )
}
if !(g .Link == "" ) {
g .Flags .Set (1 )
}
if !(g .Q == "" ) {
g .Flags .Set (2 )
}
}
func (g *MessagesGetChatInviteImportersRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getChatInviteImporters#df04dd4e as nil" )
}
b .PutID (MessagesGetChatInviteImportersRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetChatInviteImportersRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getChatInviteImporters#df04dd4e as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getChatInviteImporters#df04dd4e: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getChatInviteImporters#df04dd4e: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getChatInviteImporters#df04dd4e: field peer: %w" , err )
}
if g .Flags .Has (1 ) {
b .PutString (g .Link )
}
if g .Flags .Has (2 ) {
b .PutString (g .Q )
}
b .PutInt (g .OffsetDate )
if g .OffsetUser == nil {
return fmt .Errorf ("unable to encode messages.getChatInviteImporters#df04dd4e: field offset_user is nil" )
}
if err := g .OffsetUser .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getChatInviteImporters#df04dd4e: field offset_user: %w" , err )
}
b .PutInt (g .Limit )
return nil
}
func (g *MessagesGetChatInviteImportersRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getChatInviteImporters#df04dd4e to nil" )
}
if err := b .ConsumeID (MessagesGetChatInviteImportersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetChatInviteImportersRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getChatInviteImporters#df04dd4e to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field flags: %w" , err )
}
}
g .Requested = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field peer: %w" , err )
}
g .Peer = value
}
if g .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field link: %w" , err )
}
g .Link = value
}
if g .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field q: %w" , err )
}
g .Q = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field offset_date: %w" , err )
}
g .OffsetDate = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field offset_user: %w" , err )
}
g .OffsetUser = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getChatInviteImporters#df04dd4e: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *MessagesGetChatInviteImportersRequest ) SetRequested (value bool ) {
if value {
g .Flags .Set (0 )
g .Requested = true
} else {
g .Flags .Unset (0 )
g .Requested = false
}
}
func (g *MessagesGetChatInviteImportersRequest ) GetRequested () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *MessagesGetChatInviteImportersRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetChatInviteImportersRequest ) SetLink (value string ) {
g .Flags .Set (1 )
g .Link = value
}
func (g *MessagesGetChatInviteImportersRequest ) GetLink () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (1 ) {
return value , false
}
return g .Link , true
}
func (g *MessagesGetChatInviteImportersRequest ) SetQ (value string ) {
g .Flags .Set (2 )
g .Q = value
}
func (g *MessagesGetChatInviteImportersRequest ) GetQ () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (2 ) {
return value , false
}
return g .Q , true
}
func (g *MessagesGetChatInviteImportersRequest ) GetOffsetDate () (value int ) {
if g == nil {
return
}
return g .OffsetDate
}
func (g *MessagesGetChatInviteImportersRequest ) GetOffsetUser () (value InputUserClass ) {
if g == nil {
return
}
return g .OffsetUser
}
func (g *MessagesGetChatInviteImportersRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) MessagesGetChatInviteImporters (ctx context .Context , request *MessagesGetChatInviteImportersRequest ) (*MessagesChatInviteImporters , error ) {
var result MessagesChatInviteImporters
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 .