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

// MessagesGetArchivedStickersRequest represents TL type `messages.getArchivedStickers#57f17692`.
// Get all archived stickers
//
// See https://core.telegram.org/method/messages.getArchivedStickers for reference.
type MessagesGetArchivedStickersRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Get mask stickers¹
	//
	// Links:
	//  1) https://core.telegram.org/api/stickers#mask-stickers
	Masks bool
	// Get custom emoji stickers¹
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	Emojis bool
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	OffsetID int64
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// MessagesGetArchivedStickersRequestTypeID is TL type id of MessagesGetArchivedStickersRequest.
const MessagesGetArchivedStickersRequestTypeID = 0x57f17692

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

func ( *MessagesGetArchivedStickersRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Masks == false) {
		return false
	}
	if !(.Emojis == false) {
		return false
	}
	if !(.OffsetID == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetArchivedStickersRequest from given interface.
func ( *MessagesGetArchivedStickersRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( int64)
	() ( int)
}) {
	.Masks = .()
	.Emojis = .()
	.OffsetID = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesGetArchivedStickersRequest) () string {
	return "messages.getArchivedStickers"
}

// TypeInfo returns info about TL type.
func ( *MessagesGetArchivedStickersRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getArchivedStickers",
		ID:   MessagesGetArchivedStickersRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Masks",
			SchemaName: "masks",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Emojis",
			SchemaName: "emojis",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "OffsetID",
			SchemaName: "offset_id",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesGetArchivedStickersRequest) () {
	if !(.Masks == false) {
		.Flags.Set(0)
	}
	if !(.Emojis == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesGetArchivedStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getArchivedStickers#57f17692 as nil")
	}
	.PutID(MessagesGetArchivedStickersRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetArchivedStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getArchivedStickers#57f17692 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getArchivedStickers#57f17692: field flags: %w", )
	}
	.PutLong(.OffsetID)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetArchivedStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getArchivedStickers#57f17692 to nil")
	}
	if  := .ConsumeID(MessagesGetArchivedStickersRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getArchivedStickers#57f17692: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetArchivedStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getArchivedStickers#57f17692 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.getArchivedStickers#57f17692: field flags: %w", )
		}
	}
	.Masks = .Flags.Has(0)
	.Emojis = .Flags.Has(1)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getArchivedStickers#57f17692: field offset_id: %w", )
		}
		.OffsetID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getArchivedStickers#57f17692: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetMasks sets value of Masks conditional field.
func ( *MessagesGetArchivedStickersRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Masks = true
	} else {
		.Flags.Unset(0)
		.Masks = false
	}
}

// GetMasks returns value of Masks conditional field.
func ( *MessagesGetArchivedStickersRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetEmojis sets value of Emojis conditional field.
func ( *MessagesGetArchivedStickersRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.Emojis = true
	} else {
		.Flags.Unset(1)
		.Emojis = false
	}
}

// GetEmojis returns value of Emojis conditional field.
func ( *MessagesGetArchivedStickersRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// GetOffsetID returns value of OffsetID field.
func ( *MessagesGetArchivedStickersRequest) () ( int64) {
	if  == nil {
		return
	}
	return .OffsetID
}

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

// MessagesGetArchivedStickers invokes method messages.getArchivedStickers#57f17692 returning error if any.
// Get all archived stickers
//
// See https://core.telegram.org/method/messages.getArchivedStickers for reference.
func ( *Client) ( context.Context,  *MessagesGetArchivedStickersRequest) (*MessagesArchivedStickers, error) {
	var  MessagesArchivedStickers

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