7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
2493 lines
78 KiB
Go
2493 lines
78 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
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{}
|
|
)
|
|
|
|
// InputPassportElementPersonalDetails represents TL type `inputPassportElementPersonalDetails#9d2843f`.
|
|
type InputPassportElementPersonalDetails struct {
|
|
// Personal details of the user
|
|
PersonalDetails PersonalDetails
|
|
}
|
|
|
|
// InputPassportElementPersonalDetailsTypeID is TL type id of InputPassportElementPersonalDetails.
|
|
const InputPassportElementPersonalDetailsTypeID = 0x9d2843f
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementPersonalDetails) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementPersonalDetails.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementPersonalDetails{}
|
|
_ bin.Decoder = &InputPassportElementPersonalDetails{}
|
|
_ bin.BareEncoder = &InputPassportElementPersonalDetails{}
|
|
_ bin.BareDecoder = &InputPassportElementPersonalDetails{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementPersonalDetails{}
|
|
)
|
|
|
|
func (i *InputPassportElementPersonalDetails) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.PersonalDetails.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementPersonalDetails) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementPersonalDetails(nil)"
|
|
}
|
|
type Alias InputPassportElementPersonalDetails
|
|
return fmt.Sprintf("InputPassportElementPersonalDetails%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementPersonalDetails) TypeID() uint32 {
|
|
return InputPassportElementPersonalDetailsTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementPersonalDetails) TypeName() string {
|
|
return "inputPassportElementPersonalDetails"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementPersonalDetails) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementPersonalDetails",
|
|
ID: InputPassportElementPersonalDetailsTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PersonalDetails",
|
|
SchemaName: "personal_details",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementPersonalDetails) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil")
|
|
}
|
|
b.PutID(InputPassportElementPersonalDetailsTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementPersonalDetails) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil")
|
|
}
|
|
if err := i.PersonalDetails.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementPersonalDetails) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementPersonalDetailsTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementPersonalDetails) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil")
|
|
}
|
|
{
|
|
if err := i.PersonalDetails.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementPersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementPersonalDetails")
|
|
b.Comma()
|
|
b.FieldStart("personal_details")
|
|
if err := i.PersonalDetails.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementPersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementPersonalDetails"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: %w", err)
|
|
}
|
|
case "personal_details":
|
|
if err := i.PersonalDetails.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPersonalDetails returns value of PersonalDetails field.
|
|
func (i *InputPassportElementPersonalDetails) GetPersonalDetails() (value PersonalDetails) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PersonalDetails
|
|
}
|
|
|
|
// InputPassportElementPassport represents TL type `inputPassportElementPassport#e2603564`.
|
|
type InputPassportElementPassport struct {
|
|
// The passport to be saved
|
|
Passport InputIdentityDocument
|
|
}
|
|
|
|
// InputPassportElementPassportTypeID is TL type id of InputPassportElementPassport.
|
|
const InputPassportElementPassportTypeID = 0xe2603564
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementPassport) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementPassport.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementPassport{}
|
|
_ bin.Decoder = &InputPassportElementPassport{}
|
|
_ bin.BareEncoder = &InputPassportElementPassport{}
|
|
_ bin.BareDecoder = &InputPassportElementPassport{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementPassport{}
|
|
)
|
|
|
|
func (i *InputPassportElementPassport) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Passport.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementPassport) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementPassport(nil)"
|
|
}
|
|
type Alias InputPassportElementPassport
|
|
return fmt.Sprintf("InputPassportElementPassport%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementPassport) TypeID() uint32 {
|
|
return InputPassportElementPassportTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementPassport) TypeName() string {
|
|
return "inputPassportElementPassport"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementPassport) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementPassport",
|
|
ID: InputPassportElementPassportTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Passport",
|
|
SchemaName: "passport",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementPassport) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil")
|
|
}
|
|
b.PutID(InputPassportElementPassportTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementPassport) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil")
|
|
}
|
|
if err := i.Passport.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPassport#e2603564: field passport: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementPassport) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementPassportTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementPassport) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil")
|
|
}
|
|
{
|
|
if err := i.Passport.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: field passport: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementPassport) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementPassport")
|
|
b.Comma()
|
|
b.FieldStart("passport")
|
|
if err := i.Passport.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPassport#e2603564: field passport: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementPassport) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementPassport"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: %w", err)
|
|
}
|
|
case "passport":
|
|
if err := i.Passport.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: field passport: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPassport returns value of Passport field.
|
|
func (i *InputPassportElementPassport) GetPassport() (value InputIdentityDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Passport
|
|
}
|
|
|
|
// InputPassportElementDriverLicense represents TL type `inputPassportElementDriverLicense#122b14d0`.
|
|
type InputPassportElementDriverLicense struct {
|
|
// The driver license to be saved
|
|
DriverLicense InputIdentityDocument
|
|
}
|
|
|
|
// InputPassportElementDriverLicenseTypeID is TL type id of InputPassportElementDriverLicense.
|
|
const InputPassportElementDriverLicenseTypeID = 0x122b14d0
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementDriverLicense) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementDriverLicense.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementDriverLicense{}
|
|
_ bin.Decoder = &InputPassportElementDriverLicense{}
|
|
_ bin.BareEncoder = &InputPassportElementDriverLicense{}
|
|
_ bin.BareDecoder = &InputPassportElementDriverLicense{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementDriverLicense{}
|
|
)
|
|
|
|
func (i *InputPassportElementDriverLicense) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.DriverLicense.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementDriverLicense) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementDriverLicense(nil)"
|
|
}
|
|
type Alias InputPassportElementDriverLicense
|
|
return fmt.Sprintf("InputPassportElementDriverLicense%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementDriverLicense) TypeID() uint32 {
|
|
return InputPassportElementDriverLicenseTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementDriverLicense) TypeName() string {
|
|
return "inputPassportElementDriverLicense"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementDriverLicense) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementDriverLicense",
|
|
ID: InputPassportElementDriverLicenseTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "DriverLicense",
|
|
SchemaName: "driver_license",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementDriverLicense) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil")
|
|
}
|
|
b.PutID(InputPassportElementDriverLicenseTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementDriverLicense) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil")
|
|
}
|
|
if err := i.DriverLicense.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementDriverLicense) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementDriverLicenseTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementDriverLicense) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil")
|
|
}
|
|
{
|
|
if err := i.DriverLicense.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementDriverLicense) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementDriverLicense")
|
|
b.Comma()
|
|
b.FieldStart("driver_license")
|
|
if err := i.DriverLicense.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementDriverLicense) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementDriverLicense"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: %w", err)
|
|
}
|
|
case "driver_license":
|
|
if err := i.DriverLicense.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetDriverLicense returns value of DriverLicense field.
|
|
func (i *InputPassportElementDriverLicense) GetDriverLicense() (value InputIdentityDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.DriverLicense
|
|
}
|
|
|
|
// InputPassportElementIdentityCard represents TL type `inputPassportElementIdentityCard#ff67f882`.
|
|
type InputPassportElementIdentityCard struct {
|
|
// The identity card to be saved
|
|
IdentityCard InputIdentityDocument
|
|
}
|
|
|
|
// InputPassportElementIdentityCardTypeID is TL type id of InputPassportElementIdentityCard.
|
|
const InputPassportElementIdentityCardTypeID = 0xff67f882
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementIdentityCard) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementIdentityCard.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementIdentityCard{}
|
|
_ bin.Decoder = &InputPassportElementIdentityCard{}
|
|
_ bin.BareEncoder = &InputPassportElementIdentityCard{}
|
|
_ bin.BareDecoder = &InputPassportElementIdentityCard{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementIdentityCard{}
|
|
)
|
|
|
|
func (i *InputPassportElementIdentityCard) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.IdentityCard.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementIdentityCard) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementIdentityCard(nil)"
|
|
}
|
|
type Alias InputPassportElementIdentityCard
|
|
return fmt.Sprintf("InputPassportElementIdentityCard%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementIdentityCard) TypeID() uint32 {
|
|
return InputPassportElementIdentityCardTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementIdentityCard) TypeName() string {
|
|
return "inputPassportElementIdentityCard"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementIdentityCard) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementIdentityCard",
|
|
ID: InputPassportElementIdentityCardTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "IdentityCard",
|
|
SchemaName: "identity_card",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementIdentityCard) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil")
|
|
}
|
|
b.PutID(InputPassportElementIdentityCardTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementIdentityCard) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil")
|
|
}
|
|
if err := i.IdentityCard.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementIdentityCard) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementIdentityCardTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementIdentityCard) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil")
|
|
}
|
|
{
|
|
if err := i.IdentityCard.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementIdentityCard) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementIdentityCard")
|
|
b.Comma()
|
|
b.FieldStart("identity_card")
|
|
if err := i.IdentityCard.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementIdentityCard) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementIdentityCard"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: %w", err)
|
|
}
|
|
case "identity_card":
|
|
if err := i.IdentityCard.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetIdentityCard returns value of IdentityCard field.
|
|
func (i *InputPassportElementIdentityCard) GetIdentityCard() (value InputIdentityDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.IdentityCard
|
|
}
|
|
|
|
// InputPassportElementInternalPassport represents TL type `inputPassportElementInternalPassport#2aa3872b`.
|
|
type InputPassportElementInternalPassport struct {
|
|
// The internal passport to be saved
|
|
InternalPassport InputIdentityDocument
|
|
}
|
|
|
|
// InputPassportElementInternalPassportTypeID is TL type id of InputPassportElementInternalPassport.
|
|
const InputPassportElementInternalPassportTypeID = 0x2aa3872b
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementInternalPassport) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementInternalPassport.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementInternalPassport{}
|
|
_ bin.Decoder = &InputPassportElementInternalPassport{}
|
|
_ bin.BareEncoder = &InputPassportElementInternalPassport{}
|
|
_ bin.BareDecoder = &InputPassportElementInternalPassport{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementInternalPassport{}
|
|
)
|
|
|
|
func (i *InputPassportElementInternalPassport) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.InternalPassport.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementInternalPassport) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementInternalPassport(nil)"
|
|
}
|
|
type Alias InputPassportElementInternalPassport
|
|
return fmt.Sprintf("InputPassportElementInternalPassport%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementInternalPassport) TypeID() uint32 {
|
|
return InputPassportElementInternalPassportTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementInternalPassport) TypeName() string {
|
|
return "inputPassportElementInternalPassport"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementInternalPassport) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementInternalPassport",
|
|
ID: InputPassportElementInternalPassportTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "InternalPassport",
|
|
SchemaName: "internal_passport",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementInternalPassport) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil")
|
|
}
|
|
b.PutID(InputPassportElementInternalPassportTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementInternalPassport) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil")
|
|
}
|
|
if err := i.InternalPassport.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementInternalPassport) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementInternalPassportTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementInternalPassport) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil")
|
|
}
|
|
{
|
|
if err := i.InternalPassport.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementInternalPassport) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementInternalPassport")
|
|
b.Comma()
|
|
b.FieldStart("internal_passport")
|
|
if err := i.InternalPassport.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementInternalPassport) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementInternalPassport"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: %w", err)
|
|
}
|
|
case "internal_passport":
|
|
if err := i.InternalPassport.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetInternalPassport returns value of InternalPassport field.
|
|
func (i *InputPassportElementInternalPassport) GetInternalPassport() (value InputIdentityDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.InternalPassport
|
|
}
|
|
|
|
// InputPassportElementAddress represents TL type `inputPassportElementAddress#1b83ec10`.
|
|
type InputPassportElementAddress struct {
|
|
// The address to be saved
|
|
Address Address
|
|
}
|
|
|
|
// InputPassportElementAddressTypeID is TL type id of InputPassportElementAddress.
|
|
const InputPassportElementAddressTypeID = 0x1b83ec10
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementAddress) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementAddress.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementAddress{}
|
|
_ bin.Decoder = &InputPassportElementAddress{}
|
|
_ bin.BareEncoder = &InputPassportElementAddress{}
|
|
_ bin.BareDecoder = &InputPassportElementAddress{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementAddress{}
|
|
)
|
|
|
|
func (i *InputPassportElementAddress) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.Address.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementAddress) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementAddress(nil)"
|
|
}
|
|
type Alias InputPassportElementAddress
|
|
return fmt.Sprintf("InputPassportElementAddress%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementAddress) TypeID() uint32 {
|
|
return InputPassportElementAddressTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementAddress) TypeName() string {
|
|
return "inputPassportElementAddress"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementAddress) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementAddress",
|
|
ID: InputPassportElementAddressTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Address",
|
|
SchemaName: "address",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementAddress) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil")
|
|
}
|
|
b.PutID(InputPassportElementAddressTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementAddress) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil")
|
|
}
|
|
if err := i.Address.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementAddress#1b83ec10: field address: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementAddress) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementAddressTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementAddress) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil")
|
|
}
|
|
{
|
|
if err := i.Address.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: field address: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementAddress) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementAddress")
|
|
b.Comma()
|
|
b.FieldStart("address")
|
|
if err := i.Address.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementAddress#1b83ec10: field address: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementAddress) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementAddress"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: %w", err)
|
|
}
|
|
case "address":
|
|
if err := i.Address.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: field address: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetAddress returns value of Address field.
|
|
func (i *InputPassportElementAddress) GetAddress() (value Address) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.Address
|
|
}
|
|
|
|
// InputPassportElementUtilityBill represents TL type `inputPassportElementUtilityBill#52cd9181`.
|
|
type InputPassportElementUtilityBill struct {
|
|
// The utility bill to be saved
|
|
UtilityBill InputPersonalDocument
|
|
}
|
|
|
|
// InputPassportElementUtilityBillTypeID is TL type id of InputPassportElementUtilityBill.
|
|
const InputPassportElementUtilityBillTypeID = 0x52cd9181
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementUtilityBill) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementUtilityBill.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementUtilityBill{}
|
|
_ bin.Decoder = &InputPassportElementUtilityBill{}
|
|
_ bin.BareEncoder = &InputPassportElementUtilityBill{}
|
|
_ bin.BareDecoder = &InputPassportElementUtilityBill{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementUtilityBill{}
|
|
)
|
|
|
|
func (i *InputPassportElementUtilityBill) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.UtilityBill.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementUtilityBill) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementUtilityBill(nil)"
|
|
}
|
|
type Alias InputPassportElementUtilityBill
|
|
return fmt.Sprintf("InputPassportElementUtilityBill%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementUtilityBill) TypeID() uint32 {
|
|
return InputPassportElementUtilityBillTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementUtilityBill) TypeName() string {
|
|
return "inputPassportElementUtilityBill"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementUtilityBill) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementUtilityBill",
|
|
ID: InputPassportElementUtilityBillTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "UtilityBill",
|
|
SchemaName: "utility_bill",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementUtilityBill) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil")
|
|
}
|
|
b.PutID(InputPassportElementUtilityBillTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementUtilityBill) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil")
|
|
}
|
|
if err := i.UtilityBill.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementUtilityBill) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementUtilityBillTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementUtilityBill) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil")
|
|
}
|
|
{
|
|
if err := i.UtilityBill.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementUtilityBill) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementUtilityBill")
|
|
b.Comma()
|
|
b.FieldStart("utility_bill")
|
|
if err := i.UtilityBill.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementUtilityBill) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementUtilityBill"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: %w", err)
|
|
}
|
|
case "utility_bill":
|
|
if err := i.UtilityBill.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetUtilityBill returns value of UtilityBill field.
|
|
func (i *InputPassportElementUtilityBill) GetUtilityBill() (value InputPersonalDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.UtilityBill
|
|
}
|
|
|
|
// InputPassportElementBankStatement represents TL type `inputPassportElementBankStatement#fe6a5788`.
|
|
type InputPassportElementBankStatement struct {
|
|
// The bank statement to be saved
|
|
BankStatement InputPersonalDocument
|
|
}
|
|
|
|
// InputPassportElementBankStatementTypeID is TL type id of InputPassportElementBankStatement.
|
|
const InputPassportElementBankStatementTypeID = 0xfe6a5788
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementBankStatement) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementBankStatement.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementBankStatement{}
|
|
_ bin.Decoder = &InputPassportElementBankStatement{}
|
|
_ bin.BareEncoder = &InputPassportElementBankStatement{}
|
|
_ bin.BareDecoder = &InputPassportElementBankStatement{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementBankStatement{}
|
|
)
|
|
|
|
func (i *InputPassportElementBankStatement) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.BankStatement.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementBankStatement) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementBankStatement(nil)"
|
|
}
|
|
type Alias InputPassportElementBankStatement
|
|
return fmt.Sprintf("InputPassportElementBankStatement%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementBankStatement) TypeID() uint32 {
|
|
return InputPassportElementBankStatementTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementBankStatement) TypeName() string {
|
|
return "inputPassportElementBankStatement"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementBankStatement) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementBankStatement",
|
|
ID: InputPassportElementBankStatementTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BankStatement",
|
|
SchemaName: "bank_statement",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementBankStatement) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil")
|
|
}
|
|
b.PutID(InputPassportElementBankStatementTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementBankStatement) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil")
|
|
}
|
|
if err := i.BankStatement.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementBankStatement) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementBankStatementTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementBankStatement) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil")
|
|
}
|
|
{
|
|
if err := i.BankStatement.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementBankStatement) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementBankStatement")
|
|
b.Comma()
|
|
b.FieldStart("bank_statement")
|
|
if err := i.BankStatement.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementBankStatement) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementBankStatement"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: %w", err)
|
|
}
|
|
case "bank_statement":
|
|
if err := i.BankStatement.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBankStatement returns value of BankStatement field.
|
|
func (i *InputPassportElementBankStatement) GetBankStatement() (value InputPersonalDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.BankStatement
|
|
}
|
|
|
|
// InputPassportElementRentalAgreement represents TL type `inputPassportElementRentalAgreement#677b9c2b`.
|
|
type InputPassportElementRentalAgreement struct {
|
|
// The rental agreement to be saved
|
|
RentalAgreement InputPersonalDocument
|
|
}
|
|
|
|
// InputPassportElementRentalAgreementTypeID is TL type id of InputPassportElementRentalAgreement.
|
|
const InputPassportElementRentalAgreementTypeID = 0x677b9c2b
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementRentalAgreement) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementRentalAgreement.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementRentalAgreement{}
|
|
_ bin.Decoder = &InputPassportElementRentalAgreement{}
|
|
_ bin.BareEncoder = &InputPassportElementRentalAgreement{}
|
|
_ bin.BareDecoder = &InputPassportElementRentalAgreement{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementRentalAgreement{}
|
|
)
|
|
|
|
func (i *InputPassportElementRentalAgreement) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.RentalAgreement.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementRentalAgreement) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementRentalAgreement(nil)"
|
|
}
|
|
type Alias InputPassportElementRentalAgreement
|
|
return fmt.Sprintf("InputPassportElementRentalAgreement%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementRentalAgreement) TypeID() uint32 {
|
|
return InputPassportElementRentalAgreementTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementRentalAgreement) TypeName() string {
|
|
return "inputPassportElementRentalAgreement"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementRentalAgreement) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementRentalAgreement",
|
|
ID: InputPassportElementRentalAgreementTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "RentalAgreement",
|
|
SchemaName: "rental_agreement",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementRentalAgreement) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil")
|
|
}
|
|
b.PutID(InputPassportElementRentalAgreementTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementRentalAgreement) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil")
|
|
}
|
|
if err := i.RentalAgreement.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementRentalAgreement) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementRentalAgreementTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementRentalAgreement) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil")
|
|
}
|
|
{
|
|
if err := i.RentalAgreement.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementRentalAgreement) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementRentalAgreement")
|
|
b.Comma()
|
|
b.FieldStart("rental_agreement")
|
|
if err := i.RentalAgreement.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementRentalAgreement) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementRentalAgreement"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: %w", err)
|
|
}
|
|
case "rental_agreement":
|
|
if err := i.RentalAgreement.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetRentalAgreement returns value of RentalAgreement field.
|
|
func (i *InputPassportElementRentalAgreement) GetRentalAgreement() (value InputPersonalDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.RentalAgreement
|
|
}
|
|
|
|
// InputPassportElementPassportRegistration represents TL type `inputPassportElementPassportRegistration#4e5aa050`.
|
|
type InputPassportElementPassportRegistration struct {
|
|
// The passport registration page to be saved
|
|
PassportRegistration InputPersonalDocument
|
|
}
|
|
|
|
// InputPassportElementPassportRegistrationTypeID is TL type id of InputPassportElementPassportRegistration.
|
|
const InputPassportElementPassportRegistrationTypeID = 0x4e5aa050
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementPassportRegistration) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementPassportRegistration.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementPassportRegistration{}
|
|
_ bin.Decoder = &InputPassportElementPassportRegistration{}
|
|
_ bin.BareEncoder = &InputPassportElementPassportRegistration{}
|
|
_ bin.BareDecoder = &InputPassportElementPassportRegistration{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementPassportRegistration{}
|
|
)
|
|
|
|
func (i *InputPassportElementPassportRegistration) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.PassportRegistration.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementPassportRegistration) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementPassportRegistration(nil)"
|
|
}
|
|
type Alias InputPassportElementPassportRegistration
|
|
return fmt.Sprintf("InputPassportElementPassportRegistration%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementPassportRegistration) TypeID() uint32 {
|
|
return InputPassportElementPassportRegistrationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementPassportRegistration) TypeName() string {
|
|
return "inputPassportElementPassportRegistration"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementPassportRegistration) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementPassportRegistration",
|
|
ID: InputPassportElementPassportRegistrationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PassportRegistration",
|
|
SchemaName: "passport_registration",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementPassportRegistration) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil")
|
|
}
|
|
b.PutID(InputPassportElementPassportRegistrationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementPassportRegistration) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil")
|
|
}
|
|
if err := i.PassportRegistration.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementPassportRegistration) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementPassportRegistrationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementPassportRegistration) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil")
|
|
}
|
|
{
|
|
if err := i.PassportRegistration.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementPassportRegistration) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementPassportRegistration")
|
|
b.Comma()
|
|
b.FieldStart("passport_registration")
|
|
if err := i.PassportRegistration.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementPassportRegistration) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementPassportRegistration"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: %w", err)
|
|
}
|
|
case "passport_registration":
|
|
if err := i.PassportRegistration.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPassportRegistration returns value of PassportRegistration field.
|
|
func (i *InputPassportElementPassportRegistration) GetPassportRegistration() (value InputPersonalDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PassportRegistration
|
|
}
|
|
|
|
// InputPassportElementTemporaryRegistration represents TL type `inputPassportElementTemporaryRegistration#8df64de1`.
|
|
type InputPassportElementTemporaryRegistration struct {
|
|
// The temporary registration document to be saved
|
|
TemporaryRegistration InputPersonalDocument
|
|
}
|
|
|
|
// InputPassportElementTemporaryRegistrationTypeID is TL type id of InputPassportElementTemporaryRegistration.
|
|
const InputPassportElementTemporaryRegistrationTypeID = 0x8df64de1
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementTemporaryRegistration) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementTemporaryRegistration.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementTemporaryRegistration{}
|
|
_ bin.Decoder = &InputPassportElementTemporaryRegistration{}
|
|
_ bin.BareEncoder = &InputPassportElementTemporaryRegistration{}
|
|
_ bin.BareDecoder = &InputPassportElementTemporaryRegistration{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementTemporaryRegistration{}
|
|
)
|
|
|
|
func (i *InputPassportElementTemporaryRegistration) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.TemporaryRegistration.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementTemporaryRegistration) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementTemporaryRegistration(nil)"
|
|
}
|
|
type Alias InputPassportElementTemporaryRegistration
|
|
return fmt.Sprintf("InputPassportElementTemporaryRegistration%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementTemporaryRegistration) TypeID() uint32 {
|
|
return InputPassportElementTemporaryRegistrationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementTemporaryRegistration) TypeName() string {
|
|
return "inputPassportElementTemporaryRegistration"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementTemporaryRegistration) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementTemporaryRegistration",
|
|
ID: InputPassportElementTemporaryRegistrationTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "TemporaryRegistration",
|
|
SchemaName: "temporary_registration",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementTemporaryRegistration) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil")
|
|
}
|
|
b.PutID(InputPassportElementTemporaryRegistrationTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementTemporaryRegistration) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil")
|
|
}
|
|
if err := i.TemporaryRegistration.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementTemporaryRegistration) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementTemporaryRegistrationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementTemporaryRegistration) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil")
|
|
}
|
|
{
|
|
if err := i.TemporaryRegistration.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementTemporaryRegistration) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementTemporaryRegistration")
|
|
b.Comma()
|
|
b.FieldStart("temporary_registration")
|
|
if err := i.TemporaryRegistration.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementTemporaryRegistration) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementTemporaryRegistration"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: %w", err)
|
|
}
|
|
case "temporary_registration":
|
|
if err := i.TemporaryRegistration.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetTemporaryRegistration returns value of TemporaryRegistration field.
|
|
func (i *InputPassportElementTemporaryRegistration) GetTemporaryRegistration() (value InputPersonalDocument) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.TemporaryRegistration
|
|
}
|
|
|
|
// InputPassportElementPhoneNumber represents TL type `inputPassportElementPhoneNumber#4ea3cc39`.
|
|
type InputPassportElementPhoneNumber struct {
|
|
// The phone number to be saved
|
|
PhoneNumber string
|
|
}
|
|
|
|
// InputPassportElementPhoneNumberTypeID is TL type id of InputPassportElementPhoneNumber.
|
|
const InputPassportElementPhoneNumberTypeID = 0x4ea3cc39
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementPhoneNumber) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementPhoneNumber.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementPhoneNumber{}
|
|
_ bin.Decoder = &InputPassportElementPhoneNumber{}
|
|
_ bin.BareEncoder = &InputPassportElementPhoneNumber{}
|
|
_ bin.BareDecoder = &InputPassportElementPhoneNumber{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementPhoneNumber{}
|
|
)
|
|
|
|
func (i *InputPassportElementPhoneNumber) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.PhoneNumber == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementPhoneNumber) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementPhoneNumber(nil)"
|
|
}
|
|
type Alias InputPassportElementPhoneNumber
|
|
return fmt.Sprintf("InputPassportElementPhoneNumber%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementPhoneNumber) TypeID() uint32 {
|
|
return InputPassportElementPhoneNumberTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementPhoneNumber) TypeName() string {
|
|
return "inputPassportElementPhoneNumber"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementPhoneNumber) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementPhoneNumber",
|
|
ID: InputPassportElementPhoneNumberTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PhoneNumber",
|
|
SchemaName: "phone_number",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementPhoneNumber) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil")
|
|
}
|
|
b.PutID(InputPassportElementPhoneNumberTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementPhoneNumber) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil")
|
|
}
|
|
b.PutString(i.PhoneNumber)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementPhoneNumber) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementPhoneNumberTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementPhoneNumber) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: field phone_number: %w", err)
|
|
}
|
|
i.PhoneNumber = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementPhoneNumber")
|
|
b.Comma()
|
|
b.FieldStart("phone_number")
|
|
b.PutString(i.PhoneNumber)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementPhoneNumber"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: %w", err)
|
|
}
|
|
case "phone_number":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: field phone_number: %w", err)
|
|
}
|
|
i.PhoneNumber = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPhoneNumber returns value of PhoneNumber field.
|
|
func (i *InputPassportElementPhoneNumber) GetPhoneNumber() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.PhoneNumber
|
|
}
|
|
|
|
// InputPassportElementEmailAddress represents TL type `inputPassportElementEmailAddress#f12e9425`.
|
|
type InputPassportElementEmailAddress struct {
|
|
// The email address to be saved
|
|
EmailAddress string
|
|
}
|
|
|
|
// InputPassportElementEmailAddressTypeID is TL type id of InputPassportElementEmailAddress.
|
|
const InputPassportElementEmailAddressTypeID = 0xf12e9425
|
|
|
|
// construct implements constructor of InputPassportElementClass.
|
|
func (i InputPassportElementEmailAddress) construct() InputPassportElementClass { return &i }
|
|
|
|
// Ensuring interfaces in compile-time for InputPassportElementEmailAddress.
|
|
var (
|
|
_ bin.Encoder = &InputPassportElementEmailAddress{}
|
|
_ bin.Decoder = &InputPassportElementEmailAddress{}
|
|
_ bin.BareEncoder = &InputPassportElementEmailAddress{}
|
|
_ bin.BareDecoder = &InputPassportElementEmailAddress{}
|
|
|
|
_ InputPassportElementClass = &InputPassportElementEmailAddress{}
|
|
)
|
|
|
|
func (i *InputPassportElementEmailAddress) Zero() bool {
|
|
if i == nil {
|
|
return true
|
|
}
|
|
if !(i.EmailAddress == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (i *InputPassportElementEmailAddress) String() string {
|
|
if i == nil {
|
|
return "InputPassportElementEmailAddress(nil)"
|
|
}
|
|
type Alias InputPassportElementEmailAddress
|
|
return fmt.Sprintf("InputPassportElementEmailAddress%+v", Alias(*i))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*InputPassportElementEmailAddress) TypeID() uint32 {
|
|
return InputPassportElementEmailAddressTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*InputPassportElementEmailAddress) TypeName() string {
|
|
return "inputPassportElementEmailAddress"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (i *InputPassportElementEmailAddress) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "inputPassportElementEmailAddress",
|
|
ID: InputPassportElementEmailAddressTypeID,
|
|
}
|
|
if i == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "EmailAddress",
|
|
SchemaName: "email_address",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (i *InputPassportElementEmailAddress) Encode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil")
|
|
}
|
|
b.PutID(InputPassportElementEmailAddressTypeID)
|
|
return i.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (i *InputPassportElementEmailAddress) EncodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil")
|
|
}
|
|
b.PutString(i.EmailAddress)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (i *InputPassportElementEmailAddress) Decode(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil")
|
|
}
|
|
if err := b.ConsumeID(InputPassportElementEmailAddressTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: %w", err)
|
|
}
|
|
return i.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (i *InputPassportElementEmailAddress) DecodeBare(b *bin.Buffer) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: field email_address: %w", err)
|
|
}
|
|
i.EmailAddress = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (i *InputPassportElementEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("inputPassportElementEmailAddress")
|
|
b.Comma()
|
|
b.FieldStart("email_address")
|
|
b.PutString(i.EmailAddress)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (i *InputPassportElementEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if i == nil {
|
|
return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("inputPassportElementEmailAddress"); err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: %w", err)
|
|
}
|
|
case "email_address":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: field email_address: %w", err)
|
|
}
|
|
i.EmailAddress = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetEmailAddress returns value of EmailAddress field.
|
|
func (i *InputPassportElementEmailAddress) GetEmailAddress() (value string) {
|
|
if i == nil {
|
|
return
|
|
}
|
|
return i.EmailAddress
|
|
}
|
|
|
|
// InputPassportElementClassName is schema name of InputPassportElementClass.
|
|
const InputPassportElementClassName = "InputPassportElement"
|
|
|
|
// InputPassportElementClass represents InputPassportElement generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeInputPassportElement(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.InputPassportElementPersonalDetails: // inputPassportElementPersonalDetails#9d2843f
|
|
// case *tdapi.InputPassportElementPassport: // inputPassportElementPassport#e2603564
|
|
// case *tdapi.InputPassportElementDriverLicense: // inputPassportElementDriverLicense#122b14d0
|
|
// case *tdapi.InputPassportElementIdentityCard: // inputPassportElementIdentityCard#ff67f882
|
|
// case *tdapi.InputPassportElementInternalPassport: // inputPassportElementInternalPassport#2aa3872b
|
|
// case *tdapi.InputPassportElementAddress: // inputPassportElementAddress#1b83ec10
|
|
// case *tdapi.InputPassportElementUtilityBill: // inputPassportElementUtilityBill#52cd9181
|
|
// case *tdapi.InputPassportElementBankStatement: // inputPassportElementBankStatement#fe6a5788
|
|
// case *tdapi.InputPassportElementRentalAgreement: // inputPassportElementRentalAgreement#677b9c2b
|
|
// case *tdapi.InputPassportElementPassportRegistration: // inputPassportElementPassportRegistration#4e5aa050
|
|
// case *tdapi.InputPassportElementTemporaryRegistration: // inputPassportElementTemporaryRegistration#8df64de1
|
|
// case *tdapi.InputPassportElementPhoneNumber: // inputPassportElementPhoneNumber#4ea3cc39
|
|
// case *tdapi.InputPassportElementEmailAddress: // inputPassportElementEmailAddress#f12e9425
|
|
// default: panic(v)
|
|
// }
|
|
type InputPassportElementClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() InputPassportElementClass
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
TypeID() uint32
|
|
// TypeName returns name of type in TL schema.
|
|
TypeName() string
|
|
// String implements fmt.Stringer.
|
|
String() string
|
|
// Zero returns true if current object has a zero value.
|
|
Zero() bool
|
|
|
|
EncodeTDLibJSON(b tdjson.Encoder) error
|
|
DecodeTDLibJSON(b tdjson.Decoder) error
|
|
}
|
|
|
|
// DecodeInputPassportElement implements binary de-serialization for InputPassportElementClass.
|
|
func DecodeInputPassportElement(buf *bin.Buffer) (InputPassportElementClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case InputPassportElementPersonalDetailsTypeID:
|
|
// Decoding inputPassportElementPersonalDetails#9d2843f.
|
|
v := InputPassportElementPersonalDetails{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementPassportTypeID:
|
|
// Decoding inputPassportElementPassport#e2603564.
|
|
v := InputPassportElementPassport{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementDriverLicenseTypeID:
|
|
// Decoding inputPassportElementDriverLicense#122b14d0.
|
|
v := InputPassportElementDriverLicense{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementIdentityCardTypeID:
|
|
// Decoding inputPassportElementIdentityCard#ff67f882.
|
|
v := InputPassportElementIdentityCard{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementInternalPassportTypeID:
|
|
// Decoding inputPassportElementInternalPassport#2aa3872b.
|
|
v := InputPassportElementInternalPassport{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementAddressTypeID:
|
|
// Decoding inputPassportElementAddress#1b83ec10.
|
|
v := InputPassportElementAddress{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementUtilityBillTypeID:
|
|
// Decoding inputPassportElementUtilityBill#52cd9181.
|
|
v := InputPassportElementUtilityBill{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementBankStatementTypeID:
|
|
// Decoding inputPassportElementBankStatement#fe6a5788.
|
|
v := InputPassportElementBankStatement{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementRentalAgreementTypeID:
|
|
// Decoding inputPassportElementRentalAgreement#677b9c2b.
|
|
v := InputPassportElementRentalAgreement{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementPassportRegistrationTypeID:
|
|
// Decoding inputPassportElementPassportRegistration#4e5aa050.
|
|
v := InputPassportElementPassportRegistration{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementTemporaryRegistrationTypeID:
|
|
// Decoding inputPassportElementTemporaryRegistration#8df64de1.
|
|
v := InputPassportElementTemporaryRegistration{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementPhoneNumberTypeID:
|
|
// Decoding inputPassportElementPhoneNumber#4ea3cc39.
|
|
v := InputPassportElementPhoneNumber{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case InputPassportElementEmailAddressTypeID:
|
|
// Decoding inputPassportElementEmailAddress#f12e9425.
|
|
v := InputPassportElementEmailAddress{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONInputPassportElement implements binary de-serialization for InputPassportElementClass.
|
|
func DecodeTDLibJSONInputPassportElement(buf tdjson.Decoder) (InputPassportElementClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "inputPassportElementPersonalDetails":
|
|
// Decoding inputPassportElementPersonalDetails#9d2843f.
|
|
v := InputPassportElementPersonalDetails{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementPassport":
|
|
// Decoding inputPassportElementPassport#e2603564.
|
|
v := InputPassportElementPassport{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementDriverLicense":
|
|
// Decoding inputPassportElementDriverLicense#122b14d0.
|
|
v := InputPassportElementDriverLicense{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementIdentityCard":
|
|
// Decoding inputPassportElementIdentityCard#ff67f882.
|
|
v := InputPassportElementIdentityCard{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementInternalPassport":
|
|
// Decoding inputPassportElementInternalPassport#2aa3872b.
|
|
v := InputPassportElementInternalPassport{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementAddress":
|
|
// Decoding inputPassportElementAddress#1b83ec10.
|
|
v := InputPassportElementAddress{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementUtilityBill":
|
|
// Decoding inputPassportElementUtilityBill#52cd9181.
|
|
v := InputPassportElementUtilityBill{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementBankStatement":
|
|
// Decoding inputPassportElementBankStatement#fe6a5788.
|
|
v := InputPassportElementBankStatement{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementRentalAgreement":
|
|
// Decoding inputPassportElementRentalAgreement#677b9c2b.
|
|
v := InputPassportElementRentalAgreement{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementPassportRegistration":
|
|
// Decoding inputPassportElementPassportRegistration#4e5aa050.
|
|
v := InputPassportElementPassportRegistration{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementTemporaryRegistration":
|
|
// Decoding inputPassportElementTemporaryRegistration#8df64de1.
|
|
v := InputPassportElementTemporaryRegistration{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementPhoneNumber":
|
|
// Decoding inputPassportElementPhoneNumber#4ea3cc39.
|
|
v := InputPassportElementPhoneNumber{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "inputPassportElementEmailAddress":
|
|
// Decoding inputPassportElementEmailAddress#f12e9425.
|
|
v := InputPassportElementEmailAddress{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// InputPassportElement boxes the InputPassportElementClass providing a helper.
|
|
type InputPassportElementBox struct {
|
|
InputPassportElement InputPassportElementClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for InputPassportElementBox.
|
|
func (b *InputPassportElementBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputPassportElementBox to nil")
|
|
}
|
|
v, err := DecodeInputPassportElement(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputPassportElement = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for InputPassportElementBox.
|
|
func (b *InputPassportElementBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.InputPassportElement == nil {
|
|
return fmt.Errorf("unable to encode InputPassportElementClass as nil")
|
|
}
|
|
return b.InputPassportElement.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for InputPassportElementBox.
|
|
func (b *InputPassportElementBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode InputPassportElementBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONInputPassportElement(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.InputPassportElement = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for InputPassportElementBox.
|
|
func (b *InputPassportElementBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.InputPassportElement == nil {
|
|
return fmt.Errorf("unable to encode InputPassportElementClass as nil")
|
|
}
|
|
return b.InputPassportElement.EncodeTDLibJSON(buf)
|
|
}
|