// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// 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{}
)

// AuthImportLoginTokenRequest represents TL type `auth.importLoginToken#95ac5ce4`.
// Login using a redirected login token, generated in case of DC mismatch during QR code
// login¹.
// For more info, see login via QR code¹.
//
// Links:
//  1. https://core.telegram.org/api/qr-login
//  2. https://core.telegram.org/api/qr-login
//
// See https://core.telegram.org/method/auth.importLoginToken for reference.
type AuthImportLoginTokenRequest struct {
	// Login token
	Token []byte
}

// AuthImportLoginTokenRequestTypeID is TL type id of AuthImportLoginTokenRequest.
const AuthImportLoginTokenRequestTypeID = 0x95ac5ce4

// Ensuring interfaces in compile-time for AuthImportLoginTokenRequest.
var (
	_ bin.Encoder     = &AuthImportLoginTokenRequest{}
	_ bin.Decoder     = &AuthImportLoginTokenRequest{}
	_ bin.BareEncoder = &AuthImportLoginTokenRequest{}
	_ bin.BareDecoder = &AuthImportLoginTokenRequest{}
)

func ( *AuthImportLoginTokenRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Token == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *AuthImportLoginTokenRequest) () string {
	if  == nil {
		return "AuthImportLoginTokenRequest(nil)"
	}
	type  AuthImportLoginTokenRequest
	return fmt.Sprintf("AuthImportLoginTokenRequest%+v", (*))
}

// FillFrom fills AuthImportLoginTokenRequest from given interface.
func ( *AuthImportLoginTokenRequest) ( interface {
	() ( []byte)
}) {
	.Token = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*AuthImportLoginTokenRequest) () uint32 {
	return AuthImportLoginTokenRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*AuthImportLoginTokenRequest) () string {
	return "auth.importLoginToken"
}

// TypeInfo returns info about TL type.
func ( *AuthImportLoginTokenRequest) () tdp.Type {
	 := tdp.Type{
		Name: "auth.importLoginToken",
		ID:   AuthImportLoginTokenRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Token",
			SchemaName: "token",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthImportLoginTokenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.importLoginToken#95ac5ce4 as nil")
	}
	.PutID(AuthImportLoginTokenRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthImportLoginTokenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.importLoginToken#95ac5ce4 as nil")
	}
	.PutBytes(.Token)
	return nil
}

// Decode implements bin.Decoder.
func ( *AuthImportLoginTokenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.importLoginToken#95ac5ce4 to nil")
	}
	if  := .ConsumeID(AuthImportLoginTokenRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode auth.importLoginToken#95ac5ce4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AuthImportLoginTokenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.importLoginToken#95ac5ce4 to nil")
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode auth.importLoginToken#95ac5ce4: field token: %w", )
		}
		.Token = 
	}
	return nil
}

// GetToken returns value of Token field.
func ( *AuthImportLoginTokenRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Token
}

// AuthImportLoginToken invokes method auth.importLoginToken#95ac5ce4 returning error if any.
// Login using a redirected login token, generated in case of DC mismatch during QR code
// login¹.
// For more info, see login via QR code¹.
//
// Links:
//  1. https://core.telegram.org/api/qr-login
//  2. https://core.telegram.org/api/qr-login
//
// Possible errors:
//
//	400 AUTH_TOKEN_ALREADY_ACCEPTED: The specified auth token was already accepted.
//	400 AUTH_TOKEN_EXPIRED: The authorization token has expired.
//	400 AUTH_TOKEN_INVALID: The specified auth token is invalid.
//	400 AUTH_TOKEN_INVALIDX: The specified auth token is invalid.
//	500 MEMBER_NOT_FOUND:
//
// See https://core.telegram.org/method/auth.importLoginToken for reference.
func ( *Client) ( context.Context,  []byte) (AuthLoginTokenClass, error) {
	var  AuthLoginTokenBox

	 := &AuthImportLoginTokenRequest{
		Token: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .LoginToken, nil
}