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

// PaymentsGetStarGiftActiveAuctionsRequest represents TL type `payments.getStarGiftActiveAuctions#a5d0514d`.
// Fetches all currently active gift auctions¹ where the user has placed a bid.
//
// Links:
//  1. https://core.telegram.org/api/auctions
//
// See https://core.telegram.org/method/payments.getStarGiftActiveAuctions for reference.
type PaymentsGetStarGiftActiveAuctionsRequest struct {
	// Hash generated as specified here »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/auctions
	Hash int64
}

// PaymentsGetStarGiftActiveAuctionsRequestTypeID is TL type id of PaymentsGetStarGiftActiveAuctionsRequest.
const PaymentsGetStarGiftActiveAuctionsRequestTypeID = 0xa5d0514d

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

func ( *PaymentsGetStarGiftActiveAuctionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetStarGiftActiveAuctionsRequest from given interface.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) ( interface {
	() ( int64)
}) {
	.Hash = .()
}

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

// TypeName returns name of type in TL schema.
func (*PaymentsGetStarGiftActiveAuctionsRequest) () string {
	return "payments.getStarGiftActiveAuctions"
}

// TypeInfo returns info about TL type.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getStarGiftActiveAuctions",
		ID:   PaymentsGetStarGiftActiveAuctionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftActiveAuctions#a5d0514d as nil")
	}
	.PutID(PaymentsGetStarGiftActiveAuctionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftActiveAuctions#a5d0514d as nil")
	}
	.PutLong(.Hash)
	return nil
}

// Decode implements bin.Decoder.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarGiftActiveAuctions#a5d0514d to nil")
	}
	if  := .ConsumeID(PaymentsGetStarGiftActiveAuctionsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getStarGiftActiveAuctions#a5d0514d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarGiftActiveAuctions#a5d0514d to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getStarGiftActiveAuctions#a5d0514d: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetHash returns value of Hash field.
func ( *PaymentsGetStarGiftActiveAuctionsRequest) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// PaymentsGetStarGiftActiveAuctions invokes method payments.getStarGiftActiveAuctions#a5d0514d returning error if any.
// Fetches all currently active gift auctions¹ where the user has placed a bid.
//
// Links:
//  1. https://core.telegram.org/api/auctions
//
// See https://core.telegram.org/method/payments.getStarGiftActiveAuctions for reference.
func ( *Client) ( context.Context,  int64) (PaymentsStarGiftActiveAuctionsClass, error) {
	var  PaymentsStarGiftActiveAuctionsBox

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