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 StoriesGetPeerMaxIDsRequest struct {
ID []InputPeerClass
}
const StoriesGetPeerMaxIDsRequestTypeID = 0x535983c3
var (
_ bin .Encoder = &StoriesGetPeerMaxIDsRequest {}
_ bin .Decoder = &StoriesGetPeerMaxIDsRequest {}
_ bin .BareEncoder = &StoriesGetPeerMaxIDsRequest {}
_ bin .BareDecoder = &StoriesGetPeerMaxIDsRequest {}
)
func (g *StoriesGetPeerMaxIDsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .ID == nil ) {
return false
}
return true
}
func (g *StoriesGetPeerMaxIDsRequest ) String () string {
if g == nil {
return "StoriesGetPeerMaxIDsRequest(nil)"
}
type Alias StoriesGetPeerMaxIDsRequest
return fmt .Sprintf ("StoriesGetPeerMaxIDsRequest%+v" , Alias (*g ))
}
func (g *StoriesGetPeerMaxIDsRequest ) FillFrom (from interface {
GetID () (value []InputPeerClass )
}) {
g .ID = from .GetID ()
}
func (*StoriesGetPeerMaxIDsRequest ) TypeID () uint32 {
return StoriesGetPeerMaxIDsRequestTypeID
}
func (*StoriesGetPeerMaxIDsRequest ) TypeName () string {
return "stories.getPeerMaxIDs"
}
func (g *StoriesGetPeerMaxIDsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.getPeerMaxIDs" ,
ID : StoriesGetPeerMaxIDsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (g *StoriesGetPeerMaxIDsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getPeerMaxIDs#535983c3 as nil" )
}
b .PutID (StoriesGetPeerMaxIDsRequestTypeID )
return g .EncodeBare (b )
}
func (g *StoriesGetPeerMaxIDsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getPeerMaxIDs#535983c3 as nil" )
}
b .PutVectorHeader (len (g .ID ))
for idx , v := range g .ID {
if v == nil {
return fmt .Errorf ("unable to encode stories.getPeerMaxIDs#535983c3: field id element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.getPeerMaxIDs#535983c3: field id element with index %d: %w" , idx , err )
}
}
return nil
}
func (g *StoriesGetPeerMaxIDsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getPeerMaxIDs#535983c3 to nil" )
}
if err := b .ConsumeID (StoriesGetPeerMaxIDsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.getPeerMaxIDs#535983c3: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StoriesGetPeerMaxIDsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getPeerMaxIDs#535983c3 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getPeerMaxIDs#535983c3: field id: %w" , err )
}
if headerLen > 0 {
g .ID = make ([]InputPeerClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode stories.getPeerMaxIDs#535983c3: field id: %w" , err )
}
g .ID = append (g .ID , value )
}
}
return nil
}
func (g *StoriesGetPeerMaxIDsRequest ) GetID () (value []InputPeerClass ) {
if g == nil {
return
}
return g .ID
}
func (g *StoriesGetPeerMaxIDsRequest ) MapID () (value InputPeerClassArray ) {
return InputPeerClassArray (g .ID )
}
func (c *Client ) StoriesGetPeerMaxIDs (ctx context .Context , id []InputPeerClass ) ([]int , error ) {
var result IntVector
request := &StoriesGetPeerMaxIDsRequest {
ID : id ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []int (result .Elems ), 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 .