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 PaymentsClearSavedInfoRequest struct {
Flags bin .Fields
Credentials bool
Info bool
}
const PaymentsClearSavedInfoRequestTypeID = 0xd83d70c1
var (
_ bin .Encoder = &PaymentsClearSavedInfoRequest {}
_ bin .Decoder = &PaymentsClearSavedInfoRequest {}
_ bin .BareEncoder = &PaymentsClearSavedInfoRequest {}
_ bin .BareDecoder = &PaymentsClearSavedInfoRequest {}
)
func (c *PaymentsClearSavedInfoRequest ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .Credentials == false ) {
return false
}
if !(c .Info == false ) {
return false
}
return true
}
func (c *PaymentsClearSavedInfoRequest ) String () string {
if c == nil {
return "PaymentsClearSavedInfoRequest(nil)"
}
type Alias PaymentsClearSavedInfoRequest
return fmt .Sprintf ("PaymentsClearSavedInfoRequest%+v" , Alias (*c ))
}
func (c *PaymentsClearSavedInfoRequest ) FillFrom (from interface {
GetCredentials () (value bool )
GetInfo () (value bool )
}) {
c .Credentials = from .GetCredentials ()
c .Info = from .GetInfo ()
}
func (*PaymentsClearSavedInfoRequest ) TypeID () uint32 {
return PaymentsClearSavedInfoRequestTypeID
}
func (*PaymentsClearSavedInfoRequest ) TypeName () string {
return "payments.clearSavedInfo"
}
func (c *PaymentsClearSavedInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.clearSavedInfo" ,
ID : PaymentsClearSavedInfoRequestTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Credentials" ,
SchemaName : "credentials" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "Info" ,
SchemaName : "info" ,
Null : !c .Flags .Has (1 ),
},
}
return typ
}
func (c *PaymentsClearSavedInfoRequest ) SetFlags () {
if !(c .Credentials == false ) {
c .Flags .Set (0 )
}
if !(c .Info == false ) {
c .Flags .Set (1 )
}
}
func (c *PaymentsClearSavedInfoRequest ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode payments.clearSavedInfo#d83d70c1 as nil" )
}
b .PutID (PaymentsClearSavedInfoRequestTypeID )
return c .EncodeBare (b )
}
func (c *PaymentsClearSavedInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode payments.clearSavedInfo#d83d70c1 as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.clearSavedInfo#d83d70c1: field flags: %w" , err )
}
return nil
}
func (c *PaymentsClearSavedInfoRequest ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode payments.clearSavedInfo#d83d70c1 to nil" )
}
if err := b .ConsumeID (PaymentsClearSavedInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.clearSavedInfo#d83d70c1: %w" , err )
}
return c .DecodeBare (b )
}
func (c *PaymentsClearSavedInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode payments.clearSavedInfo#d83d70c1 to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.clearSavedInfo#d83d70c1: field flags: %w" , err )
}
}
c .Credentials = c .Flags .Has (0 )
c .Info = c .Flags .Has (1 )
return nil
}
func (c *PaymentsClearSavedInfoRequest ) SetCredentials (value bool ) {
if value {
c .Flags .Set (0 )
c .Credentials = true
} else {
c .Flags .Unset (0 )
c .Credentials = false
}
}
func (c *PaymentsClearSavedInfoRequest ) GetCredentials () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (0 )
}
func (c *PaymentsClearSavedInfoRequest ) SetInfo (value bool ) {
if value {
c .Flags .Set (1 )
c .Info = true
} else {
c .Flags .Unset (1 )
c .Info = false
}
}
func (c *PaymentsClearSavedInfoRequest ) GetInfo () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (1 )
}
func (c *Client ) PaymentsClearSavedInfo (ctx context .Context , request *PaymentsClearSavedInfoRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .