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