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 ChannelsExportMessageLinkRequest struct {
Flags bin .Fields
Grouped bool
Thread bool
Channel InputChannelClass
ID int
}
const ChannelsExportMessageLinkRequestTypeID = 0xe63fadeb
var (
_ bin .Encoder = &ChannelsExportMessageLinkRequest {}
_ bin .Decoder = &ChannelsExportMessageLinkRequest {}
_ bin .BareEncoder = &ChannelsExportMessageLinkRequest {}
_ bin .BareDecoder = &ChannelsExportMessageLinkRequest {}
)
func (e *ChannelsExportMessageLinkRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .Grouped == false ) {
return false
}
if !(e .Thread == false ) {
return false
}
if !(e .Channel == nil ) {
return false
}
if !(e .ID == 0 ) {
return false
}
return true
}
func (e *ChannelsExportMessageLinkRequest ) String () string {
if e == nil {
return "ChannelsExportMessageLinkRequest(nil)"
}
type Alias ChannelsExportMessageLinkRequest
return fmt .Sprintf ("ChannelsExportMessageLinkRequest%+v" , Alias (*e ))
}
func (e *ChannelsExportMessageLinkRequest ) FillFrom (from interface {
GetGrouped () (value bool )
GetThread () (value bool )
GetChannel () (value InputChannelClass )
GetID () (value int )
}) {
e .Grouped = from .GetGrouped ()
e .Thread = from .GetThread ()
e .Channel = from .GetChannel ()
e .ID = from .GetID ()
}
func (*ChannelsExportMessageLinkRequest ) TypeID () uint32 {
return ChannelsExportMessageLinkRequestTypeID
}
func (*ChannelsExportMessageLinkRequest ) TypeName () string {
return "channels.exportMessageLink"
}
func (e *ChannelsExportMessageLinkRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.exportMessageLink" ,
ID : ChannelsExportMessageLinkRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Grouped" ,
SchemaName : "grouped" ,
Null : !e .Flags .Has (0 ),
},
{
Name : "Thread" ,
SchemaName : "thread" ,
Null : !e .Flags .Has (1 ),
},
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (e *ChannelsExportMessageLinkRequest ) SetFlags () {
if !(e .Grouped == false ) {
e .Flags .Set (0 )
}
if !(e .Thread == false ) {
e .Flags .Set (1 )
}
}
func (e *ChannelsExportMessageLinkRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.exportMessageLink#e63fadeb as nil" )
}
b .PutID (ChannelsExportMessageLinkRequestTypeID )
return e .EncodeBare (b )
}
func (e *ChannelsExportMessageLinkRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode channels.exportMessageLink#e63fadeb as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.exportMessageLink#e63fadeb: field flags: %w" , err )
}
if e .Channel == nil {
return fmt .Errorf ("unable to encode channels.exportMessageLink#e63fadeb: field channel is nil" )
}
if err := e .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.exportMessageLink#e63fadeb: field channel: %w" , err )
}
b .PutInt (e .ID )
return nil
}
func (e *ChannelsExportMessageLinkRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.exportMessageLink#e63fadeb to nil" )
}
if err := b .ConsumeID (ChannelsExportMessageLinkRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.exportMessageLink#e63fadeb: %w" , err )
}
return e .DecodeBare (b )
}
func (e *ChannelsExportMessageLinkRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode channels.exportMessageLink#e63fadeb to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.exportMessageLink#e63fadeb: field flags: %w" , err )
}
}
e .Grouped = e .Flags .Has (0 )
e .Thread = e .Flags .Has (1 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.exportMessageLink#e63fadeb: field channel: %w" , err )
}
e .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.exportMessageLink#e63fadeb: field id: %w" , err )
}
e .ID = value
}
return nil
}
func (e *ChannelsExportMessageLinkRequest ) SetGrouped (value bool ) {
if value {
e .Flags .Set (0 )
e .Grouped = true
} else {
e .Flags .Unset (0 )
e .Grouped = false
}
}
func (e *ChannelsExportMessageLinkRequest ) GetGrouped () (value bool ) {
if e == nil {
return
}
return e .Flags .Has (0 )
}
func (e *ChannelsExportMessageLinkRequest ) SetThread (value bool ) {
if value {
e .Flags .Set (1 )
e .Thread = true
} else {
e .Flags .Unset (1 )
e .Thread = false
}
}
func (e *ChannelsExportMessageLinkRequest ) GetThread () (value bool ) {
if e == nil {
return
}
return e .Flags .Has (1 )
}
func (e *ChannelsExportMessageLinkRequest ) GetChannel () (value InputChannelClass ) {
if e == nil {
return
}
return e .Channel
}
func (e *ChannelsExportMessageLinkRequest ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
func (e *ChannelsExportMessageLinkRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return e .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsExportMessageLink (ctx context .Context , request *ChannelsExportMessageLinkRequest ) (*ExportedMessageLink , error ) {
var result ExportedMessageLink
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .