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 MessagesGetSearchResultsCalendarRequest struct {
Peer InputPeerClass
Filter MessagesFilterClass
OffsetID int
OffsetDate int
}
const MessagesGetSearchResultsCalendarRequestTypeID = 0x49f0bde9
var (
_ bin .Encoder = &MessagesGetSearchResultsCalendarRequest {}
_ bin .Decoder = &MessagesGetSearchResultsCalendarRequest {}
_ bin .BareEncoder = &MessagesGetSearchResultsCalendarRequest {}
_ bin .BareDecoder = &MessagesGetSearchResultsCalendarRequest {}
)
func (g *MessagesGetSearchResultsCalendarRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Peer == nil ) {
return false
}
if !(g .Filter == nil ) {
return false
}
if !(g .OffsetID == 0 ) {
return false
}
if !(g .OffsetDate == 0 ) {
return false
}
return true
}
func (g *MessagesGetSearchResultsCalendarRequest ) String () string {
if g == nil {
return "MessagesGetSearchResultsCalendarRequest(nil)"
}
type Alias MessagesGetSearchResultsCalendarRequest
return fmt .Sprintf ("MessagesGetSearchResultsCalendarRequest%+v" , Alias (*g ))
}
func (g *MessagesGetSearchResultsCalendarRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetFilter () (value MessagesFilterClass )
GetOffsetID () (value int )
GetOffsetDate () (value int )
}) {
g .Peer = from .GetPeer ()
g .Filter = from .GetFilter ()
g .OffsetID = from .GetOffsetID ()
g .OffsetDate = from .GetOffsetDate ()
}
func (*MessagesGetSearchResultsCalendarRequest ) TypeID () uint32 {
return MessagesGetSearchResultsCalendarRequestTypeID
}
func (*MessagesGetSearchResultsCalendarRequest ) TypeName () string {
return "messages.getSearchResultsCalendar"
}
func (g *MessagesGetSearchResultsCalendarRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.getSearchResultsCalendar" ,
ID : MessagesGetSearchResultsCalendarRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Filter" ,
SchemaName : "filter" ,
},
{
Name : "OffsetID" ,
SchemaName : "offset_id" ,
},
{
Name : "OffsetDate" ,
SchemaName : "offset_date" ,
},
}
return typ
}
func (g *MessagesGetSearchResultsCalendarRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getSearchResultsCalendar#49f0bde9 as nil" )
}
b .PutID (MessagesGetSearchResultsCalendarRequestTypeID )
return g .EncodeBare (b )
}
func (g *MessagesGetSearchResultsCalendarRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode messages.getSearchResultsCalendar#49f0bde9 as nil" )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode messages.getSearchResultsCalendar#49f0bde9: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getSearchResultsCalendar#49f0bde9: field peer: %w" , err )
}
if g .Filter == nil {
return fmt .Errorf ("unable to encode messages.getSearchResultsCalendar#49f0bde9: field filter is nil" )
}
if err := g .Filter .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.getSearchResultsCalendar#49f0bde9: field filter: %w" , err )
}
b .PutInt (g .OffsetID )
b .PutInt (g .OffsetDate )
return nil
}
func (g *MessagesGetSearchResultsCalendarRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getSearchResultsCalendar#49f0bde9 to nil" )
}
if err := b .ConsumeID (MessagesGetSearchResultsCalendarRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.getSearchResultsCalendar#49f0bde9: %w" , err )
}
return g .DecodeBare (b )
}
func (g *MessagesGetSearchResultsCalendarRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode messages.getSearchResultsCalendar#49f0bde9 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getSearchResultsCalendar#49f0bde9: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := DecodeMessagesFilter (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.getSearchResultsCalendar#49f0bde9: field filter: %w" , err )
}
g .Filter = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getSearchResultsCalendar#49f0bde9: field offset_id: %w" , err )
}
g .OffsetID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.getSearchResultsCalendar#49f0bde9: field offset_date: %w" , err )
}
g .OffsetDate = value
}
return nil
}
func (g *MessagesGetSearchResultsCalendarRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *MessagesGetSearchResultsCalendarRequest ) GetFilter () (value MessagesFilterClass ) {
if g == nil {
return
}
return g .Filter
}
func (g *MessagesGetSearchResultsCalendarRequest ) GetOffsetID () (value int ) {
if g == nil {
return
}
return g .OffsetID
}
func (g *MessagesGetSearchResultsCalendarRequest ) GetOffsetDate () (value int ) {
if g == nil {
return
}
return g .OffsetDate
}
func (c *Client ) MessagesGetSearchResultsCalendar (ctx context .Context , request *MessagesGetSearchResultsCalendarRequest ) (*MessagesSearchResultsCalendar , error ) {
var result MessagesSearchResultsCalendar
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 .