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 MessagesGetPinnedDialogsRequest struct {
FolderID int
}
const MessagesGetPinnedDialogsRequestTypeID = 0xd6b94df2
var (
_ bin .Encoder = &MessagesGetPinnedDialogsRequest {}
_ bin .Decoder = &MessagesGetPinnedDialogsRequest {}
_ bin .BareEncoder = &MessagesGetPinnedDialogsRequest {}
_ bin .BareDecoder = &MessagesGetPinnedDialogsRequest {}
)
func (g *MessagesGetPinnedDialogsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .FolderID == 0 ) {
return false
}
return true
}
func (g *MessagesGetPinnedDialogsRequest ) String () string {
if g == nil {
return "MessagesGetPinnedDialogsRequest(nil)"
}
type Alias MessagesGetPinnedDialogsRequest
return fmt .Sprintf ("MessagesGetPinnedDialogsRequest%+v" , Alias (*g ))
}
func (g *MessagesGetPinnedDialogsRequest ) FillFrom (from interface {
GetFolderID () (value int )
}) {
g .FolderID = from .GetFolderID ()
}
func (*MessagesGetPinnedDialogsRequest ) TypeID () uint32 {
return MessagesGetPinnedDialogsRequestTypeID
}
func (*MessagesGetPinnedDialogsRequest ) TypeName () string {
return "messages.getPinnedDialogs"
}
func (g *MessagesGetPinnedDialogsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getPinnedDialogs" ,
ID : MessagesGetPinnedDialogsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FolderID" ,
SchemaName : "folder_id" ,
},
}
return typ
}
func (g *MessagesGetPinnedDialogsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getPinnedDialogs#d6b94df2 as nil" )
}
b .PutID (MessagesGetPinnedDialogsRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetPinnedDialogsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getPinnedDialogs#d6b94df2 as nil" )
}
b .PutInt (g .FolderID )
return nil
}
func (g *MessagesGetPinnedDialogsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getPinnedDialogs#d6b94df2 to nil" )
}
if err := b .ConsumeID (MessagesGetPinnedDialogsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getPinnedDialogs#d6b94df2: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetPinnedDialogsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getPinnedDialogs#d6b94df2 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getPinnedDialogs#d6b94df2: field folder_id: %w" , err )
}
g .FolderID = value
}
return nil
}
func (g *MessagesGetPinnedDialogsRequest ) GetFolderID () (value int ) {
if g == nil {
return
}
return g .FolderID
}
func (c *Client ) MessagesGetPinnedDialogs (ctx context .Context , folderid int ) (*MessagesPeerDialogs , error ) {
var result MessagesPeerDialogs
request := &MessagesGetPinnedDialogsRequest {
FolderID : folderid ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .