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 MessagesEditChatParticipantRankRequest struct {
Peer InputPeerClass
Participant InputPeerClass
Rank string
}
const MessagesEditChatParticipantRankRequestTypeID = 0xa00f32b0
var (
_ bin .Encoder = &MessagesEditChatParticipantRankRequest {}
_ bin .Decoder = &MessagesEditChatParticipantRankRequest {}
_ bin .BareEncoder = &MessagesEditChatParticipantRankRequest {}
_ bin .BareDecoder = &MessagesEditChatParticipantRankRequest {}
)
func (e *MessagesEditChatParticipantRankRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Peer == nil ) {
return false
}
if !(e .Participant == nil ) {
return false
}
if !(e .Rank == "" ) {
return false
}
return true
}
func (e *MessagesEditChatParticipantRankRequest ) String () string {
if e == nil {
return "MessagesEditChatParticipantRankRequest(nil)"
}
type Alias MessagesEditChatParticipantRankRequest
return fmt .Sprintf ("MessagesEditChatParticipantRankRequest%+v" , Alias (*e ))
}
func (e *MessagesEditChatParticipantRankRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetParticipant () (value InputPeerClass )
GetRank () (value string )
}) {
e .Peer = from .GetPeer ()
e .Participant = from .GetParticipant ()
e .Rank = from .GetRank ()
}
func (*MessagesEditChatParticipantRankRequest ) TypeID () uint32 {
return MessagesEditChatParticipantRankRequestTypeID
}
func (*MessagesEditChatParticipantRankRequest ) TypeName () string {
return "messages.editChatParticipantRank"
}
func (e *MessagesEditChatParticipantRankRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.editChatParticipantRank" ,
ID : MessagesEditChatParticipantRankRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Participant" ,
SchemaName : "participant" ,
},
{
Name : "Rank" ,
SchemaName : "rank" ,
},
}
return typ
}
func (e *MessagesEditChatParticipantRankRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatParticipantRank#a00f32b0 as nil" )
}
b .PutID (MessagesEditChatParticipantRankRequestTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEditChatParticipantRankRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.editChatParticipantRank#a00f32b0 as nil" )
}
if e .Peer == nil {
return fmt .Errorf ("unable to encode messages.editChatParticipantRank#a00f32b0: field peer is nil" )
}
if err := e .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatParticipantRank#a00f32b0: field peer: %w" , err )
}
if e .Participant == nil {
return fmt .Errorf ("unable to encode messages.editChatParticipantRank#a00f32b0: field participant is nil" )
}
if err := e .Participant .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.editChatParticipantRank#a00f32b0: field participant: %w" , err )
}
b .PutString (e .Rank )
return nil
}
func (e *MessagesEditChatParticipantRankRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatParticipantRank#a00f32b0 to nil" )
}
if err := b .ConsumeID (MessagesEditChatParticipantRankRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.editChatParticipantRank#a00f32b0: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEditChatParticipantRankRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.editChatParticipantRank#a00f32b0 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatParticipantRank#a00f32b0: field peer: %w" , err )
}
e .Peer = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatParticipantRank#a00f32b0: field participant: %w" , err )
}
e .Participant = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.editChatParticipantRank#a00f32b0: field rank: %w" , err )
}
e .Rank = value
}
return nil
}
func (e *MessagesEditChatParticipantRankRequest ) GetPeer () (value InputPeerClass ) {
if e == nil {
return
}
return e .Peer
}
func (e *MessagesEditChatParticipantRankRequest ) GetParticipant () (value InputPeerClass ) {
if e == nil {
return
}
return e .Participant
}
func (e *MessagesEditChatParticipantRankRequest ) GetRank () (value string ) {
if e == nil {
return
}
return e .Rank
}
func (c *Client ) MessagesEditChatParticipantRank (ctx context .Context , request *MessagesEditChatParticipantRankRequest ) (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 .