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 ChannelsSetBoostsToUnblockRestrictionsRequest struct {
Channel InputChannelClass
Boosts int
}
const ChannelsSetBoostsToUnblockRestrictionsRequestTypeID = 0xad399cee
var (
_ bin .Encoder = &ChannelsSetBoostsToUnblockRestrictionsRequest {}
_ bin .Decoder = &ChannelsSetBoostsToUnblockRestrictionsRequest {}
_ bin .BareEncoder = &ChannelsSetBoostsToUnblockRestrictionsRequest {}
_ bin .BareDecoder = &ChannelsSetBoostsToUnblockRestrictionsRequest {}
)
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Channel == nil ) {
return false
}
if !(s .Boosts == 0 ) {
return false
}
return true
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) String () string {
if s == nil {
return "ChannelsSetBoostsToUnblockRestrictionsRequest(nil)"
}
type Alias ChannelsSetBoostsToUnblockRestrictionsRequest
return fmt .Sprintf ("ChannelsSetBoostsToUnblockRestrictionsRequest%+v" , Alias (*s ))
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetBoosts () (value int )
}) {
s .Channel = from .GetChannel ()
s .Boosts = from .GetBoosts ()
}
func (*ChannelsSetBoostsToUnblockRestrictionsRequest ) TypeID () uint32 {
return ChannelsSetBoostsToUnblockRestrictionsRequestTypeID
}
func (*ChannelsSetBoostsToUnblockRestrictionsRequest ) TypeName () string {
return "channels.setBoostsToUnblockRestrictions"
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.setBoostsToUnblockRestrictions" ,
ID : ChannelsSetBoostsToUnblockRestrictionsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Boosts" ,
SchemaName : "boosts" ,
},
}
return typ
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil" )
}
b .PutID (ChannelsSetBoostsToUnblockRestrictionsRequestTypeID )
return s .EncodeBare (b )
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil" )
}
if s .Channel == nil {
return fmt .Errorf ("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel is nil" )
}
if err := s .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w" , err )
}
b .PutInt (s .Boosts )
return nil
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil" )
}
if err := b .ConsumeID (ChannelsSetBoostsToUnblockRestrictionsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w" , err )
}
s .Channel = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field boosts: %w" , err )
}
s .Boosts = value
}
return nil
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) GetChannel () (value InputChannelClass ) {
if s == nil {
return
}
return s .Channel
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) GetBoosts () (value int ) {
if s == nil {
return
}
return s .Boosts
}
func (s *ChannelsSetBoostsToUnblockRestrictionsRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return s .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsSetBoostsToUnblockRestrictions (ctx context .Context , request *ChannelsSetBoostsToUnblockRestrictionsRequest ) (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 .