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

// BotsRequestWebViewButtonRequest represents TL type `bots.requestWebViewButton#31a2a35e`.
//
// See https://core.telegram.org/method/bots.requestWebViewButton for reference.
type BotsRequestWebViewButtonRequest struct {
	// UserID field of BotsRequestWebViewButtonRequest.
	UserID InputUserClass
	// Button field of BotsRequestWebViewButtonRequest.
	Button KeyboardButtonClass
}

// BotsRequestWebViewButtonRequestTypeID is TL type id of BotsRequestWebViewButtonRequest.
const BotsRequestWebViewButtonRequestTypeID = 0x31a2a35e

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

func ( *BotsRequestWebViewButtonRequest) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == nil) {
		return false
	}
	if !(.Button == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotsRequestWebViewButtonRequest from given interface.
func ( *BotsRequestWebViewButtonRequest) ( interface {
	() ( InputUserClass)
	() ( KeyboardButtonClass)
}) {
	.UserID = .()
	.Button = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotsRequestWebViewButtonRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.requestWebViewButton",
		ID:   BotsRequestWebViewButtonRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Button",
			SchemaName: "button",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsRequestWebViewButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.requestWebViewButton#31a2a35e as nil")
	}
	.PutID(BotsRequestWebViewButtonRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsRequestWebViewButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.requestWebViewButton#31a2a35e as nil")
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field user_id: %w", )
	}
	if .Button == nil {
		return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field button is nil")
	}
	if  := .Button.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.requestWebViewButton#31a2a35e: field button: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsRequestWebViewButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.requestWebViewButton#31a2a35e to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode bots.requestWebViewButton#31a2a35e: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := DecodeKeyboardButton()
		if  != nil {
			return fmt.Errorf("unable to decode bots.requestWebViewButton#31a2a35e: field button: %w", )
		}
		.Button = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *BotsRequestWebViewButtonRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// GetButton returns value of Button field.
func ( *BotsRequestWebViewButtonRequest) () ( KeyboardButtonClass) {
	if  == nil {
		return
	}
	return .Button
}

// BotsRequestWebViewButton invokes method bots.requestWebViewButton#31a2a35e returning error if any.
//
// See https://core.telegram.org/method/bots.requestWebViewButton for reference.
func ( *Client) ( context.Context,  *BotsRequestWebViewButtonRequest) (*BotsRequestedButton, error) {
	var  BotsRequestedButton

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