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

// ChannelsGetParticipantRequest represents TL type `channels.getParticipant#a0ab6cc6`.
// Get info about a channel/supergroup¹ participant
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/channels.getParticipant for reference.
type ChannelsGetParticipantRequest struct {
	// Channel/supergroup
	Channel InputChannelClass
	// Participant to get info about
	Participant InputPeerClass
}

// ChannelsGetParticipantRequestTypeID is TL type id of ChannelsGetParticipantRequest.
const ChannelsGetParticipantRequestTypeID = 0xa0ab6cc6

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

func ( *ChannelsGetParticipantRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == nil) {
		return false
	}
	if !(.Participant == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelsGetParticipantRequest from given interface.
func ( *ChannelsGetParticipantRequest) ( interface {
	() ( InputChannelClass)
	() ( InputPeerClass)
}) {
	.Channel = .()
	.Participant = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChannelsGetParticipantRequest) () string {
	return "channels.getParticipant"
}

// TypeInfo returns info about TL type.
func ( *ChannelsGetParticipantRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.getParticipant",
		ID:   ChannelsGetParticipantRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Participant",
			SchemaName: "participant",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsGetParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getParticipant#a0ab6cc6 as nil")
	}
	.PutID(ChannelsGetParticipantRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsGetParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getParticipant#a0ab6cc6 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.getParticipant#a0ab6cc6: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.getParticipant#a0ab6cc6: field channel: %w", )
	}
	if .Participant == nil {
		return fmt.Errorf("unable to encode channels.getParticipant#a0ab6cc6: field participant is nil")
	}
	if  := .Participant.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.getParticipant#a0ab6cc6: field participant: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsGetParticipantRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getParticipant#a0ab6cc6 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.getParticipant#a0ab6cc6: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode channels.getParticipant#a0ab6cc6: field participant: %w", )
		}
		.Participant = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *ChannelsGetParticipantRequest) () ( InputChannelClass) {
	if  == nil {
		return
	}
	return .Channel
}

// GetParticipant returns value of Participant field.
func ( *ChannelsGetParticipantRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

// GetChannelAsNotEmpty returns mapped value of Channel field.
func ( *ChannelsGetParticipantRequest) () (NotEmptyInputChannel, bool) {
	return .Channel.AsNotEmpty()
}

// ChannelsGetParticipant invokes method channels.getParticipant#a0ab6cc6 returning error if any.
// Get info about a channel/supergroup¹ participant
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PARTICIPANT_ID_INVALID: The specified participant ID is invalid.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//	400 USER_NOT_PARTICIPANT: You're not a member of this supergroup/channel.
//
// See https://core.telegram.org/method/channels.getParticipant for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *ChannelsGetParticipantRequest) (*ChannelsChannelParticipant, error) {
	var  ChannelsChannelParticipant

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