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

// StickersRenameStickerSetRequest represents TL type `stickers.renameStickerSet#124b1c00`.
// Renames a stickerset, bots only.
//
// See https://core.telegram.org/method/stickers.renameStickerSet for reference.
type StickersRenameStickerSetRequest struct {
	// Stickerset to rename
	Stickerset InputStickerSetClass
	// New stickerset title
	Title string
}

// StickersRenameStickerSetRequestTypeID is TL type id of StickersRenameStickerSetRequest.
const StickersRenameStickerSetRequestTypeID = 0x124b1c00

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

func ( *StickersRenameStickerSetRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Stickerset == nil) {
		return false
	}
	if !(.Title == "") {
		return false
	}

	return true
}

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

// FillFrom fills StickersRenameStickerSetRequest from given interface.
func ( *StickersRenameStickerSetRequest) ( interface {
	() ( InputStickerSetClass)
	() ( string)
}) {
	.Stickerset = .()
	.Title = .()
}

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

// TypeName returns name of type in TL schema.
func (*StickersRenameStickerSetRequest) () string {
	return "stickers.renameStickerSet"
}

// TypeInfo returns info about TL type.
func ( *StickersRenameStickerSetRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stickers.renameStickerSet",
		ID:   StickersRenameStickerSetRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Stickerset",
			SchemaName: "stickerset",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StickersRenameStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.renameStickerSet#124b1c00 as nil")
	}
	.PutID(StickersRenameStickerSetRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickersRenameStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.renameStickerSet#124b1c00 as nil")
	}
	if .Stickerset == nil {
		return fmt.Errorf("unable to encode stickers.renameStickerSet#124b1c00: field stickerset is nil")
	}
	if  := .Stickerset.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.renameStickerSet#124b1c00: field stickerset: %w", )
	}
	.PutString(.Title)
	return nil
}

// Decode implements bin.Decoder.
func ( *StickersRenameStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.renameStickerSet#124b1c00 to nil")
	}
	if  := .ConsumeID(StickersRenameStickerSetRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode stickers.renameStickerSet#124b1c00: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StickersRenameStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.renameStickerSet#124b1c00 to nil")
	}
	{
		,  := DecodeInputStickerSet()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.renameStickerSet#124b1c00: field stickerset: %w", )
		}
		.Stickerset = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.renameStickerSet#124b1c00: field title: %w", )
		}
		.Title = 
	}
	return nil
}

// GetStickerset returns value of Stickerset field.
func ( *StickersRenameStickerSetRequest) () ( InputStickerSetClass) {
	if  == nil {
		return
	}
	return .Stickerset
}

// GetTitle returns value of Title field.
func ( *StickersRenameStickerSetRequest) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// StickersRenameStickerSet invokes method stickers.renameStickerSet#124b1c00 returning error if any.
// Renames a stickerset, bots only.
//
// Possible errors:
//
//	400 STICKERSET_INVALID: The provided sticker set is invalid.
//
// See https://core.telegram.org/method/stickers.renameStickerSet for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *StickersRenameStickerSetRequest) (MessagesStickerSetClass, error) {
	var  MessagesStickerSetBox

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