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 StoriesGetAllStoriesRequest struct {
Flags bin .Fields
Next bool
Hidden bool
State string
}
const StoriesGetAllStoriesRequestTypeID = 0xeeb0d625
var (
_ bin .Encoder = &StoriesGetAllStoriesRequest {}
_ bin .Decoder = &StoriesGetAllStoriesRequest {}
_ bin .BareEncoder = &StoriesGetAllStoriesRequest {}
_ bin .BareDecoder = &StoriesGetAllStoriesRequest {}
)
func (g *StoriesGetAllStoriesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Next == false ) {
return false
}
if !(g .Hidden == false ) {
return false
}
if !(g .State == "" ) {
return false
}
return true
}
func (g *StoriesGetAllStoriesRequest ) String () string {
if g == nil {
return "StoriesGetAllStoriesRequest(nil)"
}
type Alias StoriesGetAllStoriesRequest
return fmt .Sprintf ("StoriesGetAllStoriesRequest%+v" , Alias (*g ))
}
func (g *StoriesGetAllStoriesRequest ) FillFrom (from interface {
GetNext () (value bool )
GetHidden () (value bool )
GetState () (value string , ok bool )
}) {
g .Next = from .GetNext ()
g .Hidden = from .GetHidden ()
if val , ok := from .GetState (); ok {
g .State = val
}
}
func (*StoriesGetAllStoriesRequest ) TypeID () uint32 {
return StoriesGetAllStoriesRequestTypeID
}
func (*StoriesGetAllStoriesRequest ) TypeName () string {
return "stories.getAllStories"
}
func (g *StoriesGetAllStoriesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.getAllStories" ,
ID : StoriesGetAllStoriesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Next" ,
SchemaName : "next" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "Hidden" ,
SchemaName : "hidden" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "State" ,
SchemaName : "state" ,
Null : !g .Flags .Has (0 ),
},
}
return typ
}
func (g *StoriesGetAllStoriesRequest ) SetFlags () {
if !(g .Next == false ) {
g .Flags .Set (1 )
}
if !(g .Hidden == false ) {
g .Flags .Set (2 )
}
if !(g .State == "" ) {
g .Flags .Set (0 )
}
}
func (g *StoriesGetAllStoriesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getAllStories#eeb0d625 as nil" )
}
b .PutID (StoriesGetAllStoriesRequestTypeID )
return g .EncodeBare (b )
}
func (g *StoriesGetAllStoriesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode stories.getAllStories#eeb0d625 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.getAllStories#eeb0d625: field flags: %w" , err )
}
if g .Flags .Has (0 ) {
b .PutString (g .State )
}
return nil
}
func (g *StoriesGetAllStoriesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getAllStories#eeb0d625 to nil" )
}
if err := b .ConsumeID (StoriesGetAllStoriesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.getAllStories#eeb0d625: %w" , err )
}
return g .DecodeBare (b )
}
func (g *StoriesGetAllStoriesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode stories.getAllStories#eeb0d625 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stories.getAllStories#eeb0d625: field flags: %w" , err )
}
}
g .Next = g .Flags .Has (1 )
g .Hidden = g .Flags .Has (2 )
if g .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode stories.getAllStories#eeb0d625: field state: %w" , err )
}
g .State = value
}
return nil
}
func (g *StoriesGetAllStoriesRequest ) SetNext (value bool ) {
if value {
g .Flags .Set (1 )
g .Next = true
} else {
g .Flags .Unset (1 )
g .Next = false
}
}
func (g *StoriesGetAllStoriesRequest ) GetNext () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *StoriesGetAllStoriesRequest ) SetHidden (value bool ) {
if value {
g .Flags .Set (2 )
g .Hidden = true
} else {
g .Flags .Unset (2 )
g .Hidden = false
}
}
func (g *StoriesGetAllStoriesRequest ) GetHidden () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (2 )
}
func (g *StoriesGetAllStoriesRequest ) SetState (value string ) {
g .Flags .Set (0 )
g .State = value
}
func (g *StoriesGetAllStoriesRequest ) GetState () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .State , true
}
func (c *Client ) StoriesGetAllStories (ctx context .Context , request *StoriesGetAllStoriesRequest ) (StoriesAllStoriesClass , error ) {
var result StoriesAllStoriesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .AllStories , 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 .