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

// MessagesGetBotAppRequest represents TL type `messages.getBotApp#34fdc5c3`.
// Obtain information about a named Mini App¹
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps#named-mini-apps
//
// See https://core.telegram.org/method/messages.getBotApp for reference.
type MessagesGetBotAppRequest struct {
	// Bot app information obtained from a named Mini App deep link »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#named-mini-app-links
	App InputBotAppClass
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
}

// MessagesGetBotAppRequestTypeID is TL type id of MessagesGetBotAppRequest.
const MessagesGetBotAppRequestTypeID = 0x34fdc5c3

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

func ( *MessagesGetBotAppRequest) () bool {
	if  == nil {
		return true
	}
	if !(.App == nil) {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetBotAppRequest from given interface.
func ( *MessagesGetBotAppRequest) ( interface {
	() ( InputBotAppClass)
	() ( int64)
}) {
	.App = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetBotAppRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getBotApp",
		ID:   MessagesGetBotAppRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "App",
			SchemaName: "app",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetBotAppRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getBotApp#34fdc5c3 as nil")
	}
	.PutID(MessagesGetBotAppRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetBotAppRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getBotApp#34fdc5c3 as nil")
	}
	if .App == nil {
		return fmt.Errorf("unable to encode messages.getBotApp#34fdc5c3: field app is nil")
	}
	if  := .App.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getBotApp#34fdc5c3: field app: %w", )
	}
	.PutLong(.Hash)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetBotAppRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getBotApp#34fdc5c3 to nil")
	}
	if  := .ConsumeID(MessagesGetBotAppRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getBotApp#34fdc5c3: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetBotAppRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getBotApp#34fdc5c3 to nil")
	}
	{
		,  := DecodeInputBotApp()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getBotApp#34fdc5c3: field app: %w", )
		}
		.App = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getBotApp#34fdc5c3: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetApp returns value of App field.
func ( *MessagesGetBotAppRequest) () ( InputBotAppClass) {
	if  == nil {
		return
	}
	return .App
}

// GetHash returns value of Hash field.
func ( *MessagesGetBotAppRequest) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// MessagesGetBotApp invokes method messages.getBotApp#34fdc5c3 returning error if any.
// Obtain information about a named Mini App¹
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps#named-mini-apps
//
// Possible errors:
//
//	400 BOT_APP_INVALID: The specified bot app is invalid.
//
// See https://core.telegram.org/method/messages.getBotApp for reference.
func ( *Client) ( context.Context,  *MessagesGetBotAppRequest) (*MessagesBotApp, error) {
	var  MessagesBotApp

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