Skip to content

Commit

Permalink
Releasing version 95.0.0
Browse files Browse the repository at this point in the history
Releasing version 95.0.0
  • Loading branch information
oci-dex-release-bot authored Sep 17, 2024
2 parents 7cc2d2d + bd89cb2 commit 666f07c
Show file tree
Hide file tree
Showing 74 changed files with 3,820 additions and 112 deletions.
114 changes: 114 additions & 0 deletions Aispeech/AIServiceSpeechClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,120 @@ public async Task<ListTranscriptionTasksResponse> ListTranscriptionTasks(ListTra
}
}

/// <summary>
/// Returns a list of speakers available to the user to choose from based on language code and voice type provided.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <param name="completionOption">The completion option for this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/aispeech/ListVoices.cs.html">here</a> to see an example of how to use ListVoices API.</example>
public async Task<ListVoicesResponse> ListVoices(ListVoicesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
logger.Trace("Called listVoices");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/voices".Trim('/')));
HttpMethod method = new HttpMethod("GET");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;

try
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, completionOption, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage, completionOption: completionOption).ConfigureAwait(false);
}
stopWatch.Stop();
ApiDetails apiDetails = new ApiDetails
{
ServiceName = "AIServiceSpeech",
OperationName = "ListVoices",
RequestEndpoint = $"{method.Method} {requestMessage.RequestUri}",
ApiReferenceLink = "https://docs.oracle.com/iaas/api/#/en/speech/20220101/Voice/ListVoices",
UserAgent = this.GetUserAgent()
};
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage, apiDetails);
logger.Debug($"Total Latency for this API call is: {stopWatch.ElapsedMilliseconds} ms");
return Converter.FromHttpResponseMessage<ListVoicesResponse>(responseMessage);
}
catch (OciException e)
{
logger.Error(e);
throw;
}
catch (Exception e)
{
logger.Error($"ListVoices failed with error: {e.Message}");
throw;
}
}

/// <summary>
/// Creates an audio for the given input text based on other input parameters like language, voice type, etc.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <param name="completionOption">The completion option for this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/aispeech/SynthesizeSpeech.cs.html">here</a> to see an example of how to use SynthesizeSpeech API.</example>
public async Task<SynthesizeSpeechResponse> SynthesizeSpeech(SynthesizeSpeechRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
logger.Trace("Called synthesizeSpeech");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/actions/synthesizeSpeech".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "audio/mpeg, audio/ogg, audio/pcm, audio/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;

try
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, completionOption, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage, completionOption: completionOption).ConfigureAwait(false);
}
stopWatch.Stop();
ApiDetails apiDetails = new ApiDetails
{
ServiceName = "AIServiceSpeech",
OperationName = "SynthesizeSpeech",
RequestEndpoint = $"{method.Method} {requestMessage.RequestUri}",
ApiReferenceLink = "https://docs.oracle.com/iaas/api/#/en/speech/20220101/SynthesizeSpeech/SynthesizeSpeech",
UserAgent = this.GetUserAgent()
};
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage, apiDetails);
logger.Debug($"Total Latency for this API call is: {stopWatch.ElapsedMilliseconds} ms");
return Converter.FromHttpResponseMessage<SynthesizeSpeechResponse>(responseMessage);
}
catch (OciException e)
{
logger.Error(e);
throw;
}
catch (Exception e)
{
logger.Error($"SynthesizeSpeech failed with error: {e.Message}");
throw;
}
}

/// <summary>
/// Updates a Customization by identifier
/// </summary>
Expand Down
56 changes: 56 additions & 0 deletions Aispeech/models/SynthesizeSpeechDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/

// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.


using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


namespace Oci.AispeechService.Models
{
/// <summary>
/// Input JSON to get audio inference from TTS Service.
/// </summary>
public class SynthesizeSpeechDetails
{

/// <value>
/// The text input to get the inference audio from TTS Service.
/// </value>
/// <remarks>
/// Required
/// </remarks>
[Required(ErrorMessage = "Text is required.")]
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }

/// <value>
/// If set to true, response will be sent in the chunked transfer-encoding and audio chunks
/// are sent back as and when they are ready. If set to false, response will be sent only once
/// the entire audio is generated.
///
/// </value>
[JsonProperty(PropertyName = "isStreamEnabled")]
public System.Nullable<bool> IsStreamEnabled { get; set; }

/// <value>
/// The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment where the user has access to call `SpeechSynthesize` api. But default user access will be checked at tenancy level.
/// </value>
[JsonProperty(PropertyName = "compartmentId")]
public string CompartmentId { get; set; }

[JsonProperty(PropertyName = "configuration")]
public TtsConfiguration Configuration { get; set; }

[JsonProperty(PropertyName = "audioConfig")]
public TtsAudioConfig AudioConfig { get; set; }

}
}
70 changes: 70 additions & 0 deletions Aispeech/models/TtsAudioConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/

// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.


using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;

namespace Oci.AispeechService.Models
{
/// <summary>
/// Use this schema to specify handling of audio response.
/// If audioConfig is not provided, raw response is handed over for the user to handle.
///
/// </summary>
[JsonConverter(typeof(TtsAudioConfigModelConverter))]
public class TtsAudioConfig
{
///
/// <value>
/// The audio config type to use for handling the audio output.
/// Supported config types are:
/// - BASE_AUDIO_CONFIG
///
/// </value>
///
public enum ConfigTypeEnum {
[EnumMember(Value = "BASE_AUDIO_CONFIG")]
BaseAudioConfig
};


}

public class TtsAudioConfigModelConverter : JsonConverter
{
public override bool CanWrite => false;
public override bool CanRead => true;
public override bool CanConvert(System.Type type)
{
return type == typeof(TtsAudioConfig);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new System.InvalidOperationException("Use default serialization.");
}

public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
var jsonObject = JObject.Load(reader);
var obj = default(TtsAudioConfig);
var discriminator = jsonObject["configType"].Value<string>();
switch (discriminator)
{
case "BASE_AUDIO_CONFIG":
obj = new TtsBaseAudioConfig();
break;
}
serializer.Populate(jsonObject.CreateReader(), obj);
return obj;
}
}
}
37 changes: 37 additions & 0 deletions Aispeech/models/TtsBaseAudioConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/

// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.


using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


namespace Oci.AispeechService.Models
{
/// <summary>
/// Use this audio config for saving the audio response at specified path.
/// </summary>
public class TtsBaseAudioConfig : TtsAudioConfig
{

/// <value>
/// Specify the path where you want to save the audio response.
/// </value>
/// <remarks>
/// Required
/// </remarks>
[Required(ErrorMessage = "SavePath is required.")]
[JsonProperty(PropertyName = "savePath")]
public string SavePath { get; set; }

[JsonProperty(PropertyName = "configType")]
private readonly string configType = "BASE_AUDIO_CONFIG";
}
}
67 changes: 67 additions & 0 deletions Aispeech/models/TtsConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/

// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.


using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;

namespace Oci.AispeechService.Models
{
/// <summary>
/// Speech configuration for TTS API.
/// </summary>
[JsonConverter(typeof(TtsConfigurationModelConverter))]
public class TtsConfiguration
{
///
/// <value>
/// The class of models to use for speech generation. The available model families are:
/// - ORACLE
///
/// </value>
///
public enum ModelFamilyEnum {
[EnumMember(Value = "ORACLE")]
Oracle
};


}

public class TtsConfigurationModelConverter : JsonConverter
{
public override bool CanWrite => false;
public override bool CanRead => true;
public override bool CanConvert(System.Type type)
{
return type == typeof(TtsConfiguration);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new System.InvalidOperationException("Use default serialization.");
}

public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
var jsonObject = JObject.Load(reader);
var obj = default(TtsConfiguration);
var discriminator = jsonObject["modelFamily"].Value<string>();
switch (discriminator)
{
case "ORACLE":
obj = new TtsOracleConfiguration();
break;
}
serializer.Populate(jsonObject.CreateReader(), obj);
return obj;
}
}
}
33 changes: 33 additions & 0 deletions Aispeech/models/TtsOracleConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/

// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.


using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


namespace Oci.AispeechService.Models
{
/// <summary>
/// Use this configuration for selecting a model from Oracle model family.
/// </summary>
public class TtsOracleConfiguration : TtsConfiguration
{

[JsonProperty(PropertyName = "modelDetails")]
public TtsOracleModelDetails ModelDetails { get; set; }

[JsonProperty(PropertyName = "speechSettings")]
public TtsOracleSpeechSettings SpeechSettings { get; set; }

[JsonProperty(PropertyName = "modelFamily")]
private readonly string modelFamily = "ORACLE";
}
}
Loading

0 comments on commit 666f07c

Please sign in to comment.