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 SearchResultsCalendarPeriod struct {
Date int
MinMsgID int
MaxMsgID int
Count int
}
const SearchResultsCalendarPeriodTypeID = 0xc9b0539f
var (
_ bin .Encoder = &SearchResultsCalendarPeriod {}
_ bin .Decoder = &SearchResultsCalendarPeriod {}
_ bin .BareEncoder = &SearchResultsCalendarPeriod {}
_ bin .BareDecoder = &SearchResultsCalendarPeriod {}
)
func (s *SearchResultsCalendarPeriod ) Zero () bool {
if s == nil {
return true
}
if !(s .Date == 0 ) {
return false
}
if !(s .MinMsgID == 0 ) {
return false
}
if !(s .MaxMsgID == 0 ) {
return false
}
if !(s .Count == 0 ) {
return false
}
return true
}
func (s *SearchResultsCalendarPeriod ) String () string {
if s == nil {
return "SearchResultsCalendarPeriod(nil)"
}
type Alias SearchResultsCalendarPeriod
return fmt .Sprintf ("SearchResultsCalendarPeriod%+v" , Alias (*s ))
}
func (s *SearchResultsCalendarPeriod ) FillFrom (from interface {
GetDate () (value int )
GetMinMsgID () (value int )
GetMaxMsgID () (value int )
GetCount () (value int )
}) {
s .Date = from .GetDate ()
s .MinMsgID = from .GetMinMsgID ()
s .MaxMsgID = from .GetMaxMsgID ()
s .Count = from .GetCount ()
}
func (*SearchResultsCalendarPeriod ) TypeID () uint32 {
return SearchResultsCalendarPeriodTypeID
}
func (*SearchResultsCalendarPeriod ) TypeName () string {
return "searchResultsCalendarPeriod"
}
func (s *SearchResultsCalendarPeriod ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "searchResultsCalendarPeriod" ,
ID : SearchResultsCalendarPeriodTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "MinMsgID" ,
SchemaName : "min_msg_id" ,
},
{
Name : "MaxMsgID" ,
SchemaName : "max_msg_id" ,
},
{
Name : "Count" ,
SchemaName : "count" ,
},
}
return typ
}
func (s *SearchResultsCalendarPeriod ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode searchResultsCalendarPeriod#c9b0539f as nil" )
}
b .PutID (SearchResultsCalendarPeriodTypeID )
return s .EncodeBare (b )
}
func (s *SearchResultsCalendarPeriod ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode searchResultsCalendarPeriod#c9b0539f as nil" )
}
b .PutInt (s .Date )
b .PutInt (s .MinMsgID )
b .PutInt (s .MaxMsgID )
b .PutInt (s .Count )
return nil
}
func (s *SearchResultsCalendarPeriod ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode searchResultsCalendarPeriod#c9b0539f to nil" )
}
if err := b .ConsumeID (SearchResultsCalendarPeriodTypeID ); err != nil {
return fmt .Errorf ("unable to decode searchResultsCalendarPeriod#c9b0539f: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SearchResultsCalendarPeriod ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode searchResultsCalendarPeriod#c9b0539f to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultsCalendarPeriod#c9b0539f: field date: %w" , err )
}
s .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultsCalendarPeriod#c9b0539f: field min_msg_id: %w" , err )
}
s .MinMsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultsCalendarPeriod#c9b0539f: field max_msg_id: %w" , err )
}
s .MaxMsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultsCalendarPeriod#c9b0539f: field count: %w" , err )
}
s .Count = value
}
return nil
}
func (s *SearchResultsCalendarPeriod ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *SearchResultsCalendarPeriod ) GetMinMsgID () (value int ) {
if s == nil {
return
}
return s .MinMsgID
}
func (s *SearchResultsCalendarPeriod ) GetMaxMsgID () (value int ) {
if s == nil {
return
}
return s .MaxMsgID
}
func (s *SearchResultsCalendarPeriod ) GetCount () (value int ) {
if s == nil {
return
}
return s .Count
}
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 .