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 SMSJob struct {
JobID string
PhoneNumber string
Text string
}
const SMSJobTypeID = 0xe6a1eeb8
var (
_ bin .Encoder = &SMSJob {}
_ bin .Decoder = &SMSJob {}
_ bin .BareEncoder = &SMSJob {}
_ bin .BareDecoder = &SMSJob {}
)
func (s *SMSJob ) Zero () bool {
if s == nil {
return true
}
if !(s .JobID == "" ) {
return false
}
if !(s .PhoneNumber == "" ) {
return false
}
if !(s .Text == "" ) {
return false
}
return true
}
func (s *SMSJob ) String () string {
if s == nil {
return "SMSJob(nil)"
}
type Alias SMSJob
return fmt .Sprintf ("SMSJob%+v" , Alias (*s ))
}
func (s *SMSJob ) FillFrom (from interface {
GetJobID () (value string )
GetPhoneNumber () (value string )
GetText () (value string )
}) {
s .JobID = from .GetJobID ()
s .PhoneNumber = from .GetPhoneNumber ()
s .Text = from .GetText ()
}
func (*SMSJob ) TypeID () uint32 {
return SMSJobTypeID
}
func (*SMSJob ) TypeName () string {
return "smsJob"
}
func (s *SMSJob ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "smsJob" ,
ID : SMSJobTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "JobID" ,
SchemaName : "job_id" ,
},
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (s *SMSJob ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode smsJob#e6a1eeb8 as nil" )
}
b .PutID (SMSJobTypeID )
return s .EncodeBare (b )
}
func (s *SMSJob ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode smsJob#e6a1eeb8 as nil" )
}
b .PutString (s .JobID )
b .PutString (s .PhoneNumber )
b .PutString (s .Text )
return nil
}
func (s *SMSJob ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode smsJob#e6a1eeb8 to nil" )
}
if err := b .ConsumeID (SMSJobTypeID ); err != nil {
return fmt .Errorf ("unable to decode smsJob#e6a1eeb8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SMSJob ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode smsJob#e6a1eeb8 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode smsJob#e6a1eeb8: field job_id: %w" , err )
}
s .JobID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode smsJob#e6a1eeb8: field phone_number: %w" , err )
}
s .PhoneNumber = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode smsJob#e6a1eeb8: field text: %w" , err )
}
s .Text = value
}
return nil
}
func (s *SMSJob ) GetJobID () (value string ) {
if s == nil {
return
}
return s .JobID
}
func (s *SMSJob ) GetPhoneNumber () (value string ) {
if s == nil {
return
}
return s .PhoneNumber
}
func (s *SMSJob ) GetText () (value string ) {
if s == nil {
return
}
return s .Text
}
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 .