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 MessagesGetDiscussionMessageRequest struct {
Peer InputPeerClass
MsgID int
}
const MessagesGetDiscussionMessageRequestTypeID = 0x446972fd
var (
_ bin .Encoder = &MessagesGetDiscussionMessageRequest {}
_ bin .Decoder = &MessagesGetDiscussionMessageRequest {}
_ bin .BareEncoder = &MessagesGetDiscussionMessageRequest {}
_ bin .BareDecoder = &MessagesGetDiscussionMessageRequest {}
)
func (g *MessagesGetDiscussionMessageRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .MsgID == 0 ) {
return false
}
return true
}
func (g *MessagesGetDiscussionMessageRequest ) String () string {
if g == nil {
return "MessagesGetDiscussionMessageRequest(nil)"
}
type Alias MessagesGetDiscussionMessageRequest
return fmt .Sprintf ("MessagesGetDiscussionMessageRequest%+v" , Alias (*g ))
}
func (g *MessagesGetDiscussionMessageRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetMsgID () (value int )
}) {
g .Peer = from .GetPeer ()
g .MsgID = from .GetMsgID ()
}
func (*MessagesGetDiscussionMessageRequest ) TypeID () uint32 {
return MessagesGetDiscussionMessageRequestTypeID
}
func (*MessagesGetDiscussionMessageRequest ) TypeName () string {
return "messages.getDiscussionMessage"
}
func (g *MessagesGetDiscussionMessageRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getDiscussionMessage" ,
ID : MessagesGetDiscussionMessageRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
}
return typ
}
func (g *MessagesGetDiscussionMessageRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getDiscussionMessage#446972fd as nil" )
}
b .PutID (MessagesGetDiscussionMessageRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetDiscussionMessageRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getDiscussionMessage#446972fd as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getDiscussionMessage#446972fd: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getDiscussionMessage#446972fd: field peer: %w" , err )
}
b .PutInt (g .MsgID )
return nil
}
func (g *MessagesGetDiscussionMessageRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getDiscussionMessage#446972fd to nil" )
}
if err := b .ConsumeID (MessagesGetDiscussionMessageRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getDiscussionMessage#446972fd: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetDiscussionMessageRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getDiscussionMessage#446972fd to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getDiscussionMessage#446972fd: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getDiscussionMessage#446972fd: field msg_id: %w" , err )
}
g .MsgID = value
}
return nil
}
func (g *MessagesGetDiscussionMessageRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetDiscussionMessageRequest ) GetMsgID () (value int ) {
if g == nil {
return
}
return g .MsgID
}
func (c *Client ) MessagesGetDiscussionMessage (ctx context .Context , request *MessagesGetDiscussionMessageRequest ) (*MessagesDiscussionMessage , error ) {
var result MessagesDiscussionMessage
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 .