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

// ChannelsSetBoostsToUnblockRestrictionsRequest represents TL type `channels.setBoostsToUnblockRestrictions#ad399cee`.
// Admins with ban_users admin rights »¹ may allow users that apply a certain number of
// booosts »² to the group to bypass slow mode »³ and other »⁴ supergroup
// restrictions, see here »⁵ for more info.
//
// Links:
//  1. https://core.telegram.org/constructor/chatAdminRights
//  2. https://core.telegram.org/api/boost
//  3. https://core.telegram.org/method/channels.toggleSlowMode
//  4. https://core.telegram.org/api/rights#default-rights
//  5. https://core.telegram.org/api/boost#bypass-slowmode-and-chat-restrictions
//
// See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference.
type ChannelsSetBoostsToUnblockRestrictionsRequest struct {
	// The supergroup.
	Channel InputChannelClass
	// The number of required boosts (1-8, 0 to disable).
	Boosts int
}

// ChannelsSetBoostsToUnblockRestrictionsRequestTypeID is TL type id of ChannelsSetBoostsToUnblockRestrictionsRequest.
const ChannelsSetBoostsToUnblockRestrictionsRequestTypeID = 0xad399cee

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

func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == nil) {
		return false
	}
	if !(.Boosts == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelsSetBoostsToUnblockRestrictionsRequest from given interface.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) ( interface {
	() ( InputChannelClass)
	() ( int)
}) {
	.Channel = .()
	.Boosts = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChannelsSetBoostsToUnblockRestrictionsRequest) () string {
	return "channels.setBoostsToUnblockRestrictions"
}

// TypeInfo returns info about TL type.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.setBoostsToUnblockRestrictions",
		ID:   ChannelsSetBoostsToUnblockRestrictionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Boosts",
			SchemaName: "boosts",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil")
	}
	.PutID(ChannelsSetBoostsToUnblockRestrictionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.setBoostsToUnblockRestrictions#ad399cee as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w", )
	}
	.PutInt(.Boosts)
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil")
	}
	if  := .ConsumeID(ChannelsSetBoostsToUnblockRestrictionsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.setBoostsToUnblockRestrictions#ad399cee to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode channels.setBoostsToUnblockRestrictions#ad399cee: field boosts: %w", )
		}
		.Boosts = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) () ( InputChannelClass) {
	if  == nil {
		return
	}
	return .Channel
}

// GetBoosts returns value of Boosts field.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .Boosts
}

// GetChannelAsNotEmpty returns mapped value of Channel field.
func ( *ChannelsSetBoostsToUnblockRestrictionsRequest) () (NotEmptyInputChannel, bool) {
	return .Channel.AsNotEmpty()
}

// ChannelsSetBoostsToUnblockRestrictions invokes method channels.setBoostsToUnblockRestrictions#ad399cee returning error if any.
// Admins with ban_users admin rights »¹ may allow users that apply a certain number of
// booosts »² to the group to bypass slow mode »³ and other »⁴ supergroup
// restrictions, see here »⁵ for more info.
//
// Links:
//  1. https://core.telegram.org/constructor/chatAdminRights
//  2. https://core.telegram.org/api/boost
//  3. https://core.telegram.org/method/channels.toggleSlowMode
//  4. https://core.telegram.org/api/rights#default-rights
//  5. https://core.telegram.org/api/boost#bypass-slowmode-and-chat-restrictions
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//
// See https://core.telegram.org/method/channels.setBoostsToUnblockRestrictions for reference.
func ( *Client) ( context.Context,  *ChannelsSetBoostsToUnblockRestrictionsRequest) (UpdatesClass, error) {
	var  UpdatesBox

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