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

// MessagesGetExportedChatInviteRequest represents TL type `messages.getExportedChatInvite#73746f5c`.
// Get info about a chat invite
//
// See https://core.telegram.org/method/messages.getExportedChatInvite for reference.
type MessagesGetExportedChatInviteRequest struct {
	// Chat
	Peer InputPeerClass
	// Invite link
	Link string
}

// MessagesGetExportedChatInviteRequestTypeID is TL type id of MessagesGetExportedChatInviteRequest.
const MessagesGetExportedChatInviteRequestTypeID = 0x73746f5c

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

func ( *MessagesGetExportedChatInviteRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Link == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetExportedChatInviteRequest from given interface.
func ( *MessagesGetExportedChatInviteRequest) ( interface {
	() ( InputPeerClass)
	() ( string)
}) {
	.Peer = .()
	.Link = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetExportedChatInviteRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getExportedChatInvite",
		ID:   MessagesGetExportedChatInviteRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Link",
			SchemaName: "link",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetExportedChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getExportedChatInvite#73746f5c as nil")
	}
	.PutID(MessagesGetExportedChatInviteRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetExportedChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getExportedChatInvite#73746f5c as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvite#73746f5c: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getExportedChatInvite#73746f5c: field peer: %w", )
	}
	.PutString(.Link)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetExportedChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getExportedChatInvite#73746f5c to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvite#73746f5c: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getExportedChatInvite#73746f5c: field link: %w", )
		}
		.Link = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *MessagesGetExportedChatInviteRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetLink returns value of Link field.
func ( *MessagesGetExportedChatInviteRequest) () ( string) {
	if  == nil {
		return
	}
	return .Link
}

// MessagesGetExportedChatInvite invokes method messages.getExportedChatInvite#73746f5c returning error if any.
// Get info about a chat invite
//
// Possible errors:
//
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 INVITE_HASH_EXPIRED: The invite link has expired.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getExportedChatInvite for reference.
func ( *Client) ( context.Context,  *MessagesGetExportedChatInviteRequest) (MessagesExportedChatInviteClass, error) {
	var  MessagesExportedChatInviteBox

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