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

// MessagesGetPollResultsRequest represents TL type `messages.getPollResults#73bb643b`.
// Get poll results
//
// See https://core.telegram.org/method/messages.getPollResults for reference.
type MessagesGetPollResultsRequest struct {
	// Peer where the poll was found
	Peer InputPeerClass
	// Message ID of poll message
	MsgID int
}

// MessagesGetPollResultsRequestTypeID is TL type id of MessagesGetPollResultsRequest.
const MessagesGetPollResultsRequestTypeID = 0x73bb643b

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

func ( *MessagesGetPollResultsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetPollResultsRequest from given interface.
func ( *MessagesGetPollResultsRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.MsgID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetPollResultsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getPollResults",
		ID:   MessagesGetPollResultsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetPollResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPollResults#73bb643b as nil")
	}
	.PutID(MessagesGetPollResultsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetPollResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPollResults#73bb643b as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getPollResults#73bb643b: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getPollResults#73bb643b: field peer: %w", )
	}
	.PutInt(.MsgID)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetPollResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getPollResults#73bb643b to nil")
	}
	if  := .ConsumeID(MessagesGetPollResultsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetPollResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getPollResults#73bb643b to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getPollResults#73bb643b: field msg_id: %w", )
		}
		.MsgID = 
	}
	return nil
}

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

// GetMsgID returns value of MsgID field.
func ( *MessagesGetPollResultsRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// MessagesGetPollResults invokes method messages.getPollResults#73bb643b returning error if any.
// Get poll results
//
// Possible errors:
//
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getPollResults for reference.
func ( *Client) ( context.Context,  *MessagesGetPollResultsRequest) (UpdatesClass, error) {
	var  UpdatesBox

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