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

// MessagesImportChatInviteRequest represents TL type `messages.importChatInvite#6c50051c`.
// Import a chat invite and join a private chat/supergroup/channel
//
// See https://core.telegram.org/method/messages.importChatInvite for reference.
type MessagesImportChatInviteRequest struct {
	// hash from a chat invite deep linkĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/links#chat-invite-links
	Hash string
}

// MessagesImportChatInviteRequestTypeID is TL type id of MessagesImportChatInviteRequest.
const MessagesImportChatInviteRequestTypeID = 0x6c50051c

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

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

	return true
}

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

// FillFrom fills MessagesImportChatInviteRequest from given interface.
func ( *MessagesImportChatInviteRequest) ( interface {
	() ( string)
}) {
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesImportChatInviteRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.importChatInvite",
		ID:   MessagesImportChatInviteRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesImportChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.importChatInvite#6c50051c as nil")
	}
	.PutID(MessagesImportChatInviteRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesImportChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.importChatInvite#6c50051c as nil")
	}
	.PutString(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesImportChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.importChatInvite#6c50051c to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.importChatInvite#6c50051c: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetHash returns value of Hash field.
func ( *MessagesImportChatInviteRequest) () ( string) {
	if  == nil {
		return
	}
	return .Hash
}

// MessagesImportChatInvite invokes method messages.importChatInvite#6c50051c returning error if any.
// Import a chat invite and join a private chat/supergroup/channel
//
// Possible errors:
//
//	400 CHANNELS_TOO_MUCH: You have joined too many channels/supergroups.
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_INVALID: Invalid chat.
//	400 INVITE_HASH_EMPTY: The invite hash is empty.
//	406 INVITE_HASH_EXPIRED: The invite link has expired.
//	400 INVITE_HASH_INVALID: The invite hash is invalid.
//	400 INVITE_REQUEST_SENT: You have successfully requested to join this chat or channel.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example).
//	400 USER_ALREADY_PARTICIPANT: The user is already in the group.
//	400 USER_CHANNELS_TOO_MUCH: One of the users you tried to add is already in too many channels/supergroups.
//
// See https://core.telegram.org/method/messages.importChatInvite for reference.
func ( *Client) ( context.Context,  string) (UpdatesClass, error) {
	var  UpdatesBox

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