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 StoriesGetPinnedStoriesRequest struct {
Peer InputPeerClass
OffsetID int
Limit int
}
const StoriesGetPinnedStoriesRequestTypeID = 0x5821a5dc
var (
_ bin .Encoder = &StoriesGetPinnedStoriesRequest {}
_ bin .Decoder = &StoriesGetPinnedStoriesRequest {}
_ bin .BareEncoder = &StoriesGetPinnedStoriesRequest {}
_ bin .BareDecoder = &StoriesGetPinnedStoriesRequest {}
)
func (g *StoriesGetPinnedStoriesRequest ) 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 *StoriesGetPinnedStoriesRequest ) String () string {
if g == nil {
return "StoriesGetPinnedStoriesRequest(nil)"
}
type Alias StoriesGetPinnedStoriesRequest
return fmt .Sprintf ("StoriesGetPinnedStoriesRequest%+v" , Alias (*g ))
}
func (g *StoriesGetPinnedStoriesRequest ) 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 (*StoriesGetPinnedStoriesRequest ) TypeID () uint32 {
return StoriesGetPinnedStoriesRequestTypeID
}
func (*StoriesGetPinnedStoriesRequest ) TypeName () string {
return "stories.getPinnedStories"
}
func (g *StoriesGetPinnedStoriesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.getPinnedStories" ,
ID : StoriesGetPinnedStoriesRequestTypeID ,
}
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 *StoriesGetPinnedStoriesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getPinnedStories#5821a5dc as nil" )
}
b .PutID (StoriesGetPinnedStoriesRequestTypeID )
return g .EncodeBare (b )
}
func (g *StoriesGetPinnedStoriesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getPinnedStories#5821a5dc as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode stories.getPinnedStories#5821a5dc: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.getPinnedStories#5821a5dc: field peer: %w" , err )
}
b .PutInt (g .OffsetID )
b .PutInt (g .Limit )
return nil
}
func (g *StoriesGetPinnedStoriesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getPinnedStories#5821a5dc to nil" )
}
if err := b .ConsumeID (StoriesGetPinnedStoriesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.getPinnedStories#5821a5dc: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StoriesGetPinnedStoriesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getPinnedStories#5821a5dc to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode stories.getPinnedStories#5821a5dc: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getPinnedStories#5821a5dc: field offset_id: %w" , err )
}
g .OffsetID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getPinnedStories#5821a5dc: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *StoriesGetPinnedStoriesRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *StoriesGetPinnedStoriesRequest ) GetOffsetID () (value int ) {
if g == nil {
return
}
return g .OffsetID
}
func (g *StoriesGetPinnedStoriesRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) StoriesGetPinnedStories (ctx context .Context , request *StoriesGetPinnedStoriesRequest ) (*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 .