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

// MessagesSendWebViewResultMessageRequest represents TL type `messages.sendWebViewResultMessage#a4314f5`.
// Terminate webview interaction started with messages.requestWebView¹, sending the
// specified message to the chat on behalf of the user.
//
// Links:
//  1. https://core.telegram.org/method/messages.requestWebView
//
// See https://core.telegram.org/method/messages.sendWebViewResultMessage for reference.
type MessagesSendWebViewResultMessageRequest struct {
	// Webview interaction ID obtained from messages.requestWebView¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.requestWebView
	BotQueryID string
	// Message to send
	Result InputBotInlineResultClass
}

// MessagesSendWebViewResultMessageRequestTypeID is TL type id of MessagesSendWebViewResultMessageRequest.
const MessagesSendWebViewResultMessageRequestTypeID = 0xa4314f5

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

func ( *MessagesSendWebViewResultMessageRequest) () bool {
	if  == nil {
		return true
	}
	if !(.BotQueryID == "") {
		return false
	}
	if !(.Result == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSendWebViewResultMessageRequest from given interface.
func ( *MessagesSendWebViewResultMessageRequest) ( interface {
	() ( string)
	() ( InputBotInlineResultClass)
}) {
	.BotQueryID = .()
	.Result = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesSendWebViewResultMessageRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.sendWebViewResultMessage",
		ID:   MessagesSendWebViewResultMessageRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BotQueryID",
			SchemaName: "bot_query_id",
		},
		{
			Name:       "Result",
			SchemaName: "result",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesSendWebViewResultMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.sendWebViewResultMessage#a4314f5 as nil")
	}
	.PutID(MessagesSendWebViewResultMessageRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesSendWebViewResultMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.sendWebViewResultMessage#a4314f5 as nil")
	}
	.PutString(.BotQueryID)
	if .Result == nil {
		return fmt.Errorf("unable to encode messages.sendWebViewResultMessage#a4314f5: field result is nil")
	}
	if  := .Result.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.sendWebViewResultMessage#a4314f5: field result: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSendWebViewResultMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.sendWebViewResultMessage#a4314f5 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendWebViewResultMessage#a4314f5: field bot_query_id: %w", )
		}
		.BotQueryID = 
	}
	{
		,  := DecodeInputBotInlineResult()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendWebViewResultMessage#a4314f5: field result: %w", )
		}
		.Result = 
	}
	return nil
}

// GetBotQueryID returns value of BotQueryID field.
func ( *MessagesSendWebViewResultMessageRequest) () ( string) {
	if  == nil {
		return
	}
	return .BotQueryID
}

// GetResult returns value of Result field.
func ( *MessagesSendWebViewResultMessageRequest) () ( InputBotInlineResultClass) {
	if  == nil {
		return
	}
	return .Result
}

// MessagesSendWebViewResultMessage invokes method messages.sendWebViewResultMessage#a4314f5 returning error if any.
// Terminate webview interaction started with messages.requestWebView¹, sending the
// specified message to the chat on behalf of the user.
//
// Links:
//  1. https://core.telegram.org/method/messages.requestWebView
//
// Possible errors:
//
//	400 QUERY_ID_INVALID: The query ID is invalid.
//
// See https://core.telegram.org/method/messages.sendWebViewResultMessage for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesSendWebViewResultMessageRequest) (*WebViewMessageSent, error) {
	var  WebViewMessageSent

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