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 StoriesToggleAllStoriesHiddenRequest struct {
Hidden bool
}
const StoriesToggleAllStoriesHiddenRequestTypeID = 0x7c2557c4
var (
_ bin .Encoder = &StoriesToggleAllStoriesHiddenRequest {}
_ bin .Decoder = &StoriesToggleAllStoriesHiddenRequest {}
_ bin .BareEncoder = &StoriesToggleAllStoriesHiddenRequest {}
_ bin .BareDecoder = &StoriesToggleAllStoriesHiddenRequest {}
)
func (t *StoriesToggleAllStoriesHiddenRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Hidden == false ) {
return false
}
return true
}
func (t *StoriesToggleAllStoriesHiddenRequest ) String () string {
if t == nil {
return "StoriesToggleAllStoriesHiddenRequest(nil)"
}
type Alias StoriesToggleAllStoriesHiddenRequest
return fmt .Sprintf ("StoriesToggleAllStoriesHiddenRequest%+v" , Alias (*t ))
}
func (t *StoriesToggleAllStoriesHiddenRequest ) FillFrom (from interface {
GetHidden () (value bool )
}) {
t .Hidden = from .GetHidden ()
}
func (*StoriesToggleAllStoriesHiddenRequest ) TypeID () uint32 {
return StoriesToggleAllStoriesHiddenRequestTypeID
}
func (*StoriesToggleAllStoriesHiddenRequest ) TypeName () string {
return "stories.toggleAllStoriesHidden"
}
func (t *StoriesToggleAllStoriesHiddenRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.toggleAllStoriesHidden" ,
ID : StoriesToggleAllStoriesHiddenRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hidden" ,
SchemaName : "hidden" ,
},
}
return typ
}
func (t *StoriesToggleAllStoriesHiddenRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode stories.toggleAllStoriesHidden#7c2557c4 as nil" )
}
b .PutID (StoriesToggleAllStoriesHiddenRequestTypeID )
return t .EncodeBare (b )
}
func (t *StoriesToggleAllStoriesHiddenRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode stories.toggleAllStoriesHidden#7c2557c4 as nil" )
}
b .PutBool (t .Hidden )
return nil
}
func (t *StoriesToggleAllStoriesHiddenRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode stories.toggleAllStoriesHidden#7c2557c4 to nil" )
}
if err := b .ConsumeID (StoriesToggleAllStoriesHiddenRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.toggleAllStoriesHidden#7c2557c4: %w" , err )
}
return t .DecodeBare (b )
}
func (t *StoriesToggleAllStoriesHiddenRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode stories.toggleAllStoriesHidden#7c2557c4 to nil" )
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode stories.toggleAllStoriesHidden#7c2557c4: field hidden: %w" , err )
}
t .Hidden = value
}
return nil
}
func (t *StoriesToggleAllStoriesHiddenRequest ) GetHidden () (value bool ) {
if t == nil {
return
}
return t .Hidden
}
func (c *Client ) StoriesToggleAllStoriesHidden (ctx context .Context , hidden bool ) (bool , error ) {
var result BoolBox
request := &StoriesToggleAllStoriesHiddenRequest {
Hidden : hidden ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .