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 CommunitiesGetPeerLinkRequestsRequest struct {
Community InputChannelClass
Offset string
Limit int
}
const CommunitiesGetPeerLinkRequestsRequestTypeID = 0x93773344
var (
_ bin .Encoder = &CommunitiesGetPeerLinkRequestsRequest {}
_ bin .Decoder = &CommunitiesGetPeerLinkRequestsRequest {}
_ bin .BareEncoder = &CommunitiesGetPeerLinkRequestsRequest {}
_ bin .BareDecoder = &CommunitiesGetPeerLinkRequestsRequest {}
)
func (g *CommunitiesGetPeerLinkRequestsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Community == nil ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) String () string {
if g == nil {
return "CommunitiesGetPeerLinkRequestsRequest(nil)"
}
type Alias CommunitiesGetPeerLinkRequestsRequest
return fmt .Sprintf ("CommunitiesGetPeerLinkRequestsRequest%+v" , Alias (*g ))
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) FillFrom (from interface {
GetCommunity () (value InputChannelClass )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .Community = from .GetCommunity ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*CommunitiesGetPeerLinkRequestsRequest ) TypeID () uint32 {
return CommunitiesGetPeerLinkRequestsRequestTypeID
}
func (*CommunitiesGetPeerLinkRequestsRequest ) TypeName () string {
return "communities.getPeerLinkRequests"
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "communities.getPeerLinkRequests" ,
ID : CommunitiesGetPeerLinkRequestsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Community" ,
SchemaName : "community" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode communities.getPeerLinkRequests#93773344 as nil" )
}
b .PutID (CommunitiesGetPeerLinkRequestsRequestTypeID )
return g .EncodeBare (b )
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode communities.getPeerLinkRequests#93773344 as nil" )
}
if g .Community == nil {
return fmt .Errorf ("unable to encode communities.getPeerLinkRequests#93773344: field community is nil" )
}
if err := g .Community .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode communities.getPeerLinkRequests#93773344: field community: %w" , err )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode communities.getPeerLinkRequests#93773344 to nil" )
}
if err := b .ConsumeID (CommunitiesGetPeerLinkRequestsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode communities.getPeerLinkRequests#93773344: %w" , err )
}
return g .DecodeBare (b )
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode communities.getPeerLinkRequests#93773344 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode communities.getPeerLinkRequests#93773344: field community: %w" , err )
}
g .Community = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode communities.getPeerLinkRequests#93773344: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode communities.getPeerLinkRequests#93773344: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) GetCommunity () (value InputChannelClass ) {
if g == nil {
return
}
return g .Community
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (g *CommunitiesGetPeerLinkRequestsRequest ) GetCommunityAsNotEmpty () (NotEmptyInputChannel , bool ) {
return g .Community .AsNotEmpty ()
}
func (c *Client ) CommunitiesGetPeerLinkRequests (ctx context .Context , request *CommunitiesGetPeerLinkRequestsRequest ) (*CommunitiesPeerLinkRequests , error ) {
var result CommunitiesPeerLinkRequests
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .