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

// InvokeWithReCaptchaRequest represents TL type `invokeWithReCaptcha#adbb0f94`.
// Official clients only: re-execute a method call that required reCAPTCHA verification
// via a RECAPTCHA_CHECK_%s__%s, where the first placeholder is the action, and the
// second one is the reCAPTCHA key ID.
//
// See https://core.telegram.org/constructor/invokeWithReCaptcha for reference.
type InvokeWithReCaptchaRequest struct {
	// reCAPTCHA token received after verification.
	Token string
	// The original method call.
	Query bin.Object
}

// InvokeWithReCaptchaRequestTypeID is TL type id of InvokeWithReCaptchaRequest.
const InvokeWithReCaptchaRequestTypeID = 0xadbb0f94

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

func ( *InvokeWithReCaptchaRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Token == "") {
		return false
	}
	if !(.Query == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InvokeWithReCaptchaRequest from given interface.
func ( *InvokeWithReCaptchaRequest) ( interface {
	() ( string)
	() ( bin.Object)
}) {
	.Token = .()
	.Query = .()
}

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

// TypeName returns name of type in TL schema.
func (*InvokeWithReCaptchaRequest) () string {
	return "invokeWithReCaptcha"
}

// TypeInfo returns info about TL type.
func ( *InvokeWithReCaptchaRequest) () tdp.Type {
	 := tdp.Type{
		Name: "invokeWithReCaptcha",
		ID:   InvokeWithReCaptchaRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Token",
			SchemaName: "token",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InvokeWithReCaptchaRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithReCaptcha#adbb0f94 as nil")
	}
	.PutID(InvokeWithReCaptchaRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InvokeWithReCaptchaRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithReCaptcha#adbb0f94 as nil")
	}
	.PutString(.Token)
	if  := .Query.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeWithReCaptcha#adbb0f94: field query: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InvokeWithReCaptchaRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeWithReCaptcha#adbb0f94 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode invokeWithReCaptcha#adbb0f94: field token: %w", )
		}
		.Token = 
	}
	{
		if  := .Query.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeWithReCaptcha#adbb0f94: field query: %w", )
		}
	}
	return nil
}

// GetToken returns value of Token field.
func ( *InvokeWithReCaptchaRequest) () ( string) {
	if  == nil {
		return
	}
	return .Token
}

// GetQuery returns value of Query field.
func ( *InvokeWithReCaptchaRequest) () ( bin.Object) {
	if  == nil {
		return
	}
	return .Query
}