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

// MessagesDeclineURLAuthRequest represents TL type `messages.declineUrlAuth#35436bbc`.
// Decline an incoming OAuth authorization request »¹, notifying the server that the
// user refused the login request.
//
// Links:
//  1. https://core.telegram.org/api/url-authorization#oauth-authorization
//
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
type MessagesDeclineURLAuthRequest struct {
	// The OAuth deep link from the OAUTH_REQUEST push notification¹ or the oauth_request
	// web event²
	//
	// Links:
	//  1) https://core.telegram.org/api/push-updates#oauth-request
	//  2) https://core.telegram.org/api/web-events#oauth-request
	URL string
}

// MessagesDeclineURLAuthRequestTypeID is TL type id of MessagesDeclineURLAuthRequest.
const MessagesDeclineURLAuthRequestTypeID = 0x35436bbc

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

func ( *MessagesDeclineURLAuthRequest) () bool {
	if  == nil {
		return true
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesDeclineURLAuthRequest from given interface.
func ( *MessagesDeclineURLAuthRequest) ( interface {
	() ( string)
}) {
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesDeclineURLAuthRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.declineUrlAuth",
		ID:   MessagesDeclineURLAuthRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesDeclineURLAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
	}
	.PutID(MessagesDeclineURLAuthRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesDeclineURLAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
	}
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesDeclineURLAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetURL returns value of URL field.
func ( *MessagesDeclineURLAuthRequest) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// MessagesDeclineURLAuth invokes method messages.declineUrlAuth#35436bbc returning error if any.
// Decline an incoming OAuth authorization request »¹, notifying the server that the
// user refused the login request.
//
// Links:
//  1. https://core.telegram.org/api/url-authorization#oauth-authorization
//
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
func ( *Client) ( context.Context,  string) (bool, error) {
	var  BoolBox

	 := &MessagesDeclineURLAuthRequest{
		URL: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}