All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.mediaservices.models.LiveEventTranscription Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * Describes the transcription tracks in the output of a live event, generated using speech-to-text transcription. This
 * property is reserved for future use, any value set on this property will be ignored.
 */
@Fluent
public final class LiveEventTranscription implements JsonSerializable {
    /*
     * Specifies the language (locale) to be used for speech-to-text transcription – it should match the spoken language
     * in the audio track. The value should be in BCP-47 format (e.g: 'en-US'). See
     * https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature and the
     * list of supported languages.
     */
    private String language;

    /*
     * Provides a mechanism to select the audio track in the input live feed, to which speech-to-text transcription is
     * applied. This property is reserved for future use, any value set on this property will be ignored.
     */
    private List inputTrackSelection;

    /*
     * Describes a transcription track in the output of a live event, generated using speech-to-text transcription. This
     * property is reserved for future use, any value set on this property will be ignored.
     */
    private LiveEventOutputTranscriptionTrack outputTranscriptionTrack;

    /**
     * Creates an instance of LiveEventTranscription class.
     */
    public LiveEventTranscription() {
    }

    /**
     * Get the language property: Specifies the language (locale) to be used for speech-to-text transcription – it
     * should match the spoken language in the audio track. The value should be in BCP-47 format (e.g: 'en-US'). See
     * https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature and the
     * list of supported languages.
     * 
     * @return the language value.
     */
    public String language() {
        return this.language;
    }

    /**
     * Set the language property: Specifies the language (locale) to be used for speech-to-text transcription – it
     * should match the spoken language in the audio track. The value should be in BCP-47 format (e.g: 'en-US'). See
     * https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature and the
     * list of supported languages.
     * 
     * @param language the language value to set.
     * @return the LiveEventTranscription object itself.
     */
    public LiveEventTranscription withLanguage(String language) {
        this.language = language;
        return this;
    }

    /**
     * Get the inputTrackSelection property: Provides a mechanism to select the audio track in the input live feed, to
     * which speech-to-text transcription is applied. This property is reserved for future use, any value set on this
     * property will be ignored.
     * 
     * @return the inputTrackSelection value.
     */
    public List inputTrackSelection() {
        return this.inputTrackSelection;
    }

    /**
     * Set the inputTrackSelection property: Provides a mechanism to select the audio track in the input live feed, to
     * which speech-to-text transcription is applied. This property is reserved for future use, any value set on this
     * property will be ignored.
     * 
     * @param inputTrackSelection the inputTrackSelection value to set.
     * @return the LiveEventTranscription object itself.
     */
    public LiveEventTranscription withInputTrackSelection(List inputTrackSelection) {
        this.inputTrackSelection = inputTrackSelection;
        return this;
    }

    /**
     * Get the outputTranscriptionTrack property: Describes a transcription track in the output of a live event,
     * generated using speech-to-text transcription. This property is reserved for future use, any value set on this
     * property will be ignored.
     * 
     * @return the outputTranscriptionTrack value.
     */
    public LiveEventOutputTranscriptionTrack outputTranscriptionTrack() {
        return this.outputTranscriptionTrack;
    }

    /**
     * Set the outputTranscriptionTrack property: Describes a transcription track in the output of a live event,
     * generated using speech-to-text transcription. This property is reserved for future use, any value set on this
     * property will be ignored.
     * 
     * @param outputTranscriptionTrack the outputTranscriptionTrack value to set.
     * @return the LiveEventTranscription object itself.
     */
    public LiveEventTranscription
        withOutputTranscriptionTrack(LiveEventOutputTranscriptionTrack outputTranscriptionTrack) {
        this.outputTranscriptionTrack = outputTranscriptionTrack;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (inputTrackSelection() != null) {
            inputTrackSelection().forEach(e -> e.validate());
        }
        if (outputTranscriptionTrack() != null) {
            outputTranscriptionTrack().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("language", this.language);
        jsonWriter.writeArrayField("inputTrackSelection", this.inputTrackSelection,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeJsonField("outputTranscriptionTrack", this.outputTranscriptionTrack);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of LiveEventTranscription from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of LiveEventTranscription if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IOException If an error occurs while reading the LiveEventTranscription.
     */
    public static LiveEventTranscription fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            LiveEventTranscription deserializedLiveEventTranscription = new LiveEventTranscription();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("language".equals(fieldName)) {
                    deserializedLiveEventTranscription.language = reader.getString();
                } else if ("inputTrackSelection".equals(fieldName)) {
                    List inputTrackSelection
                        = reader.readArray(reader1 -> LiveEventInputTrackSelection.fromJson(reader1));
                    deserializedLiveEventTranscription.inputTrackSelection = inputTrackSelection;
                } else if ("outputTranscriptionTrack".equals(fieldName)) {
                    deserializedLiveEventTranscription.outputTranscriptionTrack
                        = LiveEventOutputTranscriptionTrack.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLiveEventTranscription;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy