gotd: update to layer 218
This commit is contained in:
Generated
+130
-13
@@ -470,18 +470,35 @@ func (s *AuthSentCodeSuccess) GetAuthorization() (value AuthAuthorizationClass)
|
||||
return s.Authorization
|
||||
}
|
||||
|
||||
// AuthSentCodePaymentRequired represents TL type `auth.sentCodePaymentRequired#d7cef980`.
|
||||
// AuthSentCodePaymentRequired represents TL type `auth.sentCodePaymentRequired#e0955a3c`.
|
||||
// Official apps may receive this constructor, indicating that due to the high cost of
|
||||
// SMS verification codes for the user's country/provider, the user must purchase a
|
||||
// Telegram Premium¹ subscription in order to proceed with the login/signup.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/premium
|
||||
//
|
||||
// See https://core.telegram.org/constructor/auth.sentCodePaymentRequired for reference.
|
||||
type AuthSentCodePaymentRequired struct {
|
||||
// StoreProduct field of AuthSentCodePaymentRequired.
|
||||
// Store identifier of the Telegram Premium subscription.
|
||||
StoreProduct string
|
||||
// PhoneCodeHash field of AuthSentCodePaymentRequired.
|
||||
// Phone code hash, to be stored and later re-used with auth.signIn¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/method/auth.signIn
|
||||
PhoneCodeHash string
|
||||
// An email address that can be contacted for more information about this request.
|
||||
SupportEmailAddress string
|
||||
// The mandatory subject for the email.
|
||||
SupportEmailSubject string
|
||||
// Currency field of AuthSentCodePaymentRequired.
|
||||
Currency string
|
||||
// Amount field of AuthSentCodePaymentRequired.
|
||||
Amount int64
|
||||
}
|
||||
|
||||
// AuthSentCodePaymentRequiredTypeID is TL type id of AuthSentCodePaymentRequired.
|
||||
const AuthSentCodePaymentRequiredTypeID = 0xd7cef980
|
||||
const AuthSentCodePaymentRequiredTypeID = 0xe0955a3c
|
||||
|
||||
// construct implements constructor of AuthSentCodeClass.
|
||||
func (s AuthSentCodePaymentRequired) construct() AuthSentCodeClass { return &s }
|
||||
@@ -506,6 +523,18 @@ func (s *AuthSentCodePaymentRequired) Zero() bool {
|
||||
if !(s.PhoneCodeHash == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.SupportEmailAddress == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.SupportEmailSubject == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.Currency == "") {
|
||||
return false
|
||||
}
|
||||
if !(s.Amount == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -523,9 +552,17 @@ func (s *AuthSentCodePaymentRequired) String() string {
|
||||
func (s *AuthSentCodePaymentRequired) FillFrom(from interface {
|
||||
GetStoreProduct() (value string)
|
||||
GetPhoneCodeHash() (value string)
|
||||
GetSupportEmailAddress() (value string)
|
||||
GetSupportEmailSubject() (value string)
|
||||
GetCurrency() (value string)
|
||||
GetAmount() (value int64)
|
||||
}) {
|
||||
s.StoreProduct = from.GetStoreProduct()
|
||||
s.PhoneCodeHash = from.GetPhoneCodeHash()
|
||||
s.SupportEmailAddress = from.GetSupportEmailAddress()
|
||||
s.SupportEmailSubject = from.GetSupportEmailSubject()
|
||||
s.Currency = from.GetCurrency()
|
||||
s.Amount = from.GetAmount()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
@@ -559,6 +596,22 @@ func (s *AuthSentCodePaymentRequired) TypeInfo() tdp.Type {
|
||||
Name: "PhoneCodeHash",
|
||||
SchemaName: "phone_code_hash",
|
||||
},
|
||||
{
|
||||
Name: "SupportEmailAddress",
|
||||
SchemaName: "support_email_address",
|
||||
},
|
||||
{
|
||||
Name: "SupportEmailSubject",
|
||||
SchemaName: "support_email_subject",
|
||||
},
|
||||
{
|
||||
Name: "Currency",
|
||||
SchemaName: "currency",
|
||||
},
|
||||
{
|
||||
Name: "Amount",
|
||||
SchemaName: "amount",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
@@ -566,7 +619,7 @@ func (s *AuthSentCodePaymentRequired) TypeInfo() tdp.Type {
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *AuthSentCodePaymentRequired) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode auth.sentCodePaymentRequired#d7cef980 as nil")
|
||||
return fmt.Errorf("can't encode auth.sentCodePaymentRequired#e0955a3c as nil")
|
||||
}
|
||||
b.PutID(AuthSentCodePaymentRequiredTypeID)
|
||||
return s.EncodeBare(b)
|
||||
@@ -575,20 +628,24 @@ func (s *AuthSentCodePaymentRequired) Encode(b *bin.Buffer) error {
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *AuthSentCodePaymentRequired) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode auth.sentCodePaymentRequired#d7cef980 as nil")
|
||||
return fmt.Errorf("can't encode auth.sentCodePaymentRequired#e0955a3c as nil")
|
||||
}
|
||||
b.PutString(s.StoreProduct)
|
||||
b.PutString(s.PhoneCodeHash)
|
||||
b.PutString(s.SupportEmailAddress)
|
||||
b.PutString(s.SupportEmailSubject)
|
||||
b.PutString(s.Currency)
|
||||
b.PutLong(s.Amount)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *AuthSentCodePaymentRequired) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode auth.sentCodePaymentRequired#d7cef980 to nil")
|
||||
return fmt.Errorf("can't decode auth.sentCodePaymentRequired#e0955a3c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AuthSentCodePaymentRequiredTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#d7cef980: %w", err)
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
@@ -596,22 +653,50 @@ func (s *AuthSentCodePaymentRequired) Decode(b *bin.Buffer) error {
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *AuthSentCodePaymentRequired) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode auth.sentCodePaymentRequired#d7cef980 to nil")
|
||||
return fmt.Errorf("can't decode auth.sentCodePaymentRequired#e0955a3c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#d7cef980: field store_product: %w", err)
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field store_product: %w", err)
|
||||
}
|
||||
s.StoreProduct = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#d7cef980: field phone_code_hash: %w", err)
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field phone_code_hash: %w", err)
|
||||
}
|
||||
s.PhoneCodeHash = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field support_email_address: %w", err)
|
||||
}
|
||||
s.SupportEmailAddress = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field support_email_subject: %w", err)
|
||||
}
|
||||
s.SupportEmailSubject = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field currency: %w", err)
|
||||
}
|
||||
s.Currency = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode auth.sentCodePaymentRequired#e0955a3c: field amount: %w", err)
|
||||
}
|
||||
s.Amount = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -631,6 +716,38 @@ func (s *AuthSentCodePaymentRequired) GetPhoneCodeHash() (value string) {
|
||||
return s.PhoneCodeHash
|
||||
}
|
||||
|
||||
// GetSupportEmailAddress returns value of SupportEmailAddress field.
|
||||
func (s *AuthSentCodePaymentRequired) GetSupportEmailAddress() (value string) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.SupportEmailAddress
|
||||
}
|
||||
|
||||
// GetSupportEmailSubject returns value of SupportEmailSubject field.
|
||||
func (s *AuthSentCodePaymentRequired) GetSupportEmailSubject() (value string) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.SupportEmailSubject
|
||||
}
|
||||
|
||||
// GetCurrency returns value of Currency field.
|
||||
func (s *AuthSentCodePaymentRequired) GetCurrency() (value string) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Currency
|
||||
}
|
||||
|
||||
// GetAmount returns value of Amount field.
|
||||
func (s *AuthSentCodePaymentRequired) GetAmount() (value int64) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Amount
|
||||
}
|
||||
|
||||
// AuthSentCodeClassName is schema name of AuthSentCodeClass.
|
||||
const AuthSentCodeClassName = "auth.SentCode"
|
||||
|
||||
@@ -647,7 +764,7 @@ const AuthSentCodeClassName = "auth.SentCode"
|
||||
// switch v := g.(type) {
|
||||
// case *tg.AuthSentCode: // auth.sentCode#5e002502
|
||||
// case *tg.AuthSentCodeSuccess: // auth.sentCodeSuccess#2390fe44
|
||||
// case *tg.AuthSentCodePaymentRequired: // auth.sentCodePaymentRequired#d7cef980
|
||||
// case *tg.AuthSentCodePaymentRequired: // auth.sentCodePaymentRequired#e0955a3c
|
||||
// default: panic(v)
|
||||
// }
|
||||
type AuthSentCodeClass interface {
|
||||
@@ -691,7 +808,7 @@ func DecodeAuthSentCode(buf *bin.Buffer) (AuthSentCodeClass, error) {
|
||||
}
|
||||
return &v, nil
|
||||
case AuthSentCodePaymentRequiredTypeID:
|
||||
// Decoding auth.sentCodePaymentRequired#d7cef980.
|
||||
// Decoding auth.sentCodePaymentRequired#e0955a3c.
|
||||
v := AuthSentCodePaymentRequired{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode AuthSentCodeClass: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user