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 MessagesGetExportedChatInvitesRequest struct {
Flags bin .Fields
Revoked bool
Peer InputPeerClass
AdminID InputUserClass
OffsetDate int
OffsetLink string
Limit int
}
const MessagesGetExportedChatInvitesRequestTypeID = 0xa2b5a3f6
var (
_ bin .Encoder = &MessagesGetExportedChatInvitesRequest {}
_ bin .Decoder = &MessagesGetExportedChatInvitesRequest {}
_ bin .BareEncoder = &MessagesGetExportedChatInvitesRequest {}
_ bin .BareDecoder = &MessagesGetExportedChatInvitesRequest {}
)
func (g *MessagesGetExportedChatInvitesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Revoked == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .AdminID == nil ) {
return false
}
if !(g .OffsetDate == 0 ) {
return false
}
if !(g .OffsetLink == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *MessagesGetExportedChatInvitesRequest ) String () string {
if g == nil {
return "MessagesGetExportedChatInvitesRequest(nil)"
}
type Alias MessagesGetExportedChatInvitesRequest
return fmt .Sprintf ("MessagesGetExportedChatInvitesRequest%+v" , Alias (*g ))
}
func (g *MessagesGetExportedChatInvitesRequest ) FillFrom (from interface {
GetRevoked () (value bool )
GetPeer () (value InputPeerClass )
GetAdminID () (value InputUserClass )
GetOffsetDate () (value int , ok bool )
GetOffsetLink () (value string , ok bool )
GetLimit () (value int )
}) {
g .Revoked = from .GetRevoked ()
g .Peer = from .GetPeer ()
g .AdminID = from .GetAdminID ()
if val , ok := from .GetOffsetDate (); ok {
g .OffsetDate = val
}
if val , ok := from .GetOffsetLink (); ok {
g .OffsetLink = val
}
g .Limit = from .GetLimit ()
}
func (*MessagesGetExportedChatInvitesRequest ) TypeID () uint32 {
return MessagesGetExportedChatInvitesRequestTypeID
}
func (*MessagesGetExportedChatInvitesRequest ) TypeName () string {
return "messages.getExportedChatInvites"
}
func (g *MessagesGetExportedChatInvitesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getExportedChatInvites" ,
ID : MessagesGetExportedChatInvitesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Revoked" ,
SchemaName : "revoked" ,
Null : !g .Flags .Has (3 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "OffsetDate" ,
SchemaName : "offset_date" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "OffsetLink" ,
SchemaName : "offset_link" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *MessagesGetExportedChatInvitesRequest ) SetFlags () {
if !(g .Revoked == false ) {
g .Flags .Set (3 )
}
if !(g .OffsetDate == 0 ) {
g .Flags .Set (2 )
}
if !(g .OffsetLink == "" ) {
g .Flags .Set (2 )
}
}
func (g *MessagesGetExportedChatInvitesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getExportedChatInvites#a2b5a3f6 as nil" )
}
b .PutID (MessagesGetExportedChatInvitesRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetExportedChatInvitesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getExportedChatInvites#a2b5a3f6 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getExportedChatInvites#a2b5a3f6: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getExportedChatInvites#a2b5a3f6: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getExportedChatInvites#a2b5a3f6: field peer: %w" , err )
}
if g .AdminID == nil {
return fmt .Errorf ("unable to encode messages.getExportedChatInvites#a2b5a3f6: field admin_id is nil" )
}
if err := g .AdminID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getExportedChatInvites#a2b5a3f6: field admin_id: %w" , err )
}
if g .Flags .Has (2 ) {
b .PutInt (g .OffsetDate )
}
if g .Flags .Has (2 ) {
b .PutString (g .OffsetLink )
}
b .PutInt (g .Limit )
return nil
}
func (g *MessagesGetExportedChatInvitesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getExportedChatInvites#a2b5a3f6 to nil" )
}
if err := b .ConsumeID (MessagesGetExportedChatInvitesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetExportedChatInvitesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getExportedChatInvites#a2b5a3f6 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field flags: %w" , err )
}
}
g .Revoked = g .Flags .Has (3 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field admin_id: %w" , err )
}
g .AdminID = value
}
if g .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field offset_date: %w" , err )
}
g .OffsetDate = value
}
if g .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field offset_link: %w" , err )
}
g .OffsetLink = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getExportedChatInvites#a2b5a3f6: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *MessagesGetExportedChatInvitesRequest ) SetRevoked (value bool ) {
if value {
g .Flags .Set (3 )
g .Revoked = true
} else {
g .Flags .Unset (3 )
g .Revoked = false
}
}
func (g *MessagesGetExportedChatInvitesRequest ) GetRevoked () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (3 )
}
func (g *MessagesGetExportedChatInvitesRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetExportedChatInvitesRequest ) GetAdminID () (value InputUserClass ) {
if g == nil {
return
}
return g .AdminID
}
func (g *MessagesGetExportedChatInvitesRequest ) SetOffsetDate (value int ) {
g .Flags .Set (2 )
g .OffsetDate = value
}
func (g *MessagesGetExportedChatInvitesRequest ) GetOffsetDate () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (2 ) {
return value , false
}
return g .OffsetDate , true
}
func (g *MessagesGetExportedChatInvitesRequest ) SetOffsetLink (value string ) {
g .Flags .Set (2 )
g .OffsetLink = value
}
func (g *MessagesGetExportedChatInvitesRequest ) GetOffsetLink () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (2 ) {
return value , false
}
return g .OffsetLink , true
}
func (g *MessagesGetExportedChatInvitesRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) MessagesGetExportedChatInvites (ctx context .Context , request *MessagesGetExportedChatInvitesRequest ) (*MessagesExportedChatInvites , error ) {
var result MessagesExportedChatInvites
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 .