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 SMSJobsUpdateSettingsRequest struct {
Flags bin .Fields
AllowInternational bool
}
const SMSJobsUpdateSettingsRequestTypeID = 0x93fa0bf
var (
_ bin .Encoder = &SMSJobsUpdateSettingsRequest {}
_ bin .Decoder = &SMSJobsUpdateSettingsRequest {}
_ bin .BareEncoder = &SMSJobsUpdateSettingsRequest {}
_ bin .BareDecoder = &SMSJobsUpdateSettingsRequest {}
)
func (u *SMSJobsUpdateSettingsRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .AllowInternational == false ) {
return false
}
return true
}
func (u *SMSJobsUpdateSettingsRequest ) String () string {
if u == nil {
return "SMSJobsUpdateSettingsRequest(nil)"
}
type Alias SMSJobsUpdateSettingsRequest
return fmt .Sprintf ("SMSJobsUpdateSettingsRequest%+v" , Alias (*u ))
}
func (u *SMSJobsUpdateSettingsRequest ) FillFrom (from interface {
GetAllowInternational () (value bool )
}) {
u .AllowInternational = from .GetAllowInternational ()
}
func (*SMSJobsUpdateSettingsRequest ) TypeID () uint32 {
return SMSJobsUpdateSettingsRequestTypeID
}
func (*SMSJobsUpdateSettingsRequest ) TypeName () string {
return "smsjobs.updateSettings"
}
func (u *SMSJobsUpdateSettingsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "smsjobs.updateSettings" ,
ID : SMSJobsUpdateSettingsRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "AllowInternational" ,
SchemaName : "allow_international" ,
Null : !u .Flags .Has (0 ),
},
}
return typ
}
func (u *SMSJobsUpdateSettingsRequest ) SetFlags () {
if !(u .AllowInternational == false ) {
u .Flags .Set (0 )
}
}
func (u *SMSJobsUpdateSettingsRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode smsjobs.updateSettings#93fa0bf as nil" )
}
b .PutID (SMSJobsUpdateSettingsRequestTypeID )
return u .EncodeBare (b )
}
func (u *SMSJobsUpdateSettingsRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode smsjobs.updateSettings#93fa0bf as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode smsjobs.updateSettings#93fa0bf: field flags: %w" , err )
}
return nil
}
func (u *SMSJobsUpdateSettingsRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode smsjobs.updateSettings#93fa0bf to nil" )
}
if err := b .ConsumeID (SMSJobsUpdateSettingsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode smsjobs.updateSettings#93fa0bf: %w" , err )
}
return u .DecodeBare (b )
}
func (u *SMSJobsUpdateSettingsRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode smsjobs.updateSettings#93fa0bf to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode smsjobs.updateSettings#93fa0bf: field flags: %w" , err )
}
}
u .AllowInternational = u .Flags .Has (0 )
return nil
}
func (u *SMSJobsUpdateSettingsRequest ) SetAllowInternational (value bool ) {
if value {
u .Flags .Set (0 )
u .AllowInternational = true
} else {
u .Flags .Unset (0 )
u .AllowInternational = false
}
}
func (u *SMSJobsUpdateSettingsRequest ) GetAllowInternational () (value bool ) {
if u == nil {
return
}
return u .Flags .Has (0 )
}
func (c *Client ) SMSJobsUpdateSettings (ctx context .Context , request *SMSJobsUpdateSettingsRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , nil
}
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 .