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 PaymentsEditConnectedStarRefBotRequest struct {
Flags bin .Fields
Revoked bool
Peer InputPeerClass
Link string
}
const PaymentsEditConnectedStarRefBotRequestTypeID = 0xe4fca4a3
var (
_ bin .Encoder = &PaymentsEditConnectedStarRefBotRequest {}
_ bin .Decoder = &PaymentsEditConnectedStarRefBotRequest {}
_ bin .BareEncoder = &PaymentsEditConnectedStarRefBotRequest {}
_ bin .BareDecoder = &PaymentsEditConnectedStarRefBotRequest {}
)
func (e *PaymentsEditConnectedStarRefBotRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .Revoked == false ) {
return false
}
if !(e .Peer == nil ) {
return false
}
if !(e .Link == "" ) {
return false
}
return true
}
func (e *PaymentsEditConnectedStarRefBotRequest ) String () string {
if e == nil {
return "PaymentsEditConnectedStarRefBotRequest(nil)"
}
type Alias PaymentsEditConnectedStarRefBotRequest
return fmt .Sprintf ("PaymentsEditConnectedStarRefBotRequest%+v" , Alias (*e ))
}
func (e *PaymentsEditConnectedStarRefBotRequest ) FillFrom (from interface {
GetRevoked () (value bool )
GetPeer () (value InputPeerClass )
GetLink () (value string )
}) {
e .Revoked = from .GetRevoked ()
e .Peer = from .GetPeer ()
e .Link = from .GetLink ()
}
func (*PaymentsEditConnectedStarRefBotRequest ) TypeID () uint32 {
return PaymentsEditConnectedStarRefBotRequestTypeID
}
func (*PaymentsEditConnectedStarRefBotRequest ) TypeName () string {
return "payments.editConnectedStarRefBot"
}
func (e *PaymentsEditConnectedStarRefBotRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.editConnectedStarRefBot" ,
ID : PaymentsEditConnectedStarRefBotRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Revoked" ,
SchemaName : "revoked" ,
Null : !e .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Link" ,
SchemaName : "link" ,
},
}
return typ
}
func (e *PaymentsEditConnectedStarRefBotRequest ) SetFlags () {
if !(e .Revoked == false ) {
e .Flags .Set (0 )
}
}
func (e *PaymentsEditConnectedStarRefBotRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode payments.editConnectedStarRefBot#e4fca4a3 as nil" )
}
b .PutID (PaymentsEditConnectedStarRefBotRequestTypeID )
return e .EncodeBare (b )
}
func (e *PaymentsEditConnectedStarRefBotRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode payments.editConnectedStarRefBot#e4fca4a3 as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.editConnectedStarRefBot#e4fca4a3: field flags: %w" , err )
}
if e .Peer == nil {
return fmt .Errorf ("unable to encode payments.editConnectedStarRefBot#e4fca4a3: field peer is nil" )
}
if err := e .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.editConnectedStarRefBot#e4fca4a3: field peer: %w" , err )
}
b .PutString (e .Link )
return nil
}
func (e *PaymentsEditConnectedStarRefBotRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode payments.editConnectedStarRefBot#e4fca4a3 to nil" )
}
if err := b .ConsumeID (PaymentsEditConnectedStarRefBotRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.editConnectedStarRefBot#e4fca4a3: %w" , err )
}
return e .DecodeBare (b )
}
func (e *PaymentsEditConnectedStarRefBotRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode payments.editConnectedStarRefBot#e4fca4a3 to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.editConnectedStarRefBot#e4fca4a3: field flags: %w" , err )
}
}
e .Revoked = e .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.editConnectedStarRefBot#e4fca4a3: field peer: %w" , err )
}
e .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.editConnectedStarRefBot#e4fca4a3: field link: %w" , err )
}
e .Link = value
}
return nil
}
func (e *PaymentsEditConnectedStarRefBotRequest ) SetRevoked (value bool ) {
if value {
e .Flags .Set (0 )
e .Revoked = true
} else {
e .Flags .Unset (0 )
e .Revoked = false
}
}
func (e *PaymentsEditConnectedStarRefBotRequest ) GetRevoked () (value bool ) {
if e == nil {
return
}
return e .Flags .Has (0 )
}
func (e *PaymentsEditConnectedStarRefBotRequest ) GetPeer () (value InputPeerClass ) {
if e == nil {
return
}
return e .Peer
}
func (e *PaymentsEditConnectedStarRefBotRequest ) GetLink () (value string ) {
if e == nil {
return
}
return e .Link
}
func (c *Client ) PaymentsEditConnectedStarRefBot (ctx context .Context , request *PaymentsEditConnectedStarRefBotRequest ) (*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 .