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