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

// PaymentsGetCraftStarGiftsRequest represents TL type `payments.getCraftStarGifts#fd05dd00`.
// Obtain owned collectible gifts »¹ of a specific type that can be used for crafting
// »².
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://core.telegram.org/api/gifts#crafting-collectible-gifts
//
// See https://core.telegram.org/method/payments.getCraftStarGifts for reference.
type PaymentsGetCraftStarGiftsRequest struct {
	// Identifier of the base gift type, equal to starGiftUnique¹.gift_id of the first
	// selected gift.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/starGiftUnique
	GiftID int64
	// Offset for pagination.
	Offset string
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// PaymentsGetCraftStarGiftsRequestTypeID is TL type id of PaymentsGetCraftStarGiftsRequest.
const PaymentsGetCraftStarGiftsRequestTypeID = 0xfd05dd00

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

func ( *PaymentsGetCraftStarGiftsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.GiftID == 0) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetCraftStarGiftsRequest from given interface.
func ( *PaymentsGetCraftStarGiftsRequest) ( interface {
	() ( int64)
	() ( string)
	() ( int)
}) {
	.GiftID = .()
	.Offset = .()
	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetCraftStarGiftsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getCraftStarGifts",
		ID:   PaymentsGetCraftStarGiftsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GiftID",
			SchemaName: "gift_id",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetCraftStarGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil")
	}
	.PutID(PaymentsGetCraftStarGiftsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetCraftStarGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getCraftStarGifts#fd05dd00 as nil")
	}
	.PutLong(.GiftID)
	.PutString(.Offset)
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetCraftStarGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getCraftStarGifts#fd05dd00 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field gift_id: %w", )
		}
		.GiftID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getCraftStarGifts#fd05dd00: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

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

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

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

// PaymentsGetCraftStarGifts invokes method payments.getCraftStarGifts#fd05dd00 returning error if any.
// Obtain owned collectible gifts »¹ of a specific type that can be used for crafting
// »².
//
// Links:
//  1. https://core.telegram.org/api/gifts#collectible-gifts
//  2. https://core.telegram.org/api/gifts#crafting-collectible-gifts
//
// Possible errors:
//
//	400 STARGIFT_INVALID: The passed gift is invalid.
//
// See https://core.telegram.org/method/payments.getCraftStarGifts for reference.
func ( *Client) ( context.Context,  *PaymentsGetCraftStarGiftsRequest) (*PaymentsSavedStarGifts, error) {
	var  PaymentsSavedStarGifts

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