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

// BotsGetPopularAppBotsRequest represents TL type `bots.getPopularAppBots#c2510192`.
// Fetch popular Main Mini Apps¹, to be used in the apps tab of global search »².
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps#main-mini-apps
//  2. https://core.telegram.org/api/search#apps-tab
//
// See https://core.telegram.org/method/bots.getPopularAppBots for reference.
type BotsGetPopularAppBotsRequest struct {
	// Offset for pagination¹, initially an empty string, then re-use the next_offset
	// returned by the previous query.
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Offset string
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// BotsGetPopularAppBotsRequestTypeID is TL type id of BotsGetPopularAppBotsRequest.
const BotsGetPopularAppBotsRequestTypeID = 0xc2510192

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

func ( *BotsGetPopularAppBotsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills BotsGetPopularAppBotsRequest from given interface.
func ( *BotsGetPopularAppBotsRequest) ( interface {
	() ( string)
	() ( int)
}) {
	.Offset = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*BotsGetPopularAppBotsRequest) () string {
	return "bots.getPopularAppBots"
}

// TypeInfo returns info about TL type.
func ( *BotsGetPopularAppBotsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.getPopularAppBots",
		ID:   BotsGetPopularAppBotsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsGetPopularAppBotsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getPopularAppBots#c2510192 as nil")
	}
	.PutID(BotsGetPopularAppBotsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsGetPopularAppBotsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getPopularAppBots#c2510192 as nil")
	}
	.PutString(.Offset)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *BotsGetPopularAppBotsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getPopularAppBots#c2510192 to nil")
	}
	if  := .ConsumeID(BotsGetPopularAppBotsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *BotsGetPopularAppBotsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getPopularAppBots#c2510192 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getPopularAppBots#c2510192: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

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

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

// BotsGetPopularAppBots invokes method bots.getPopularAppBots#c2510192 returning error if any.
// Fetch popular Main Mini Apps¹, to be used in the apps tab of global search »².
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps#main-mini-apps
//  2. https://core.telegram.org/api/search#apps-tab
//
// See https://core.telegram.org/method/bots.getPopularAppBots for reference.
func ( *Client) ( context.Context,  *BotsGetPopularAppBotsRequest) (*BotsPopularAppBots, error) {
	var  BotsPopularAppBots

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