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