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 MessagesToggleNoForwardsRequest struct {
Peer InputPeerClass
Enabled bool
}
const MessagesToggleNoForwardsRequestTypeID = 0xb11eafa2
var (
_ bin .Encoder = &MessagesToggleNoForwardsRequest {}
_ bin .Decoder = &MessagesToggleNoForwardsRequest {}
_ bin .BareEncoder = &MessagesToggleNoForwardsRequest {}
_ bin .BareDecoder = &MessagesToggleNoForwardsRequest {}
)
func (t *MessagesToggleNoForwardsRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Peer == nil ) {
return false
}
if !(t .Enabled == false ) {
return false
}
return true
}
func (t *MessagesToggleNoForwardsRequest ) String () string {
if t == nil {
return "MessagesToggleNoForwardsRequest(nil)"
}
type Alias MessagesToggleNoForwardsRequest
return fmt .Sprintf ("MessagesToggleNoForwardsRequest%+v" , Alias (*t ))
}
func (t *MessagesToggleNoForwardsRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetEnabled () (value bool )
}) {
t .Peer = from .GetPeer ()
t .Enabled = from .GetEnabled ()
}
func (*MessagesToggleNoForwardsRequest ) TypeID () uint32 {
return MessagesToggleNoForwardsRequestTypeID
}
func (*MessagesToggleNoForwardsRequest ) TypeName () string {
return "messages.toggleNoForwards"
}
func (t *MessagesToggleNoForwardsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.toggleNoForwards" ,
ID : MessagesToggleNoForwardsRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Enabled" ,
SchemaName : "enabled" ,
},
}
return typ
}
func (t *MessagesToggleNoForwardsRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.toggleNoForwards#b11eafa2 as nil" )
}
b .PutID (MessagesToggleNoForwardsRequestTypeID )
return t .EncodeBare (b )
}
func (t *MessagesToggleNoForwardsRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode messages.toggleNoForwards#b11eafa2 as nil" )
}
if t .Peer == nil {
return fmt .Errorf ("unable to encode messages.toggleNoForwards#b11eafa2: field peer is nil" )
}
if err := t .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.toggleNoForwards#b11eafa2: field peer: %w" , err )
}
b .PutBool (t .Enabled )
return nil
}
func (t *MessagesToggleNoForwardsRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.toggleNoForwards#b11eafa2 to nil" )
}
if err := b .ConsumeID (MessagesToggleNoForwardsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.toggleNoForwards#b11eafa2: %w" , err )
}
return t .DecodeBare (b )
}
func (t *MessagesToggleNoForwardsRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode messages.toggleNoForwards#b11eafa2 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.toggleNoForwards#b11eafa2: field peer: %w" , err )
}
t .Peer = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode messages.toggleNoForwards#b11eafa2: field enabled: %w" , err )
}
t .Enabled = value
}
return nil
}
func (t *MessagesToggleNoForwardsRequest ) GetPeer () (value InputPeerClass ) {
if t == nil {
return
}
return t .Peer
}
func (t *MessagesToggleNoForwardsRequest ) GetEnabled () (value bool ) {
if t == nil {
return
}
return t .Enabled
}
func (c *Client ) MessagesToggleNoForwards (ctx context .Context , request *MessagesToggleNoForwardsRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .