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

// PaymentsGetStarGiftsRequest represents TL type `payments.getStarGifts#c4563590`.
// Get a list of available gifts, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts
//
// See https://core.telegram.org/method/payments.getStarGifts for reference.
type PaymentsGetStarGiftsRequest struct {
	// Hash used for caching, for more info click here¹.The hash may be generated locally by
	// using the ids of the returned or stored sticker starGift²s.
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	//  2) https://core.telegram.org/constructor/starGift
	Hash int
}

// PaymentsGetStarGiftsRequestTypeID is TL type id of PaymentsGetStarGiftsRequest.
const PaymentsGetStarGiftsRequestTypeID = 0xc4563590

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

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

	return true
}

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

// FillFrom fills PaymentsGetStarGiftsRequest from given interface.
func ( *PaymentsGetStarGiftsRequest) ( interface {
	() ( int)
}) {
	.Hash = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *PaymentsGetStarGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGifts#c4563590 as nil")
	}
	.PutID(PaymentsGetStarGiftsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarGiftsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarGifts#c4563590 as nil")
	}
	.PutInt(.Hash)
	return nil
}

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

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

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

// PaymentsGetStarGifts invokes method payments.getStarGifts#c4563590 returning error if any.
// Get a list of available gifts, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/gifts
//
// See https://core.telegram.org/method/payments.getStarGifts for reference.
func ( *Client) ( context.Context,  int) (PaymentsStarGiftsClass, error) {
	var  PaymentsStarGiftsBox

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