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

// WalletGetTransactionsRequest represents TL type `wallet.getTransactions#a8830a83`.
//
// See https://core.telegram.org/method/wallet.getTransactions for reference.
type WalletGetTransactionsRequest struct {
	// Flags field of WalletGetTransactionsRequest.
	Flags bin.Fields
	// Inbound field of WalletGetTransactionsRequest.
	Inbound bool
	// Outbound field of WalletGetTransactionsRequest.
	Outbound bool
	// Offset field of WalletGetTransactionsRequest.
	Offset string
	// Limit field of WalletGetTransactionsRequest.
	Limit int
}

// WalletGetTransactionsRequestTypeID is TL type id of WalletGetTransactionsRequest.
const WalletGetTransactionsRequestTypeID = 0xa8830a83

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

func ( *WalletGetTransactionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Inbound == false) {
		return false
	}
	if !(.Outbound == false) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills WalletGetTransactionsRequest from given interface.
func ( *WalletGetTransactionsRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( string)
	() ( int)
}) {
	.Inbound = .()
	.Outbound = .()
	.Offset = .()
	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *WalletGetTransactionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.getTransactions",
		ID:   WalletGetTransactionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Inbound",
			SchemaName: "inbound",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Outbound",
			SchemaName: "outbound",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *WalletGetTransactionsRequest) () {
	if !(.Inbound == false) {
		.Flags.Set(0)
	}
	if !(.Outbound == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *WalletGetTransactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.getTransactions#a8830a83 as nil")
	}
	.PutID(WalletGetTransactionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletGetTransactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.getTransactions#a8830a83 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode wallet.getTransactions#a8830a83: field flags: %w", )
	}
	.PutString(.Offset)
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WalletGetTransactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.getTransactions#a8830a83 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode wallet.getTransactions#a8830a83: field flags: %w", )
		}
	}
	.Inbound = .Flags.Has(0)
	.Outbound = .Flags.Has(1)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.getTransactions#a8830a83: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.getTransactions#a8830a83: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetInbound sets value of Inbound conditional field.
func ( *WalletGetTransactionsRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Inbound = true
	} else {
		.Flags.Unset(0)
		.Inbound = false
	}
}

// GetInbound returns value of Inbound conditional field.
func ( *WalletGetTransactionsRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetOutbound sets value of Outbound conditional field.
func ( *WalletGetTransactionsRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.Outbound = true
	} else {
		.Flags.Unset(1)
		.Outbound = false
	}
}

// GetOutbound returns value of Outbound conditional field.
func ( *WalletGetTransactionsRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// GetOffset returns value of Offset field.
func ( *WalletGetTransactionsRequest) () ( string) {
	if  == nil {
		return
	}
	return .Offset
}

// GetLimit returns value of Limit field.
func ( *WalletGetTransactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// WalletGetTransactions invokes method wallet.getTransactions#a8830a83 returning error if any.
//
// See https://core.telegram.org/method/wallet.getTransactions for reference.
func ( *Client) ( context.Context,  *WalletGetTransactionsRequest) (*WalletTransactions, error) {
	var  WalletTransactions

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