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 BusinessGreetingMessage struct {
ShortcutID int
Recipients BusinessRecipients
NoActivityDays int
}
const BusinessGreetingMessageTypeID = 0xe519abab
var (
_ bin .Encoder = &BusinessGreetingMessage {}
_ bin .Decoder = &BusinessGreetingMessage {}
_ bin .BareEncoder = &BusinessGreetingMessage {}
_ bin .BareDecoder = &BusinessGreetingMessage {}
)
func (b *BusinessGreetingMessage ) Zero () bool {
if b == nil {
return true
}
if !(b .ShortcutID == 0 ) {
return false
}
if !(b .Recipients .Zero ()) {
return false
}
if !(b .NoActivityDays == 0 ) {
return false
}
return true
}
func (b *BusinessGreetingMessage ) String () string {
if b == nil {
return "BusinessGreetingMessage(nil)"
}
type Alias BusinessGreetingMessage
return fmt .Sprintf ("BusinessGreetingMessage%+v" , Alias (*b ))
}
func (b *BusinessGreetingMessage ) FillFrom (from interface {
GetShortcutID () (value int )
GetRecipients () (value BusinessRecipients )
GetNoActivityDays () (value int )
}) {
b .ShortcutID = from .GetShortcutID ()
b .Recipients = from .GetRecipients ()
b .NoActivityDays = from .GetNoActivityDays ()
}
func (*BusinessGreetingMessage ) TypeID () uint32 {
return BusinessGreetingMessageTypeID
}
func (*BusinessGreetingMessage ) TypeName () string {
return "businessGreetingMessage"
}
func (b *BusinessGreetingMessage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "businessGreetingMessage" ,
ID : BusinessGreetingMessageTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShortcutID" ,
SchemaName : "shortcut_id" ,
},
{
Name : "Recipients" ,
SchemaName : "recipients" ,
},
{
Name : "NoActivityDays" ,
SchemaName : "no_activity_days" ,
},
}
return typ
}
func (b *BusinessGreetingMessage ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode businessGreetingMessage#e519abab as nil" )
}
buf .PutID (BusinessGreetingMessageTypeID )
return b .EncodeBare (buf )
}
func (b *BusinessGreetingMessage ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode businessGreetingMessage#e519abab as nil" )
}
buf .PutInt (b .ShortcutID )
if err := b .Recipients .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode businessGreetingMessage#e519abab: field recipients: %w" , err )
}
buf .PutInt (b .NoActivityDays )
return nil
}
func (b *BusinessGreetingMessage ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode businessGreetingMessage#e519abab to nil" )
}
if err := buf .ConsumeID (BusinessGreetingMessageTypeID ); err != nil {
return fmt .Errorf ("unable to decode businessGreetingMessage#e519abab: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BusinessGreetingMessage ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode businessGreetingMessage#e519abab to nil" )
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode businessGreetingMessage#e519abab: field shortcut_id: %w" , err )
}
b .ShortcutID = value
}
{
if err := b .Recipients .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode businessGreetingMessage#e519abab: field recipients: %w" , err )
}
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode businessGreetingMessage#e519abab: field no_activity_days: %w" , err )
}
b .NoActivityDays = value
}
return nil
}
func (b *BusinessGreetingMessage ) GetShortcutID () (value int ) {
if b == nil {
return
}
return b .ShortcutID
}
func (b *BusinessGreetingMessage ) GetRecipients () (value BusinessRecipients ) {
if b == nil {
return
}
return b .Recipients
}
func (b *BusinessGreetingMessage ) GetNoActivityDays () (value int ) {
if b == nil {
return
}
return b .NoActivityDays
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .