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