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 BotsSetJoinChatResultsRequest struct {
QueryID int64
Result JoinChatBotResultClass
}
const BotsSetJoinChatResultsRequestTypeID = 0xe71a4810
var (
_ bin .Encoder = &BotsSetJoinChatResultsRequest {}
_ bin .Decoder = &BotsSetJoinChatResultsRequest {}
_ bin .BareEncoder = &BotsSetJoinChatResultsRequest {}
_ bin .BareDecoder = &BotsSetJoinChatResultsRequest {}
)
func (s *BotsSetJoinChatResultsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .QueryID == 0 ) {
return false
}
if !(s .Result == nil ) {
return false
}
return true
}
func (s *BotsSetJoinChatResultsRequest ) String () string {
if s == nil {
return "BotsSetJoinChatResultsRequest(nil)"
}
type Alias BotsSetJoinChatResultsRequest
return fmt .Sprintf ("BotsSetJoinChatResultsRequest%+v" , Alias (*s ))
}
func (s *BotsSetJoinChatResultsRequest ) FillFrom (from interface {
GetQueryID () (value int64 )
GetResult () (value JoinChatBotResultClass )
}) {
s .QueryID = from .GetQueryID ()
s .Result = from .GetResult ()
}
func (*BotsSetJoinChatResultsRequest ) TypeID () uint32 {
return BotsSetJoinChatResultsRequestTypeID
}
func (*BotsSetJoinChatResultsRequest ) TypeName () string {
return "bots.setJoinChatResults"
}
func (s *BotsSetJoinChatResultsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.setJoinChatResults" ,
ID : BotsSetJoinChatResultsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "QueryID" ,
SchemaName : "query_id" ,
},
{
Name : "Result" ,
SchemaName : "result" ,
},
}
return typ
}
func (s *BotsSetJoinChatResultsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setJoinChatResults#e71a4810 as nil" )
}
b .PutID (BotsSetJoinChatResultsRequestTypeID )
return s .EncodeBare (b )
}
func (s *BotsSetJoinChatResultsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setJoinChatResults#e71a4810 as nil" )
}
b .PutLong (s .QueryID )
if s .Result == nil {
return fmt .Errorf ("unable to encode bots.setJoinChatResults#e71a4810: field result is nil" )
}
if err := s .Result .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.setJoinChatResults#e71a4810: field result: %w" , err )
}
return nil
}
func (s *BotsSetJoinChatResultsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setJoinChatResults#e71a4810 to nil" )
}
if err := b .ConsumeID (BotsSetJoinChatResultsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.setJoinChatResults#e71a4810: %w" , err )
}
return s .DecodeBare (b )
}
func (s *BotsSetJoinChatResultsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setJoinChatResults#e71a4810 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode bots.setJoinChatResults#e71a4810: field query_id: %w" , err )
}
s .QueryID = value
}
{
value , err := DecodeJoinChatBotResult (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.setJoinChatResults#e71a4810: field result: %w" , err )
}
s .Result = value
}
return nil
}
func (s *BotsSetJoinChatResultsRequest ) GetQueryID () (value int64 ) {
if s == nil {
return
}
return s .QueryID
}
func (s *BotsSetJoinChatResultsRequest ) GetResult () (value JoinChatBotResultClass ) {
if s == nil {
return
}
return s .Result
}
func (c *Client ) BotsSetJoinChatResults (ctx context .Context , request *BotsSetJoinChatResultsRequest ) (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.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 .