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 MessagesEditChatPhotoRequest struct {
ChatID int64
Photo InputChatPhotoClass
}
const MessagesEditChatPhotoRequestTypeID = 0x35ddd674
var (
_ bin .Encoder = &MessagesEditChatPhotoRequest {}
_ bin .Decoder = &MessagesEditChatPhotoRequest {}
_ bin .BareEncoder = &MessagesEditChatPhotoRequest {}
_ bin .BareDecoder = &MessagesEditChatPhotoRequest {}
)
func (e *MessagesEditChatPhotoRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .ChatID == 0 ) {
return false
}
if !(e .Photo == nil ) {
return false
}
return true
}
func (e *MessagesEditChatPhotoRequest ) String () string {
if e == nil {
return "MessagesEditChatPhotoRequest(nil)"
}
type Alias MessagesEditChatPhotoRequest
return fmt .Sprintf ("MessagesEditChatPhotoRequest%+v" , Alias (*e ))
}
func (e *MessagesEditChatPhotoRequest ) FillFrom (from interface {
GetChatID () (value int64 )
GetPhoto () (value InputChatPhotoClass )
}) {
e .ChatID = from .GetChatID ()
e .Photo = from .GetPhoto ()
}
func (*MessagesEditChatPhotoRequest ) TypeID () uint32 {
return MessagesEditChatPhotoRequestTypeID
}
func (*MessagesEditChatPhotoRequest ) TypeName () string {
return "messages.editChatPhoto"
}
func (e *MessagesEditChatPhotoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editChatPhoto" ,
ID : MessagesEditChatPhotoRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ChatID" ,
SchemaName : "chat_id" ,
},
{
Name : "Photo" ,
SchemaName : "photo" ,
},
}
return typ
}
func (e *MessagesEditChatPhotoRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatPhoto#35ddd674 as nil" )
}
b .PutID (MessagesEditChatPhotoRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditChatPhotoRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatPhoto#35ddd674 as nil" )
}
b .PutLong (e .ChatID )
if e .Photo == nil {
return fmt .Errorf ("unable to encode messages.editChatPhoto#35ddd674: field photo is nil" )
}
if err := e .Photo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatPhoto#35ddd674: field photo: %w" , err )
}
return nil
}
func (e *MessagesEditChatPhotoRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatPhoto#35ddd674 to nil" )
}
if err := b .ConsumeID (MessagesEditChatPhotoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatPhoto#35ddd674: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditChatPhotoRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatPhoto#35ddd674 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatPhoto#35ddd674: field chat_id: %w" , err )
}
e .ChatID = value
}
{
value , err := DecodeInputChatPhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatPhoto#35ddd674: field photo: %w" , err )
}
e .Photo = value
}
return nil
}
func (e *MessagesEditChatPhotoRequest ) GetChatID () (value int64 ) {
if e == nil {
return
}
return e .ChatID
}
func (e *MessagesEditChatPhotoRequest ) GetPhoto () (value InputChatPhotoClass ) {
if e == nil {
return
}
return e .Photo
}
func (c *Client ) MessagesEditChatPhoto (ctx context .Context , request *MessagesEditChatPhotoRequest ) (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 .