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