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 StoriesActivateStealthModeRequest struct {
Flags bin .Fields
Past bool
Future bool
}
const StoriesActivateStealthModeRequestTypeID = 0x57bbd166
var (
_ bin .Encoder = &StoriesActivateStealthModeRequest {}
_ bin .Decoder = &StoriesActivateStealthModeRequest {}
_ bin .BareEncoder = &StoriesActivateStealthModeRequest {}
_ bin .BareDecoder = &StoriesActivateStealthModeRequest {}
)
func (a *StoriesActivateStealthModeRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Flags .Zero ()) {
return false
}
if !(a .Past == false ) {
return false
}
if !(a .Future == false ) {
return false
}
return true
}
func (a *StoriesActivateStealthModeRequest ) String () string {
if a == nil {
return "StoriesActivateStealthModeRequest(nil)"
}
type Alias StoriesActivateStealthModeRequest
return fmt .Sprintf ("StoriesActivateStealthModeRequest%+v" , Alias (*a ))
}
func (a *StoriesActivateStealthModeRequest ) FillFrom (from interface {
GetPast () (value bool )
GetFuture () (value bool )
}) {
a .Past = from .GetPast ()
a .Future = from .GetFuture ()
}
func (*StoriesActivateStealthModeRequest ) TypeID () uint32 {
return StoriesActivateStealthModeRequestTypeID
}
func (*StoriesActivateStealthModeRequest ) TypeName () string {
return "stories.activateStealthMode"
}
func (a *StoriesActivateStealthModeRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "stories.activateStealthMode" ,
ID : StoriesActivateStealthModeRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Past" ,
SchemaName : "past" ,
Null : !a .Flags .Has (0 ),
},
{
Name : "Future" ,
SchemaName : "future" ,
Null : !a .Flags .Has (1 ),
},
}
return typ
}
func (a *StoriesActivateStealthModeRequest ) SetFlags () {
if !(a .Past == false ) {
a .Flags .Set (0 )
}
if !(a .Future == false ) {
a .Flags .Set (1 )
}
}
func (a *StoriesActivateStealthModeRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode stories.activateStealthMode#57bbd166 as nil" )
}
b .PutID (StoriesActivateStealthModeRequestTypeID )
return a .EncodeBare (b )
}
func (a *StoriesActivateStealthModeRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode stories.activateStealthMode#57bbd166 as nil" )
}
a .SetFlags ()
if err := a .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode stories.activateStealthMode#57bbd166: field flags: %w" , err )
}
return nil
}
func (a *StoriesActivateStealthModeRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode stories.activateStealthMode#57bbd166 to nil" )
}
if err := b .ConsumeID (StoriesActivateStealthModeRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode stories.activateStealthMode#57bbd166: %w" , err )
}
return a .DecodeBare (b )
}
func (a *StoriesActivateStealthModeRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode stories.activateStealthMode#57bbd166 to nil" )
}
{
if err := a .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode stories.activateStealthMode#57bbd166: field flags: %w" , err )
}
}
a .Past = a .Flags .Has (0 )
a .Future = a .Flags .Has (1 )
return nil
}
func (a *StoriesActivateStealthModeRequest ) SetPast (value bool ) {
if value {
a .Flags .Set (0 )
a .Past = true
} else {
a .Flags .Unset (0 )
a .Past = false
}
}
func (a *StoriesActivateStealthModeRequest ) GetPast () (value bool ) {
if a == nil {
return
}
return a .Flags .Has (0 )
}
func (a *StoriesActivateStealthModeRequest ) SetFuture (value bool ) {
if value {
a .Flags .Set (1 )
a .Future = true
} else {
a .Flags .Unset (1 )
a .Future = false
}
}
func (a *StoriesActivateStealthModeRequest ) GetFuture () (value bool ) {
if a == nil {
return
}
return a .Flags .Has (1 )
}
func (c *Client ) StoriesActivateStealthMode (ctx context .Context , request *StoriesActivateStealthModeRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , 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 .