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 MessagesSetBotPrecheckoutResultsRequest struct {
Flags bin .Fields
Success bool
QueryID int64
Error string
}
const MessagesSetBotPrecheckoutResultsRequestTypeID = 0x9c2dd95
var (
_ bin .Encoder = &MessagesSetBotPrecheckoutResultsRequest {}
_ bin .Decoder = &MessagesSetBotPrecheckoutResultsRequest {}
_ bin .BareEncoder = &MessagesSetBotPrecheckoutResultsRequest {}
_ bin .BareDecoder = &MessagesSetBotPrecheckoutResultsRequest {}
)
func (s *MessagesSetBotPrecheckoutResultsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Success == false ) {
return false
}
if !(s .QueryID == 0 ) {
return false
}
if !(s .Error == "" ) {
return false
}
return true
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) String () string {
if s == nil {
return "MessagesSetBotPrecheckoutResultsRequest(nil)"
}
type Alias MessagesSetBotPrecheckoutResultsRequest
return fmt .Sprintf ("MessagesSetBotPrecheckoutResultsRequest%+v" , Alias (*s ))
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) FillFrom (from interface {
GetSuccess () (value bool )
GetQueryID () (value int64 )
GetError () (value string , ok bool )
}) {
s .Success = from .GetSuccess ()
s .QueryID = from .GetQueryID ()
if val , ok := from .GetError (); ok {
s .Error = val
}
}
func (*MessagesSetBotPrecheckoutResultsRequest ) TypeID () uint32 {
return MessagesSetBotPrecheckoutResultsRequestTypeID
}
func (*MessagesSetBotPrecheckoutResultsRequest ) TypeName () string {
return "messages.setBotPrecheckoutResults"
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.setBotPrecheckoutResults" ,
ID : MessagesSetBotPrecheckoutResultsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Success" ,
SchemaName : "success" ,
Null : !s .Flags .Has (1 ),
},
{
Name : "QueryID" ,
SchemaName : "query_id" ,
},
{
Name : "Error" ,
SchemaName : "error" ,
Null : !s .Flags .Has (0 ),
},
}
return typ
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) SetFlags () {
if !(s .Success == false ) {
s .Flags .Set (1 )
}
if !(s .Error == "" ) {
s .Flags .Set (0 )
}
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setBotPrecheckoutResults#9c2dd95 as nil" )
}
b .PutID (MessagesSetBotPrecheckoutResultsRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.setBotPrecheckoutResults#9c2dd95 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.setBotPrecheckoutResults#9c2dd95: field flags: %w" , err )
}
b .PutLong (s .QueryID )
if s .Flags .Has (0 ) {
b .PutString (s .Error )
}
return nil
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setBotPrecheckoutResults#9c2dd95 to nil" )
}
if err := b .ConsumeID (MessagesSetBotPrecheckoutResultsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.setBotPrecheckoutResults#9c2dd95: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.setBotPrecheckoutResults#9c2dd95 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.setBotPrecheckoutResults#9c2dd95: field flags: %w" , err )
}
}
s .Success = s .Flags .Has (1 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.setBotPrecheckoutResults#9c2dd95: field query_id: %w" , err )
}
s .QueryID = value
}
if s .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.setBotPrecheckoutResults#9c2dd95: field error: %w" , err )
}
s .Error = value
}
return nil
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) SetSuccess (value bool ) {
if value {
s .Flags .Set (1 )
s .Success = true
} else {
s .Flags .Unset (1 )
s .Success = false
}
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) GetSuccess () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (1 )
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) GetQueryID () (value int64 ) {
if s == nil {
return
}
return s .QueryID
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) SetError (value string ) {
s .Flags .Set (0 )
s .Error = value
}
func (s *MessagesSetBotPrecheckoutResultsRequest ) GetError () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .Error , true
}
func (c *Client ) MessagesSetBotPrecheckoutResults (ctx context .Context , request *MessagesSetBotPrecheckoutResultsRequest ) (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 .