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 ChannelsGetChannelRecommendationsRequest struct {
Flags bin .Fields
Channel InputChannelClass
}
const ChannelsGetChannelRecommendationsRequestTypeID = 0x25a71742
var (
_ bin .Encoder = &ChannelsGetChannelRecommendationsRequest {}
_ bin .Decoder = &ChannelsGetChannelRecommendationsRequest {}
_ bin .BareEncoder = &ChannelsGetChannelRecommendationsRequest {}
_ bin .BareDecoder = &ChannelsGetChannelRecommendationsRequest {}
)
func (g *ChannelsGetChannelRecommendationsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Channel == nil ) {
return false
}
return true
}
func (g *ChannelsGetChannelRecommendationsRequest ) String () string {
if g == nil {
return "ChannelsGetChannelRecommendationsRequest(nil)"
}
type Alias ChannelsGetChannelRecommendationsRequest
return fmt .Sprintf ("ChannelsGetChannelRecommendationsRequest%+v" , Alias (*g ))
}
func (g *ChannelsGetChannelRecommendationsRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass , ok bool )
}) {
if val , ok := from .GetChannel (); ok {
g .Channel = val
}
}
func (*ChannelsGetChannelRecommendationsRequest ) TypeID () uint32 {
return ChannelsGetChannelRecommendationsRequestTypeID
}
func (*ChannelsGetChannelRecommendationsRequest ) TypeName () string {
return "channels.getChannelRecommendations"
}
func (g *ChannelsGetChannelRecommendationsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.getChannelRecommendations" ,
ID : ChannelsGetChannelRecommendationsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
Null : !g .Flags .Has (0 ),
},
}
return typ
}
func (g *ChannelsGetChannelRecommendationsRequest ) SetFlags () {
if !(g .Channel == nil ) {
g .Flags .Set (0 )
}
}
func (g *ChannelsGetChannelRecommendationsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getChannelRecommendations#25a71742 as nil" )
}
b .PutID (ChannelsGetChannelRecommendationsRequestTypeID )
return g .EncodeBare (b )
}
func (g *ChannelsGetChannelRecommendationsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode channels.getChannelRecommendations#25a71742 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getChannelRecommendations#25a71742: field flags: %w" , err )
}
if g .Flags .Has (0 ) {
if g .Channel == nil {
return fmt .Errorf ("unable to encode channels.getChannelRecommendations#25a71742: field channel is nil" )
}
if err := g .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.getChannelRecommendations#25a71742: field channel: %w" , err )
}
}
return nil
}
func (g *ChannelsGetChannelRecommendationsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getChannelRecommendations#25a71742 to nil" )
}
if err := b .ConsumeID (ChannelsGetChannelRecommendationsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.getChannelRecommendations#25a71742: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ChannelsGetChannelRecommendationsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode channels.getChannelRecommendations#25a71742 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.getChannelRecommendations#25a71742: field flags: %w" , err )
}
}
if g .Flags .Has (0 ) {
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.getChannelRecommendations#25a71742: field channel: %w" , err )
}
g .Channel = value
}
return nil
}
func (g *ChannelsGetChannelRecommendationsRequest ) SetChannel (value InputChannelClass ) {
g .Flags .Set (0 )
g .Channel = value
}
func (g *ChannelsGetChannelRecommendationsRequest ) GetChannel () (value InputChannelClass , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .Channel , true
}
func (g *ChannelsGetChannelRecommendationsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
if value , ok := g .GetChannel (); ok {
return value .AsNotEmpty ()
}
return nil , false
}
func (c *Client ) ChannelsGetChannelRecommendations (ctx context .Context , request *ChannelsGetChannelRecommendationsRequest ) (MessagesChatsClass , error ) {
var result MessagesChatsBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Chats , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .