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 StoriesGetStoriesArchiveRequest struct {
Peer InputPeerClass
OffsetID int
Limit int
}
const StoriesGetStoriesArchiveRequestTypeID = 0xb4352016
var (
_ bin .Encoder = &StoriesGetStoriesArchiveRequest {}
_ bin .Decoder = &StoriesGetStoriesArchiveRequest {}
_ bin .BareEncoder = &StoriesGetStoriesArchiveRequest {}
_ bin .BareDecoder = &StoriesGetStoriesArchiveRequest {}
)
func (g *StoriesGetStoriesArchiveRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .OffsetID == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *StoriesGetStoriesArchiveRequest ) String () string {
if g == nil {
return "StoriesGetStoriesArchiveRequest(nil)"
}
type Alias StoriesGetStoriesArchiveRequest
return fmt .Sprintf ("StoriesGetStoriesArchiveRequest%+v" , Alias (*g ))
}
func (g *StoriesGetStoriesArchiveRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetOffsetID () (value int )
GetLimit () (value int )
}) {
g .Peer = from .GetPeer ()
g .OffsetID = from .GetOffsetID ()
g .Limit = from .GetLimit ()
}
func (*StoriesGetStoriesArchiveRequest ) TypeID () uint32 {
return StoriesGetStoriesArchiveRequestTypeID
}
func (*StoriesGetStoriesArchiveRequest ) TypeName () string {
return "stories.getStoriesArchive"
}
func (g *StoriesGetStoriesArchiveRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.getStoriesArchive" ,
ID : StoriesGetStoriesArchiveRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "OffsetID" ,
SchemaName : "offset_id" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *StoriesGetStoriesArchiveRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getStoriesArchive#b4352016 as nil" )
}
b .PutID (StoriesGetStoriesArchiveRequestTypeID )
return g .EncodeBare (b )
}
func (g *StoriesGetStoriesArchiveRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getStoriesArchive#b4352016 as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode stories.getStoriesArchive#b4352016: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.getStoriesArchive#b4352016: field peer: %w" , err )
}
b .PutInt (g .OffsetID )
b .PutInt (g .Limit )
return nil
}
func (g *StoriesGetStoriesArchiveRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getStoriesArchive#b4352016 to nil" )
}
if err := b .ConsumeID (StoriesGetStoriesArchiveRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.getStoriesArchive#b4352016: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StoriesGetStoriesArchiveRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getStoriesArchive#b4352016 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode stories.getStoriesArchive#b4352016: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getStoriesArchive#b4352016: field offset_id: %w" , err )
}
g .OffsetID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getStoriesArchive#b4352016: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *StoriesGetStoriesArchiveRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *StoriesGetStoriesArchiveRequest ) GetOffsetID () (value int ) {
if g == nil {
return
}
return g .OffsetID
}
func (g *StoriesGetStoriesArchiveRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) StoriesGetStoriesArchive (ctx context .Context , request *StoriesGetStoriesArchiveRequest ) (*StoriesStories , error ) {
var result StoriesStories
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .