Files
mautrix-telegram/pkg/gotd/tg/tl_smsjobs_eligible_to_join_gen.go
T
2025-06-27 20:03:37 -07:00

190 lines
4.4 KiB
Go
Generated

// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// SMSJobsEligibleToJoin represents TL type `smsjobs.eligibleToJoin#dc8b44cf`.
// SMS jobs eligibility
//
// See https://core.telegram.org/constructor/smsjobs.eligibleToJoin for reference.
type SMSJobsEligibleToJoin struct {
// Terms of service URL
TermsURL string
// Monthly sent SMSes
MonthlySentSMS int
}
// SMSJobsEligibleToJoinTypeID is TL type id of SMSJobsEligibleToJoin.
const SMSJobsEligibleToJoinTypeID = 0xdc8b44cf
// Ensuring interfaces in compile-time for SMSJobsEligibleToJoin.
var (
_ bin.Encoder = &SMSJobsEligibleToJoin{}
_ bin.Decoder = &SMSJobsEligibleToJoin{}
_ bin.BareEncoder = &SMSJobsEligibleToJoin{}
_ bin.BareDecoder = &SMSJobsEligibleToJoin{}
)
func (e *SMSJobsEligibleToJoin) Zero() bool {
if e == nil {
return true
}
if !(e.TermsURL == "") {
return false
}
if !(e.MonthlySentSMS == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (e *SMSJobsEligibleToJoin) String() string {
if e == nil {
return "SMSJobsEligibleToJoin(nil)"
}
type Alias SMSJobsEligibleToJoin
return fmt.Sprintf("SMSJobsEligibleToJoin%+v", Alias(*e))
}
// FillFrom fills SMSJobsEligibleToJoin from given interface.
func (e *SMSJobsEligibleToJoin) FillFrom(from interface {
GetTermsURL() (value string)
GetMonthlySentSMS() (value int)
}) {
e.TermsURL = from.GetTermsURL()
e.MonthlySentSMS = from.GetMonthlySentSMS()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SMSJobsEligibleToJoin) TypeID() uint32 {
return SMSJobsEligibleToJoinTypeID
}
// TypeName returns name of type in TL schema.
func (*SMSJobsEligibleToJoin) TypeName() string {
return "smsjobs.eligibleToJoin"
}
// TypeInfo returns info about TL type.
func (e *SMSJobsEligibleToJoin) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "smsjobs.eligibleToJoin",
ID: SMSJobsEligibleToJoinTypeID,
}
if e == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "TermsURL",
SchemaName: "terms_url",
},
{
Name: "MonthlySentSMS",
SchemaName: "monthly_sent_sms",
},
}
return typ
}
// Encode implements bin.Encoder.
func (e *SMSJobsEligibleToJoin) Encode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil")
}
b.PutID(SMSJobsEligibleToJoinTypeID)
return e.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (e *SMSJobsEligibleToJoin) EncodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil")
}
b.PutString(e.TermsURL)
b.PutInt(e.MonthlySentSMS)
return nil
}
// Decode implements bin.Decoder.
func (e *SMSJobsEligibleToJoin) Decode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode smsjobs.eligibleToJoin#dc8b44cf to nil")
}
if err := b.ConsumeID(SMSJobsEligibleToJoinTypeID); err != nil {
return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: %w", err)
}
return e.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (e *SMSJobsEligibleToJoin) DecodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode smsjobs.eligibleToJoin#dc8b44cf to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field terms_url: %w", err)
}
e.TermsURL = value
}
{
value, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field monthly_sent_sms: %w", err)
}
e.MonthlySentSMS = value
}
return nil
}
// GetTermsURL returns value of TermsURL field.
func (e *SMSJobsEligibleToJoin) GetTermsURL() (value string) {
if e == nil {
return
}
return e.TermsURL
}
// GetMonthlySentSMS returns value of MonthlySentSMS field.
func (e *SMSJobsEligibleToJoin) GetMonthlySentSMS() (value int) {
if e == nil {
return
}
return e.MonthlySentSMS
}