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 WebViewMessageSent struct {
Flags bin .Fields
MsgID InputBotInlineMessageIDClass
}
const WebViewMessageSentTypeID = 0xc94511c
var (
_ bin .Encoder = &WebViewMessageSent {}
_ bin .Decoder = &WebViewMessageSent {}
_ bin .BareEncoder = &WebViewMessageSent {}
_ bin .BareDecoder = &WebViewMessageSent {}
)
func (w *WebViewMessageSent ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .MsgID == nil ) {
return false
}
return true
}
func (w *WebViewMessageSent ) String () string {
if w == nil {
return "WebViewMessageSent(nil)"
}
type Alias WebViewMessageSent
return fmt .Sprintf ("WebViewMessageSent%+v" , Alias (*w ))
}
func (w *WebViewMessageSent ) FillFrom (from interface {
GetMsgID () (value InputBotInlineMessageIDClass , ok bool )
}) {
if val , ok := from .GetMsgID (); ok {
w .MsgID = val
}
}
func (*WebViewMessageSent ) TypeID () uint32 {
return WebViewMessageSentTypeID
}
func (*WebViewMessageSent ) TypeName () string {
return "webViewMessageSent"
}
func (w *WebViewMessageSent ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webViewMessageSent" ,
ID : WebViewMessageSentTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
Null : !w .Flags .Has (0 ),
},
}
return typ
}
func (w *WebViewMessageSent ) SetFlags () {
if !(w .MsgID == nil ) {
w .Flags .Set (0 )
}
}
func (w *WebViewMessageSent ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webViewMessageSent#c94511c as nil" )
}
b .PutID (WebViewMessageSentTypeID )
return w .EncodeBare (b )
}
func (w *WebViewMessageSent ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webViewMessageSent#c94511c as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webViewMessageSent#c94511c: field flags: %w" , err )
}
if w .Flags .Has (0 ) {
if w .MsgID == nil {
return fmt .Errorf ("unable to encode webViewMessageSent#c94511c: field msg_id is nil" )
}
if err := w .MsgID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webViewMessageSent#c94511c: field msg_id: %w" , err )
}
}
return nil
}
func (w *WebViewMessageSent ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webViewMessageSent#c94511c to nil" )
}
if err := b .ConsumeID (WebViewMessageSentTypeID ); err != nil {
return fmt .Errorf ("unable to decode webViewMessageSent#c94511c: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebViewMessageSent ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webViewMessageSent#c94511c to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webViewMessageSent#c94511c: field flags: %w" , err )
}
}
if w .Flags .Has (0 ) {
value , err := DecodeInputBotInlineMessageID (b )
if err != nil {
return fmt .Errorf ("unable to decode webViewMessageSent#c94511c: field msg_id: %w" , err )
}
w .MsgID = value
}
return nil
}
func (w *WebViewMessageSent ) SetMsgID (value InputBotInlineMessageIDClass ) {
w .Flags .Set (0 )
w .MsgID = value
}
func (w *WebViewMessageSent ) GetMsgID () (value InputBotInlineMessageIDClass , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (0 ) {
return value , false
}
return w .MsgID , true
}
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 .