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

// MessagesTranscribeAudioRequest represents TL type `messages.transcribeAudio#269e9a49`.
// Transcribe voice messageĀ¹
//
// Links:
//  1. https://core.telegram.org/api/transcribe
//
// See https://core.telegram.org/method/messages.transcribeAudio for reference.
type MessagesTranscribeAudioRequest struct {
	// Peer ID where the voice message was sent
	Peer InputPeerClass
	// Voice message ID
	MsgID int
}

// MessagesTranscribeAudioRequestTypeID is TL type id of MessagesTranscribeAudioRequest.
const MessagesTranscribeAudioRequestTypeID = 0x269e9a49

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesTranscribeAudioRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.transcribeAudio#269e9a49 as nil")
	}
	.PutID(MessagesTranscribeAudioRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *MessagesTranscribeAudioRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.transcribeAudio#269e9a49 to nil")
	}
	if  := .ConsumeID(MessagesTranscribeAudioRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.transcribeAudio#269e9a49: %w", )
	}
	return .DecodeBare()
}

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

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

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

// MessagesTranscribeAudio invokes method messages.transcribeAudio#269e9a49 returning error if any.
// Transcribe voice messageĀ¹
//
// Links:
//  1. https://core.telegram.org/api/transcribe
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
//	400 TRANSCRIPTION_FAILED: Audio transcription failed.
//
// See https://core.telegram.org/method/messages.transcribeAudio for reference.
func ( *Client) ( context.Context,  *MessagesTranscribeAudioRequest) (*MessagesTranscribedAudio, error) {
	var  MessagesTranscribedAudio

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