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

// PremiumGetBoostsListRequest represents TL type `premium.getBoostsList#60f67660`.
// Obtains info about the boosts that were applied to a certain channel (admins only)
//
// See https://core.telegram.org/method/premium.getBoostsList for reference.
type PremiumGetBoostsListRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to return only info about boosts received from gift codes and giveaways
	// created by the channel »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/giveaways
	Gifts bool
	// The channel
	Peer InputPeerClass
	// Offset for pagination, obtained from premium.boostsList¹.next_offset
	//
	// Links:
	//  1) https://core.telegram.org/constructor/premium.boostsList
	Offset string
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// PremiumGetBoostsListRequestTypeID is TL type id of PremiumGetBoostsListRequest.
const PremiumGetBoostsListRequestTypeID = 0x60f67660

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

func ( *PremiumGetBoostsListRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Gifts == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PremiumGetBoostsListRequest from given interface.
func ( *PremiumGetBoostsListRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( string)
	() ( int)
}) {
	.Gifts = .()
	.Peer = .()
	.Offset = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*PremiumGetBoostsListRequest) () string {
	return "premium.getBoostsList"
}

// TypeInfo returns info about TL type.
func ( *PremiumGetBoostsListRequest) () tdp.Type {
	 := tdp.Type{
		Name: "premium.getBoostsList",
		ID:   PremiumGetBoostsListRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Gifts",
			SchemaName: "gifts",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PremiumGetBoostsListRequest) () {
	if !(.Gifts == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *PremiumGetBoostsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode premium.getBoostsList#60f67660 as nil")
	}
	.PutID(PremiumGetBoostsListRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PremiumGetBoostsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode premium.getBoostsList#60f67660 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode premium.getBoostsList#60f67660: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode premium.getBoostsList#60f67660: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode premium.getBoostsList#60f67660: field peer: %w", )
	}
	.PutString(.Offset)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *PremiumGetBoostsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode premium.getBoostsList#60f67660 to nil")
	}
	if  := .ConsumeID(PremiumGetBoostsListRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode premium.getBoostsList#60f67660: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PremiumGetBoostsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode premium.getBoostsList#60f67660 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode premium.getBoostsList#60f67660: field flags: %w", )
		}
	}
	.Gifts = .Flags.Has(0)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode premium.getBoostsList#60f67660: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode premium.getBoostsList#60f67660: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode premium.getBoostsList#60f67660: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetGifts sets value of Gifts conditional field.
func ( *PremiumGetBoostsListRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Gifts = true
	} else {
		.Flags.Unset(0)
		.Gifts = false
	}
}

// GetGifts returns value of Gifts conditional field.
func ( *PremiumGetBoostsListRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetPeer returns value of Peer field.
func ( *PremiumGetBoostsListRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

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

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

// PremiumGetBoostsList invokes method premium.getBoostsList#60f67660 returning error if any.
// Obtains info about the boosts that were applied to a certain channel (admins only)
//
// Possible errors:
//
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/premium.getBoostsList for reference.
func ( *Client) ( context.Context,  *PremiumGetBoostsListRequest) (*PremiumBoostsList, error) {
	var  PremiumBoostsList

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