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