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 ChannelsUpdatePaidMessagesPriceRequest struct {
Flags bin .Fields
BroadcastMessagesAllowed bool
Channel InputChannelClass
SendPaidMessagesStars int64
}
const ChannelsUpdatePaidMessagesPriceRequestTypeID = 0x4b12327b
var (
_ bin .Encoder = &ChannelsUpdatePaidMessagesPriceRequest {}
_ bin .Decoder = &ChannelsUpdatePaidMessagesPriceRequest {}
_ bin .BareEncoder = &ChannelsUpdatePaidMessagesPriceRequest {}
_ bin .BareDecoder = &ChannelsUpdatePaidMessagesPriceRequest {}
)
func (u *ChannelsUpdatePaidMessagesPriceRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .BroadcastMessagesAllowed == false ) {
return false
}
if !(u .Channel == nil ) {
return false
}
if !(u .SendPaidMessagesStars == 0 ) {
return false
}
return true
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) String () string {
if u == nil {
return "ChannelsUpdatePaidMessagesPriceRequest(nil)"
}
type Alias ChannelsUpdatePaidMessagesPriceRequest
return fmt .Sprintf ("ChannelsUpdatePaidMessagesPriceRequest%+v" , Alias (*u ))
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) FillFrom (from interface {
GetBroadcastMessagesAllowed () (value bool )
GetChannel () (value InputChannelClass )
GetSendPaidMessagesStars () (value int64 )
}) {
u .BroadcastMessagesAllowed = from .GetBroadcastMessagesAllowed ()
u .Channel = from .GetChannel ()
u .SendPaidMessagesStars = from .GetSendPaidMessagesStars ()
}
func (*ChannelsUpdatePaidMessagesPriceRequest ) TypeID () uint32 {
return ChannelsUpdatePaidMessagesPriceRequestTypeID
}
func (*ChannelsUpdatePaidMessagesPriceRequest ) TypeName () string {
return "channels.updatePaidMessagesPrice"
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.updatePaidMessagesPrice" ,
ID : ChannelsUpdatePaidMessagesPriceRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BroadcastMessagesAllowed" ,
SchemaName : "broadcast_messages_allowed" ,
Null : !u .Flags .Has (0 ),
},
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "SendPaidMessagesStars" ,
SchemaName : "send_paid_messages_stars" ,
},
}
return typ
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) SetFlags () {
if !(u .BroadcastMessagesAllowed == false ) {
u .Flags .Set (0 )
}
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode channels.updatePaidMessagesPrice#4b12327b as nil" )
}
b .PutID (ChannelsUpdatePaidMessagesPriceRequestTypeID )
return u .EncodeBare (b )
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode channels.updatePaidMessagesPrice#4b12327b as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.updatePaidMessagesPrice#4b12327b: field flags: %w" , err )
}
if u .Channel == nil {
return fmt .Errorf ("unable to encode channels.updatePaidMessagesPrice#4b12327b: field channel is nil" )
}
if err := u .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.updatePaidMessagesPrice#4b12327b: field channel: %w" , err )
}
b .PutLong (u .SendPaidMessagesStars )
return nil
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode channels.updatePaidMessagesPrice#4b12327b to nil" )
}
if err := b .ConsumeID (ChannelsUpdatePaidMessagesPriceRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.updatePaidMessagesPrice#4b12327b: %w" , err )
}
return u .DecodeBare (b )
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode channels.updatePaidMessagesPrice#4b12327b to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode channels.updatePaidMessagesPrice#4b12327b: field flags: %w" , err )
}
}
u .BroadcastMessagesAllowed = u .Flags .Has (0 )
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.updatePaidMessagesPrice#4b12327b: field channel: %w" , err )
}
u .Channel = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode channels.updatePaidMessagesPrice#4b12327b: field send_paid_messages_stars: %w" , err )
}
u .SendPaidMessagesStars = value
}
return nil
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) SetBroadcastMessagesAllowed (value bool ) {
if value {
u .Flags .Set (0 )
u .BroadcastMessagesAllowed = true
} else {
u .Flags .Unset (0 )
u .BroadcastMessagesAllowed = false
}
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) GetBroadcastMessagesAllowed () (value bool ) {
if u == nil {
return
}
return u .Flags .Has (0 )
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) GetChannel () (value InputChannelClass ) {
if u == nil {
return
}
return u .Channel
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) GetSendPaidMessagesStars () (value int64 ) {
if u == nil {
return
}
return u .SendPaidMessagesStars
}
func (u *ChannelsUpdatePaidMessagesPriceRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return u .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsUpdatePaidMessagesPrice (ctx context .Context , request *ChannelsUpdatePaidMessagesPriceRequest ) (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.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 .