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 PaymentsGetConnectedStarRefBotsRequest struct {
Flags bin .Fields
Peer InputPeerClass
OffsetDate int
OffsetLink string
Limit int
}
const PaymentsGetConnectedStarRefBotsRequestTypeID = 0x5869a553
var (
_ bin .Encoder = &PaymentsGetConnectedStarRefBotsRequest {}
_ bin .Decoder = &PaymentsGetConnectedStarRefBotsRequest {}
_ bin .BareEncoder = &PaymentsGetConnectedStarRefBotsRequest {}
_ bin .BareDecoder = &PaymentsGetConnectedStarRefBotsRequest {}
)
func (g *PaymentsGetConnectedStarRefBotsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .OffsetDate == 0 ) {
return false
}
if !(g .OffsetLink == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) String () string {
if g == nil {
return "PaymentsGetConnectedStarRefBotsRequest(nil)"
}
type Alias PaymentsGetConnectedStarRefBotsRequest
return fmt .Sprintf ("PaymentsGetConnectedStarRefBotsRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetOffsetDate () (value int , ok bool )
GetOffsetLink () (value string , ok bool )
GetLimit () (value int )
}) {
g .Peer = from .GetPeer ()
if val , ok := from .GetOffsetDate (); ok {
g .OffsetDate = val
}
if val , ok := from .GetOffsetLink (); ok {
g .OffsetLink = val
}
g .Limit = from .GetLimit ()
}
func (*PaymentsGetConnectedStarRefBotsRequest ) TypeID () uint32 {
return PaymentsGetConnectedStarRefBotsRequestTypeID
}
func (*PaymentsGetConnectedStarRefBotsRequest ) TypeName () string {
return "payments.getConnectedStarRefBots"
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getConnectedStarRefBots" ,
ID : PaymentsGetConnectedStarRefBotsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
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 *PaymentsGetConnectedStarRefBotsRequest ) SetFlags () {
if !(g .OffsetDate == 0 ) {
g .Flags .Set (2 )
}
if !(g .OffsetLink == "" ) {
g .Flags .Set (2 )
}
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getConnectedStarRefBots#5869a553 as nil" )
}
b .PutID (PaymentsGetConnectedStarRefBotsRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getConnectedStarRefBots#5869a553 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getConnectedStarRefBots#5869a553: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getConnectedStarRefBots#5869a553: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getConnectedStarRefBots#5869a553: field peer: %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 *PaymentsGetConnectedStarRefBotsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getConnectedStarRefBots#5869a553 to nil" )
}
if err := b .ConsumeID (PaymentsGetConnectedStarRefBotsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getConnectedStarRefBots#5869a553: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getConnectedStarRefBots#5869a553 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getConnectedStarRefBots#5869a553: field flags: %w" , err )
}
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getConnectedStarRefBots#5869a553: field peer: %w" , err )
}
g .Peer = value
}
if g .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getConnectedStarRefBots#5869a553: 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 payments.getConnectedStarRefBots#5869a553: field offset_link: %w" , err )
}
g .OffsetLink = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getConnectedStarRefBots#5869a553: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) SetOffsetDate (value int ) {
g .Flags .Set (2 )
g .OffsetDate = value
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) GetOffsetDate () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (2 ) {
return value , false
}
return g .OffsetDate , true
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) SetOffsetLink (value string ) {
g .Flags .Set (2 )
g .OffsetLink = value
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) GetOffsetLink () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (2 ) {
return value , false
}
return g .OffsetLink , true
}
func (g *PaymentsGetConnectedStarRefBotsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) PaymentsGetConnectedStarRefBots (ctx context .Context , request *PaymentsGetConnectedStarRefBotsRequest ) (*PaymentsConnectedStarRefBots , error ) {
var result PaymentsConnectedStarRefBots
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .