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 MessagesEditChatTitleRequest struct {
ChatID int64
Title string
}
const MessagesEditChatTitleRequestTypeID = 0x73783ffd
var (
_ bin .Encoder = &MessagesEditChatTitleRequest {}
_ bin .Decoder = &MessagesEditChatTitleRequest {}
_ bin .BareEncoder = &MessagesEditChatTitleRequest {}
_ bin .BareDecoder = &MessagesEditChatTitleRequest {}
)
func (e *MessagesEditChatTitleRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .ChatID == 0 ) {
return false
}
if !(e .Title == "" ) {
return false
}
return true
}
func (e *MessagesEditChatTitleRequest ) String () string {
if e == nil {
return "MessagesEditChatTitleRequest(nil)"
}
type Alias MessagesEditChatTitleRequest
return fmt .Sprintf ("MessagesEditChatTitleRequest%+v" , Alias (*e ))
}
func (e *MessagesEditChatTitleRequest ) FillFrom (from interface {
GetChatID () (value int64 )
GetTitle () (value string )
}) {
e .ChatID = from .GetChatID ()
e .Title = from .GetTitle ()
}
func (*MessagesEditChatTitleRequest ) TypeID () uint32 {
return MessagesEditChatTitleRequestTypeID
}
func (*MessagesEditChatTitleRequest ) TypeName () string {
return "messages.editChatTitle"
}
func (e *MessagesEditChatTitleRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editChatTitle" ,
ID : MessagesEditChatTitleRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
}
return typ
}
func (e *MessagesEditChatTitleRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatTitle#73783ffd as nil" )
}
b .PutID (MessagesEditChatTitleRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditChatTitleRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatTitle#73783ffd as nil" )
}
b .PutLong (e .ChatID )
b .PutString (e .Title )
return nil
}
func (e *MessagesEditChatTitleRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatTitle#73783ffd to nil" )
}
if err := b .ConsumeID (MessagesEditChatTitleRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatTitle#73783ffd: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditChatTitleRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatTitle#73783ffd to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatTitle#73783ffd: field chat_id: %w" , err )
}
e .ChatID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatTitle#73783ffd: field title: %w" , err )
}
e .Title = value
}
return nil
}
func (e *MessagesEditChatTitleRequest ) GetChatID () (value int64 ) {
if e == nil {
return
}
return e .ChatID
}
func (e *MessagesEditChatTitleRequest ) GetTitle () (value string ) {
if e == nil {
return
}
return e .Title
}
func (c *Client ) MessagesEditChatTitle (ctx context .Context , request *MessagesEditChatTitleRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .