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

// WalletTonConnectGetPendingRequest represents TL type `wallet.tonConnectGetPending#11aee065`.
//
// See https://core.telegram.org/method/wallet.tonConnectGetPending for reference.
type WalletTonConnectGetPendingRequest struct {
	// Flags field of WalletTonConnectGetPendingRequest.
	Flags bin.Fields
	// DappClientID field of WalletTonConnectGetPendingRequest.
	//
	// Use SetDappClientID and GetDappClientID helpers.
	DappClientID string
	// SessionID field of WalletTonConnectGetPendingRequest.
	//
	// Use SetSessionID and GetSessionID helpers.
	SessionID int64
}

// WalletTonConnectGetPendingRequestTypeID is TL type id of WalletTonConnectGetPendingRequest.
const WalletTonConnectGetPendingRequestTypeID = 0x11aee065

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

func ( *WalletTonConnectGetPendingRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.DappClientID == "") {
		return false
	}
	if !(.SessionID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills WalletTonConnectGetPendingRequest from given interface.
func ( *WalletTonConnectGetPendingRequest) ( interface {
	() ( string,  bool)
	() ( int64,  bool)
}) {
	if ,  := .();  {
		.DappClientID = 
	}

	if ,  := .();  {
		.SessionID = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*WalletTonConnectGetPendingRequest) () string {
	return "wallet.tonConnectGetPending"
}

// TypeInfo returns info about TL type.
func ( *WalletTonConnectGetPendingRequest) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.tonConnectGetPending",
		ID:   WalletTonConnectGetPendingRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DappClientID",
			SchemaName: "dapp_client_id",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "SessionID",
			SchemaName: "session_id",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *WalletTonConnectGetPendingRequest) () {
	if !(.DappClientID == "") {
		.Flags.Set(0)
	}
	if !(.SessionID == 0) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *WalletTonConnectGetPendingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.tonConnectGetPending#11aee065 as nil")
	}
	.PutID(WalletTonConnectGetPendingRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletTonConnectGetPendingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.tonConnectGetPending#11aee065 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode wallet.tonConnectGetPending#11aee065: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutString(.DappClientID)
	}
	if .Flags.Has(1) {
		.PutLong(.SessionID)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *WalletTonConnectGetPendingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.tonConnectGetPending#11aee065 to nil")
	}
	if  := .ConsumeID(WalletTonConnectGetPendingRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode wallet.tonConnectGetPending#11aee065: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *WalletTonConnectGetPendingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.tonConnectGetPending#11aee065 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectGetPending#11aee065: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectGetPending#11aee065: field dapp_client_id: %w", )
		}
		.DappClientID = 
	}
	if .Flags.Has(1) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectGetPending#11aee065: field session_id: %w", )
		}
		.SessionID = 
	}
	return nil
}

// SetDappClientID sets value of DappClientID conditional field.
func ( *WalletTonConnectGetPendingRequest) ( string) {
	.Flags.Set(0)
	.DappClientID = 
}

// GetDappClientID returns value of DappClientID conditional field and
// boolean which is true if field was set.
func ( *WalletTonConnectGetPendingRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .DappClientID, true
}

// SetSessionID sets value of SessionID conditional field.
func ( *WalletTonConnectGetPendingRequest) ( int64) {
	.Flags.Set(1)
	.SessionID = 
}

// GetSessionID returns value of SessionID conditional field and
// boolean which is true if field was set.
func ( *WalletTonConnectGetPendingRequest) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .SessionID, true
}

// WalletTonConnectGetPending invokes method wallet.tonConnectGetPending#11aee065 returning error if any.
//
// See https://core.telegram.org/method/wallet.tonConnectGetPending for reference.
func ( *Client) ( context.Context,  *WalletTonConnectGetPendingRequest) (*WalletTonConnectPending, error) {
	var  WalletTonConnectPending

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