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

// PaymentsGetStarGiftAuctionAcquiredGiftsRequest represents TL type `payments.getStarGiftAuctionAcquiredGifts#6ba2cbec`.
// Fetches all the gifts that the current user won in an auction¹.
//
// Links:
//  1. https://core.telegram.org/api/auctions
//
// See https://core.telegram.org/method/payments.getStarGiftAuctionAcquiredGifts for reference.
type PaymentsGetStarGiftAuctionAcquiredGiftsRequest struct {
	// The gift ID linked to the auction.
	GiftID int64
}

// PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID is TL type id of PaymentsGetStarGiftAuctionAcquiredGiftsRequest.
const PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID = 0x6ba2cbec

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

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

	return true
}

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

// FillFrom fills PaymentsGetStarGiftAuctionAcquiredGiftsRequest from given interface.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) ( interface {
	() ( int64)
}) {
	.GiftID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getStarGiftAuctionAcquiredGifts",
		ID:   PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GiftID",
			SchemaName: "gift_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftAuctionAcquiredGifts#6ba2cbec as nil")
	}
	.PutID(PaymentsGetStarGiftAuctionAcquiredGiftsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGiftAuctionAcquiredGifts#6ba2cbec as nil")
	}
	.PutLong(.GiftID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarGiftAuctionAcquiredGifts#6ba2cbec to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getStarGiftAuctionAcquiredGifts#6ba2cbec: field gift_id: %w", )
		}
		.GiftID = 
	}
	return nil
}

// GetGiftID returns value of GiftID field.
func ( *PaymentsGetStarGiftAuctionAcquiredGiftsRequest) () ( int64) {
	if  == nil {
		return
	}
	return .GiftID
}

// PaymentsGetStarGiftAuctionAcquiredGifts invokes method payments.getStarGiftAuctionAcquiredGifts#6ba2cbec returning error if any.
// Fetches all the gifts that the current user won in an auction¹.
//
// Links:
//  1. https://core.telegram.org/api/auctions
//
// Possible errors:
//
//	400 STARGIFT_INVALID: The passed gift is invalid.
//
// See https://core.telegram.org/method/payments.getStarGiftAuctionAcquiredGifts for reference.
func ( *Client) ( context.Context,  int64) (*PaymentsStarGiftAuctionAcquiredGifts, error) {
	var  PaymentsStarGiftAuctionAcquiredGifts

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