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 MessagesEditChatAboutRequest struct {
Peer InputPeerClass
About string
}
const MessagesEditChatAboutRequestTypeID = 0xdef60797
var (
_ bin .Encoder = &MessagesEditChatAboutRequest {}
_ bin .Decoder = &MessagesEditChatAboutRequest {}
_ bin .BareEncoder = &MessagesEditChatAboutRequest {}
_ bin .BareDecoder = &MessagesEditChatAboutRequest {}
)
func (e *MessagesEditChatAboutRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Peer == nil ) {
return false
}
if !(e .About == "" ) {
return false
}
return true
}
func (e *MessagesEditChatAboutRequest ) String () string {
if e == nil {
return "MessagesEditChatAboutRequest(nil)"
}
type Alias MessagesEditChatAboutRequest
return fmt .Sprintf ("MessagesEditChatAboutRequest%+v" , Alias (*e ))
}
func (e *MessagesEditChatAboutRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetAbout () (value string )
}) {
e .Peer = from .GetPeer ()
e .About = from .GetAbout ()
}
func (*MessagesEditChatAboutRequest ) TypeID () uint32 {
return MessagesEditChatAboutRequestTypeID
}
func (*MessagesEditChatAboutRequest ) TypeName () string {
return "messages.editChatAbout"
}
func (e *MessagesEditChatAboutRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editChatAbout" ,
ID : MessagesEditChatAboutRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "About" ,
SchemaName : "about" ,
},
}
return typ
}
func (e *MessagesEditChatAboutRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatAbout#def60797 as nil" )
}
b .PutID (MessagesEditChatAboutRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditChatAboutRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatAbout#def60797 as nil" )
}
if e .Peer == nil {
return fmt .Errorf ("unable to encode messages.editChatAbout#def60797: field peer is nil" )
}
if err := e .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatAbout#def60797: field peer: %w" , err )
}
b .PutString (e .About )
return nil
}
func (e *MessagesEditChatAboutRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatAbout#def60797 to nil" )
}
if err := b .ConsumeID (MessagesEditChatAboutRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatAbout#def60797: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditChatAboutRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatAbout#def60797 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatAbout#def60797: field peer: %w" , err )
}
e .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatAbout#def60797: field about: %w" , err )
}
e .About = value
}
return nil
}
func (e *MessagesEditChatAboutRequest ) GetPeer () (value InputPeerClass ) {
if e == nil {
return
}
return e .Peer
}
func (e *MessagesEditChatAboutRequest ) GetAbout () (value string ) {
if e == nil {
return
}
return e .About
}
func (c *Client ) MessagesEditChatAbout (ctx context .Context , request *MessagesEditChatAboutRequest ) (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 .