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 ChannelsEditTitleRequest struct {
Channel InputChannelClass
Title string
}
const ChannelsEditTitleRequestTypeID = 0x566decd0
var (
_ bin .Encoder = &ChannelsEditTitleRequest {}
_ bin .Decoder = &ChannelsEditTitleRequest {}
_ bin .BareEncoder = &ChannelsEditTitleRequest {}
_ bin .BareDecoder = &ChannelsEditTitleRequest {}
)
func (e *ChannelsEditTitleRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Channel == nil ) {
return false
}
if !(e .Title == "" ) {
return false
}
return true
}
func (e *ChannelsEditTitleRequest ) String () string {
if e == nil {
return "ChannelsEditTitleRequest(nil)"
}
type Alias ChannelsEditTitleRequest
return fmt .Sprintf ("ChannelsEditTitleRequest%+v" , Alias (*e ))
}
func (e *ChannelsEditTitleRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetTitle () (value string )
}) {
e .Channel = from .GetChannel ()
e .Title = from .GetTitle ()
}
func (*ChannelsEditTitleRequest ) TypeID () uint32 {
return ChannelsEditTitleRequestTypeID
}
func (*ChannelsEditTitleRequest ) TypeName () string {
return "channels.editTitle"
}
func (e *ChannelsEditTitleRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.editTitle" ,
ID : ChannelsEditTitleRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
}
return typ
}
func (e *ChannelsEditTitleRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editTitle#566decd0 as nil" )
}
b .PutID (ChannelsEditTitleRequestTypeID )
return e .EncodeBare (b )
}
func (e *ChannelsEditTitleRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editTitle#566decd0 as nil" )
}
if e .Channel == nil {
return fmt .Errorf ("unable to encode channels.editTitle#566decd0: field channel is nil" )
}
if err := e .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editTitle#566decd0: field channel: %w" , err )
}
b .PutString (e .Title )
return nil
}
func (e *ChannelsEditTitleRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editTitle#566decd0 to nil" )
}
if err := b .ConsumeID (ChannelsEditTitleRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.editTitle#566decd0: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ChannelsEditTitleRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editTitle#566decd0 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editTitle#566decd0: field channel: %w" , err )
}
e .Channel = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode channels.editTitle#566decd0: field title: %w" , err )
}
e .Title = value
}
return nil
}
func (e *ChannelsEditTitleRequest ) GetChannel () (value InputChannelClass ) {
if e == nil {
return
}
return e .Channel
}
func (e *ChannelsEditTitleRequest ) GetTitle () (value string ) {
if e == nil {
return
}
return e .Title
}
func (e *ChannelsEditTitleRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return e .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsEditTitle (ctx context .Context , request *ChannelsEditTitleRequest ) (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 .