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 ChannelsEditCreatorRequest struct {
Channel InputChannelClass
UserID InputUserClass
Password InputCheckPasswordSRPClass
}
const ChannelsEditCreatorRequestTypeID = 0x8f38cd1f
var (
_ bin .Encoder = &ChannelsEditCreatorRequest {}
_ bin .Decoder = &ChannelsEditCreatorRequest {}
_ bin .BareEncoder = &ChannelsEditCreatorRequest {}
_ bin .BareDecoder = &ChannelsEditCreatorRequest {}
)
func (e *ChannelsEditCreatorRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Channel == nil ) {
return false
}
if !(e .UserID == nil ) {
return false
}
if !(e .Password == nil ) {
return false
}
return true
}
func (e *ChannelsEditCreatorRequest ) String () string {
if e == nil {
return "ChannelsEditCreatorRequest(nil)"
}
type Alias ChannelsEditCreatorRequest
return fmt .Sprintf ("ChannelsEditCreatorRequest%+v" , Alias (*e ))
}
func (e *ChannelsEditCreatorRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetUserID () (value InputUserClass )
GetPassword () (value InputCheckPasswordSRPClass )
}) {
e .Channel = from .GetChannel ()
e .UserID = from .GetUserID ()
e .Password = from .GetPassword ()
}
func (*ChannelsEditCreatorRequest ) TypeID () uint32 {
return ChannelsEditCreatorRequestTypeID
}
func (*ChannelsEditCreatorRequest ) TypeName () string {
return "channels.editCreator"
}
func (e *ChannelsEditCreatorRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.editCreator" ,
ID : ChannelsEditCreatorRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Password" ,
SchemaName : "password" ,
},
}
return typ
}
func (e *ChannelsEditCreatorRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editCreator#8f38cd1f as nil" )
}
b .PutID (ChannelsEditCreatorRequestTypeID )
return e .EncodeBare (b )
}
func (e *ChannelsEditCreatorRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.editCreator#8f38cd1f as nil" )
}
if e .Channel == nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field channel is nil" )
}
if err := e .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field channel: %w" , err )
}
if e .UserID == nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field user_id is nil" )
}
if err := e .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field user_id: %w" , err )
}
if e .Password == nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field password is nil" )
}
if err := e .Password .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.editCreator#8f38cd1f: field password: %w" , err )
}
return nil
}
func (e *ChannelsEditCreatorRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editCreator#8f38cd1f to nil" )
}
if err := b .ConsumeID (ChannelsEditCreatorRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.editCreator#8f38cd1f: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ChannelsEditCreatorRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.editCreator#8f38cd1f to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editCreator#8f38cd1f: field channel: %w" , err )
}
e .Channel = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editCreator#8f38cd1f: field user_id: %w" , err )
}
e .UserID = value
}
{
value , err := DecodeInputCheckPasswordSRP (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.editCreator#8f38cd1f: field password: %w" , err )
}
e .Password = value
}
return nil
}
func (e *ChannelsEditCreatorRequest ) GetChannel () (value InputChannelClass ) {
if e == nil {
return
}
return e .Channel
}
func (e *ChannelsEditCreatorRequest ) GetUserID () (value InputUserClass ) {
if e == nil {
return
}
return e .UserID
}
func (e *ChannelsEditCreatorRequest ) GetPassword () (value InputCheckPasswordSRPClass ) {
if e == nil {
return
}
return e .Password
}
func (e *ChannelsEditCreatorRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return e .Channel .AsNotEmpty ()
}
func (e *ChannelsEditCreatorRequest ) GetPasswordAsNotEmpty () (*InputCheckPasswordSRP , bool ) {
return e .Password .AsNotEmpty ()
}
func (c *Client ) ChannelsEditCreator (ctx context .Context , request *ChannelsEditCreatorRequest ) (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 .