From bb70fa7df5e81866784dc4f192b848bc3a2e5308 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 7 Sep 2026 07:39:16 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- src/cli/Gradium.CLI/Commands/ApiCommand.g.cs | 1 + .../Commands/VoiceDesignApiGroupCommand.g.cs | 18 + ...cesFromEmbeddingPostCommandApiCommand.g.cs | 123 ++++ ...ngsEmbeddingIdDeleteCommandApiCommand.g.cs | 40 ++ ...eneratorGeneratePostCommandApiCommand.g.cs | 141 +++++ ...neratorEmbeddingsGetCommandApiCommand.g.cs | 94 +++ src/cli/Gradium.CLI/Program.cs | 1 + .../Generated/Gradium.GradiumClient.g.cs | 9 + .../Generated/Gradium.IGradiumClient.g.cs | 5 + ...eFromEmbeddingVoicesFromEmbeddingPost.g.cs | 62 ++ ...eGeneratorEmbeddingsEmbeddingIdDelete.g.cs | 34 ++ ...nerateVoiceVoiceGeneratorGeneratePost.g.cs | 67 +++ ...EmbeddingsVoiceGeneratorEmbeddingsGet.g.cs | 52 ++ .../Generated/Gradium.IVoiceDesignClient.g.cs | 49 ++ ...erters.VoiceGenerationRequestLanguage.g.cs | 53 ++ ...oiceGenerationRequestLanguageNullable.g.cs | 60 ++ .../Gradium.JsonSerializerContext.g.cs | 17 + .../Gradium.JsonSerializerContextTypes.g.cs | 64 +- ...radium.Models.GeneratedEmbedding.Json.g.cs | 141 +++++ .../Gradium.Models.GeneratedEmbedding.g.cs | 71 +++ ...odels.VoiceEmbeddingListResponse.Json.g.cs | 141 +++++ ...ium.Models.VoiceEmbeddingListResponse.g.cs | 47 ++ ...um.Models.VoiceEmbeddingResponse.Json.g.cs | 141 +++++ ...Gradium.Models.VoiceEmbeddingResponse.g.cs | 93 +++ ....Models.VoiceFromEmbeddingCreate.Json.g.cs | 141 +++++ ...adium.Models.VoiceFromEmbeddingCreate.g.cs | 70 +++ ...odels.VoiceFromEmbeddingResponse.Json.g.cs | 141 +++++ ...ium.Models.VoiceFromEmbeddingResponse.g.cs | 75 +++ ...um.Models.VoiceGenerationRequest.Json.g.cs | 141 +++++ ...Gradium.Models.VoiceGenerationRequest.g.cs | 84 +++ ...Models.VoiceGenerationRequestLanguage.g.cs | 69 +++ ...m.Models.VoiceGenerationResponse.Json.g.cs | 141 +++++ ...radium.Models.VoiceGenerationResponse.g.cs | 45 ++ ...dium.Models.VoiceGeneratorConfig.Json.g.cs | 141 +++++ .../Gradium.Models.VoiceGeneratorConfig.g.cs | 83 +++ ...eFromEmbeddingVoicesFromEmbeddingPost.g.cs | 547 ++++++++++++++++++ ...eGeneratorEmbeddingsEmbeddingIdDelete.g.cs | 442 ++++++++++++++ ...nerateVoiceVoiceGeneratorGeneratePost.g.cs | 521 +++++++++++++++++ ...EmbeddingsVoiceGeneratorEmbeddingsGet.g.cs | 498 ++++++++++++++++ .../Generated/Gradium.VoiceDesignClient.g.cs | 144 +++++ src/libs/Gradium/openapi.yaml | 478 +++++++++++++++ 41 files changed, 5279 insertions(+), 6 deletions(-) create mode 100644 src/cli/Gradium.CLI/Commands/VoiceDesignApiGroupCommand.g.cs create mode 100644 src/cli/Gradium.CLI/Commands/VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand.g.cs create mode 100644 src/cli/Gradium.CLI/Commands/VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand.g.cs create mode 100644 src/cli/Gradium.CLI/Commands/VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand.g.cs create mode 100644 src/cli/Gradium.CLI/Commands/VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguage.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguageNullable.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequestLanguage.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.Json.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.VoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.VoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.VoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.VoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs create mode 100644 src/libs/Gradium/Generated/Gradium.VoiceDesignClient.g.cs diff --git a/src/cli/Gradium.CLI/Commands/ApiCommand.g.cs b/src/cli/Gradium.CLI/Commands/ApiCommand.g.cs index b73317c..5116a35 100644 --- a/src/cli/Gradium.CLI/Commands/ApiCommand.g.cs +++ b/src/cli/Gradium.CLI/Commands/ApiCommand.g.cs @@ -15,6 +15,7 @@ public static Command Create() command.Subcommands.Add(S2SApiGroupCommand.Create()); command.Subcommands.Add(STTApiGroupCommand.Create()); command.Subcommands.Add(TTSApiGroupCommand.Create()); + command.Subcommands.Add(VoiceDesignApiGroupCommand.Create()); command.Subcommands.Add(VoicesApiGroupCommand.Create()); return command; } diff --git a/src/cli/Gradium.CLI/Commands/VoiceDesignApiGroupCommand.g.cs b/src/cli/Gradium.CLI/Commands/VoiceDesignApiGroupCommand.g.cs new file mode 100644 index 0000000..77826b3 --- /dev/null +++ b/src/cli/Gradium.CLI/Commands/VoiceDesignApiGroupCommand.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +using System.CommandLine; + +namespace Gradium.CLI.Commands; + +internal static class VoiceDesignApiGroupCommand +{ + public static Command Create() + { + var command = new Command(@"voice-design", @"Voice Design endpoint commands."); + command.Subcommands.Add(VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand.Create()); + command.Subcommands.Add(VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand.Create()); + command.Subcommands.Add(VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand.Create()); + command.Subcommands.Add(VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand.Create()); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Gradium.CLI/Commands/VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand.g.cs b/src/cli/Gradium.CLI/Commands/VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand.g.cs new file mode 100644 index 0000000..f677e42 --- /dev/null +++ b/src/cli/Gradium.CLI/Commands/VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand.g.cs @@ -0,0 +1,123 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Gradium.CLI.Commands; + +internal static partial class VoiceDesignCreateVoiceFromEmbeddingVoicesFromEmbeddingPostCommandApiCommand +{ + private static Argument NameOption { get; } = new( + name: @"name") + { + Description = @"A name for the voice.", + }; + + private static Option VoxiumEmbeddingId { get; } = new( + name: @"--voxium-embedding-id") + { + Description = @"Id of the candidate to keep, as returned by `POST /voice-generator/generate`.", + Required = true, + }; + + private static Option DescriptionOption { get; } = new( + name: @"--description") + { + Description = @"An optional description of the voice.", + }; + private static Option Input { get; } = new(@"--input") + { + Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.", + }; + + private static Option RequestJson { get; } = new(@"--request-json") + { + Description = "Request body as JSON.", + Hidden = true, + }; + + private static Option RequestFile { get; } = new(@"--request-file") + { + Description = "Path to a JSON request file, or '-' for stdin.", + Hidden = true, + }; + + private static string FormatResponse(ParseResult parseResult, global::Gradium.VoiceFromEmbeddingResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Gradium.VoiceFromEmbeddingResponse value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + public static Command Create() + { + var command = new Command(@"create-voice-from-embedding-voices-from-embedding-post", @"Create Voice From Candidate +Keep a generated candidate as a permanent voice in your organization. + +The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech. + +Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made."); + command.Arguments.Add(NameOption); + command.Options.Add(VoxiumEmbeddingId); + command.Options.Add(DescriptionOption); + command.Options.Add(Input); + command.Options.Add(RequestJson); + command.Options.Add(RequestFile); + command.Validators.Add(result => + { + var hasInput = result.GetResult(Input) is not null; + var hasRequestJson = result.GetResult(RequestJson) is not null; + var hasRequestFile = result.GetResult(RequestFile) is not null; + var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0); + if (specifiedCount > 1) + { + result.AddError(@"Specify at most one of --input, --request-json, or --request-file."); + } + }); + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync( + parseResult, + Input, + RequestJson, + RequestFile, + global::Gradium.SourceGenerationContext.Default, + cancellationToken).ConfigureAwait(false); + var name = parseResult.GetRequiredValue(NameOption); + var voxiumEmbeddingId = parseResult.GetRequiredValue(VoxiumEmbeddingId); + var description = CliRuntime.WasSpecified(parseResult, DescriptionOption) ? parseResult.GetValue(DescriptionOption) : (__requestBase is { } __DescriptionBaseValue ? __DescriptionBaseValue.Description : default); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.VoiceDesign.CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + name: name, + voxiumEmbeddingId: voxiumEmbeddingId, + description: description, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Gradium.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Gradium.CLI/Commands/VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand.g.cs b/src/cli/Gradium.CLI/Commands/VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand.g.cs new file mode 100644 index 0000000..4c5eabb --- /dev/null +++ b/src/cli/Gradium.CLI/Commands/VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand.g.cs @@ -0,0 +1,40 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Gradium.CLI.Commands; + +internal static partial class VoiceDesignDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteCommandApiCommand +{ + private static Argument EmbeddingId { get; } = new( + name: @"embedding-id") + { + Description = @"", + }; + + public static Command Create() + { + var command = new Command(@"delete-voice-embedding-voice-generator-embeddings-embedding-id-delete", @"Delete Voice Candidate +Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days. + +Safe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort."); + command.Arguments.Add(EmbeddingId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var embeddingId = parseResult.GetRequiredValue(EmbeddingId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + await client.VoiceDesign.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync( + embeddingId: embeddingId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + await CliRuntime.WriteSuccessAsync(parseResult, cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Gradium.CLI/Commands/VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand.g.cs b/src/cli/Gradium.CLI/Commands/VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand.g.cs new file mode 100644 index 0000000..83f7803 --- /dev/null +++ b/src/cli/Gradium.CLI/Commands/VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand.g.cs @@ -0,0 +1,141 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Gradium.CLI.Commands; + +internal static partial class VoiceDesignGenerateVoiceVoiceGeneratorGeneratePostCommandApiCommand +{ + private static Option Prompt { get; } = new( + name: @"--prompt") + { + Description = @"The voice description, up to 500 characters. Must contain actual text, not only spaces.", + Required = true, + }; + + private static Option Language { get; } = new( + name: @"--language") + { + Description = @"Language the voice will speak. Shapes the accent and the delivery.", + Required = true, + }; + + private static Option NSamples { get; } = new( + name: @"--n-samples") + { + Description = @"Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.", + }; + + private static Option JsonConfig { get; } = new( + name: @"--json-config") + { + Description = @"Advanced sampling options.", + }; + private static Option Input { get; } = new(@"--input") + { + Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.", + }; + + private static Option RequestJson { get; } = new(@"--request-json") + { + Description = "Request body as JSON.", + Hidden = true, + }; + + private static Option RequestFile { get; } = new(@"--request-file") + { + Description = "Path to a JSON request file, or '-' for stdin.", + Hidden = true, + }; + + private static string FormatResponse(ParseResult parseResult, global::Gradium.VoiceGenerationResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Gradium.VoiceGenerationResponse value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + public static Command Create() + { + var command = new Command(@"generate-voice-voice-generator-generate-post", @"Generate Voice Candidates +Sample candidate voices from a written description. No reference audio is involved. + +Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates. + +Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow."); + command.Options.Add(Prompt); + command.Options.Add(Language); + command.Options.Add(NSamples); + command.Options.Add(JsonConfig); + command.Options.Add(Input); + command.Options.Add(RequestJson); + command.Options.Add(RequestFile); + command.Validators.Add(result => + { + var hasInput = result.GetResult(Input) is not null; + var hasRequestJson = result.GetResult(RequestJson) is not null; + var hasRequestFile = result.GetResult(RequestFile) is not null; + var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0); + if (specifiedCount > 1) + { + result.AddError(@"Specify at most one of --input, --request-json, or --request-file."); + } + }); + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync( + parseResult, + Input, + RequestJson, + RequestFile, + global::Gradium.SourceGenerationContext.Default, + cancellationToken).ConfigureAwait(false); + var prompt = parseResult.GetRequiredValue(Prompt); + var language = parseResult.GetRequiredValue(Language); + var nSamples = CliRuntime.WasSpecified(parseResult, NSamples) ? parseResult.GetValue(NSamples) : (__requestBase is { } __NSamplesBaseValue ? __NSamplesBaseValue.NSamples : default); + var jsonConfig = CliRuntime.WasSpecified(parseResult, JsonConfig) ? parseResult.GetValue(JsonConfig) : (__requestBase is { } __JsonConfigBaseValue ? __JsonConfigBaseValue.JsonConfig : default); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.VoiceDesign.GenerateVoiceVoiceGeneratorGeneratePostAsync( + prompt: prompt, + language: language, + nSamples: nSamples, + jsonConfig: jsonConfig, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Gradium.SourceGenerationContext.Default, + @"Embeddings", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Gradium.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Gradium.CLI/Commands/VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand.g.cs b/src/cli/Gradium.CLI/Commands/VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand.g.cs new file mode 100644 index 0000000..f2e11fb --- /dev/null +++ b/src/cli/Gradium.CLI/Commands/VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand.g.cs @@ -0,0 +1,94 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Gradium.CLI.Commands; + +internal static partial class VoiceDesignListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetCommandApiCommand +{ + private static Option EmbeddingId { get; } = new( + name: @"--embedding-id") + { + Description = @"Look up a single candidate by id. Omit to list all candidates.", + }; + + private static Option Skip { get; } = new( + name: @"--skip") + { + Description = @"", + }; + + private static Option Limit { get; } = new( + name: @"--limit") + { + Description = @"", + }; + + private static string FormatResponse(ParseResult parseResult, global::Gradium.VoiceEmbeddingListResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Gradium.VoiceEmbeddingListResponse value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + public static Command Create() + { + var command = new Command(@"list-voice-embeddings-voice-generator-embeddings-get", @"List Voice Candidates +Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first. + +Pass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page. + +A lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it."); + command.Options.Add(EmbeddingId); + command.Options.Add(Skip); + command.Options.Add(Limit); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var embeddingId = parseResult.GetValue(EmbeddingId); + var skip = parseResult.GetValue(Skip); + var limit = parseResult.GetValue(Limit); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.VoiceDesign.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync( + embeddingId: embeddingId, + skip: skip, + limit: limit, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Gradium.SourceGenerationContext.Default, + @"Embeddings", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Gradium.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Gradium.CLI/Program.cs b/src/cli/Gradium.CLI/Program.cs index 9507746..5e25f3d 100644 --- a/src/cli/Gradium.CLI/Program.cs +++ b/src/cli/Gradium.CLI/Program.cs @@ -16,6 +16,7 @@ rootCommand.Subcommands.Add(S2SApiGroupCommand.Create()); rootCommand.Subcommands.Add(STTApiGroupCommand.Create()); rootCommand.Subcommands.Add(TTSApiGroupCommand.Create()); +rootCommand.Subcommands.Add(VoiceDesignApiGroupCommand.Create()); rootCommand.Subcommands.Add(VoicesApiGroupCommand.Create()); return await rootCommand.Parse(args).InvokeAsync().ConfigureAwait(false); \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.GradiumClient.g.cs b/src/libs/Gradium/Generated/Gradium.GradiumClient.g.cs index 557c891..e06f2ac 100644 --- a/src/libs/Gradium/Generated/Gradium.GradiumClient.g.cs +++ b/src/libs/Gradium/Generated/Gradium.GradiumClient.g.cs @@ -94,6 +94,15 @@ public sealed partial class GradiumClient : global::Gradium.IGradiumClient, glob JsonSerializerContextProvider = JsonSerializerContextProvider, }; + /// + /// Create voices from a written description. + /// + public VoiceDesignClient VoiceDesign => new VoiceDesignClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContextProvider = JsonSerializerContextProvider, + }; + /// /// Manage custom voice clones. /// diff --git a/src/libs/Gradium/Generated/Gradium.IGradiumClient.g.cs b/src/libs/Gradium/Generated/Gradium.IGradiumClient.g.cs index 5a7cf1c..8b4df1d 100644 --- a/src/libs/Gradium/Generated/Gradium.IGradiumClient.g.cs +++ b/src/libs/Gradium/Generated/Gradium.IGradiumClient.g.cs @@ -72,6 +72,11 @@ public partial interface IGradiumClient : global::System.IDisposable /// public TtsClient Tts { get; } + /// + /// Create voices from a written description. + /// + public VoiceDesignClient VoiceDesign { get; } + /// /// Manage custom voice clones. /// diff --git a/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs new file mode 100644 index 0000000..f7d8db5 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs @@ -0,0 +1,62 @@ +#nullable enable + +namespace Gradium +{ + public partial interface IVoiceDesignClient + { + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + + global::Gradium.VoiceFromEmbeddingCreate request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsResponseAsync( + + global::Gradium.VoiceFromEmbeddingCreate request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Id of the candidate to keep, as returned by `POST /voice-generator/generate`. + /// + /// + /// A name for the voice. + /// + /// + /// An optional description of the voice. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + string voxiumEmbeddingId, + string name, + string? description = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs new file mode 100644 index 0000000..fd23818 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs @@ -0,0 +1,34 @@ +#nullable enable + +namespace Gradium +{ + public partial interface IVoiceDesignClient + { + /// + /// Delete Voice Candidate
+ /// Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days.
+ /// Safe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync( + string embeddingId, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete Voice Candidate
+ /// Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days.
+ /// Safe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsResponseAsync( + string embeddingId, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs new file mode 100644 index 0000000..722dcb9 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs @@ -0,0 +1,67 @@ +#nullable enable + +namespace Gradium +{ + public partial interface IVoiceDesignClient + { + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GenerateVoiceVoiceGeneratorGeneratePostAsync( + + global::Gradium.VoiceGenerationRequest request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GenerateVoiceVoiceGeneratorGeneratePostAsResponseAsync( + + global::Gradium.VoiceGenerationRequest request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// The voice description, up to 500 characters. Must contain actual text, not only spaces. + /// + /// + /// Language the voice will speak. Shapes the accent and the delivery. + /// + /// + /// Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.
+ /// Default Value: 1 + /// + /// + /// Advanced sampling options. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GenerateVoiceVoiceGeneratorGeneratePostAsync( + string prompt, + global::Gradium.VoiceGenerationRequestLanguage language, + int? nSamples = default, + global::Gradium.VoiceGeneratorConfig? jsonConfig = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs new file mode 100644 index 0000000..d9813f2 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs @@ -0,0 +1,52 @@ +#nullable enable + +namespace Gradium +{ + public partial interface IVoiceDesignClient + { + /// + /// List Voice Candidates
+ /// Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first.
+ /// Pass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page.
+ /// A lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it. + ///
+ /// + /// + /// Default Value: 0 + /// + /// + /// Default Value: 100 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync( + string? embeddingId = default, + int? skip = default, + int? limit = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Voice Candidates
+ /// Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first.
+ /// Pass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page.
+ /// A lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it. + ///
+ /// + /// + /// Default Value: 0 + /// + /// + /// Default Value: 100 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsResponseAsync( + string? embeddingId = default, + int? skip = default, + int? limit = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.g.cs b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.g.cs new file mode 100644 index 0000000..38d4e55 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.IVoiceDesignClient.g.cs @@ -0,0 +1,49 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// Create voices from a written description
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IVoiceDesignClient : global::System.IDisposable + { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// When false, successful responses are deserialized directly from the response stream for better performance. + /// Error responses are always read as strings regardless of this setting, + /// ensuring is populated. + /// + public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::Gradium.AutoSDKClientOptions Options { get; } + + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguage.g.cs b/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguage.g.cs new file mode 100644 index 0000000..ba1f47c --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguage.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Gradium.JsonConverters +{ + /// + public sealed class VoiceGenerationRequestLanguageJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Gradium.VoiceGenerationRequestLanguage Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Gradium.VoiceGenerationRequestLanguageExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Gradium.VoiceGenerationRequestLanguage)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Gradium.VoiceGenerationRequestLanguage); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Gradium.VoiceGenerationRequestLanguage value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Gradium.VoiceGenerationRequestLanguageExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguageNullable.g.cs b/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguageNullable.g.cs new file mode 100644 index 0000000..40c626d --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.JsonConverters.VoiceGenerationRequestLanguageNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Gradium.JsonConverters +{ + /// + public sealed class VoiceGenerationRequestLanguageNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Gradium.VoiceGenerationRequestLanguage? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Gradium.VoiceGenerationRequestLanguageExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Gradium.VoiceGenerationRequestLanguage)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Gradium.VoiceGenerationRequestLanguage?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Gradium.VoiceGenerationRequestLanguage? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Gradium.VoiceGenerationRequestLanguageExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.JsonSerializerContext.g.cs b/src/libs/Gradium/Generated/Gradium.JsonSerializerContext.g.cs index 1a74ce1..81de3ee 100644 --- a/src/libs/Gradium/Generated/Gradium.JsonSerializerContext.g.cs +++ b/src/libs/Gradium/Generated/Gradium.JsonSerializerContext.g.cs @@ -17,6 +17,10 @@ namespace Gradium typeof(global::Gradium.JsonConverters.BodyCreateVoiceVoicesPostLanguageNullableJsonConverter), + typeof(global::Gradium.JsonConverters.VoiceGenerationRequestLanguageJsonConverter), + + typeof(global::Gradium.JsonConverters.VoiceGenerationRequestLanguageNullableJsonConverter), + typeof(global::Gradium.JsonConverters.PostTextToSpeechRequestOutputFormatJsonConverter), typeof(global::Gradium.JsonConverters.PostTextToSpeechRequestOutputFormatNullableJsonConverter), @@ -70,6 +74,17 @@ namespace Gradium [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceUpdate))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.AnyOf), TypeInfoPropertyName = "AnyOfStringBooleanObject2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceGeneratorConfig))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceGenerationRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceGenerationRequestLanguage), TypeInfoPropertyName = "VoiceGenerationRequestLanguage2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.GeneratedEmbedding))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceGenerationResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceEmbeddingResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceEmbeddingListResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceFromEmbeddingCreate))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.VoiceFromEmbeddingResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.PostTextToSpeechRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.PostTextToSpeechRequestOutputFormat), TypeInfoPropertyName = "PostTextToSpeechRequestOutputFormat2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Gradium.PostSpeechToTextContentType), TypeInfoPropertyName = "PostSpeechToTextContentType2")] @@ -81,6 +96,8 @@ namespace Gradium [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List>))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] public sealed partial class SourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext { diff --git a/src/libs/Gradium/Generated/Gradium.JsonSerializerContextTypes.g.cs b/src/libs/Gradium/Generated/Gradium.JsonSerializerContextTypes.g.cs index 6666617..72c65e7 100644 --- a/src/libs/Gradium/Generated/Gradium.JsonSerializerContextTypes.g.cs +++ b/src/libs/Gradium/Generated/Gradium.JsonSerializerContextTypes.g.cs @@ -165,23 +165,67 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Gradium.PostTextToSpeechRequest? Type33 { get; set; } + public global::Gradium.VoiceGeneratorConfig? Type33 { get; set; } /// /// /// - public global::Gradium.PostTextToSpeechRequestOutputFormat? Type34 { get; set; } + public global::Gradium.VoiceGenerationRequest? Type34 { get; set; } /// /// /// - public global::Gradium.PostSpeechToTextContentType? Type35 { get; set; } + public global::Gradium.VoiceGenerationRequestLanguage? Type35 { get; set; } /// /// /// - public global::Gradium.PostSpeechToTextInputFormat? Type36 { get; set; } + public global::Gradium.GeneratedEmbedding? Type36 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type37 { get; set; } + public global::Gradium.VoiceGenerationResponse? Type37 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type38 { get; set; } + /// + /// + /// + public global::Gradium.VoiceEmbeddingResponse? Type39 { get; set; } + /// + /// + /// + public global::Gradium.VoiceEmbeddingListResponse? Type40 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type41 { get; set; } + /// + /// + /// + public global::Gradium.VoiceFromEmbeddingCreate? Type42 { get; set; } + /// + /// + /// + public global::Gradium.VoiceFromEmbeddingResponse? Type43 { get; set; } + /// + /// + /// + public global::Gradium.PostTextToSpeechRequest? Type44 { get; set; } + /// + /// + /// + public global::Gradium.PostTextToSpeechRequestOutputFormat? Type45 { get; set; } + /// + /// + /// + public global::Gradium.PostSpeechToTextContentType? Type46 { get; set; } + /// + /// + /// + public global::Gradium.PostSpeechToTextInputFormat? Type47 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type48 { get; set; } /// /// @@ -214,6 +258,14 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::System.Collections.Generic.List? ListType7 { get; set; } + public global::System.Collections.Generic.List? ListType7 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType8 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType9 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.Json.g.cs new file mode 100644 index 0000000..174d0c7 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class GeneratedEmbedding + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.GeneratedEmbedding? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.GeneratedEmbedding), + jsonSerializerContext) as global::Gradium.GeneratedEmbedding; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.GeneratedEmbedding? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.GeneratedEmbedding? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.GeneratedEmbedding), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.GeneratedEmbedding; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.g.cs b/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.g.cs new file mode 100644 index 0000000..fc92142 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.GeneratedEmbedding.g.cs @@ -0,0 +1,71 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class GeneratedEmbedding + { + /// + /// Candidate id, prefixed `vox_emb_`. Pass it as `voice_id` to audition the candidate. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("embedding_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string EmbeddingId { get; set; } + + /// + /// Whether the candidate has finished generating. Newly created candidates start as `false`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("ready")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool Ready { get; set; } + + /// + /// UTC time the candidate is removed, 30 days after creation. Cleared once you keep the candidate. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime ExpiresAt { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Candidate id, prefixed `vox_emb_`. Pass it as `voice_id` to audition the candidate. + /// + /// + /// Whether the candidate has finished generating. Newly created candidates start as `false`. + /// + /// + /// UTC time the candidate is removed, 30 days after creation. Cleared once you keep the candidate. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GeneratedEmbedding( + string embeddingId, + bool ready, + global::System.DateTime expiresAt) + { + this.EmbeddingId = embeddingId ?? throw new global::System.ArgumentNullException(nameof(embeddingId)); + this.Ready = ready; + this.ExpiresAt = expiresAt; + } + + /// + /// Initializes a new instance of the class. + /// + public GeneratedEmbedding() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.Json.g.cs new file mode 100644 index 0000000..2cb189f --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceEmbeddingListResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceEmbeddingListResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceEmbeddingListResponse), + jsonSerializerContext) as global::Gradium.VoiceEmbeddingListResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceEmbeddingListResponse? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceEmbeddingListResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceEmbeddingListResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceEmbeddingListResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.g.cs new file mode 100644 index 0000000..8f055e1 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingListResponse.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class VoiceEmbeddingListResponse + { + /// + /// Matching candidates, newest first. An id this organization does not hold returns an empty list, so check the list before indexing into it. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("embeddings")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Embeddings { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Matching candidates, newest first. An id this organization does not hold returns an empty list, so check the list before indexing into it. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceEmbeddingListResponse( + global::System.Collections.Generic.IList embeddings) + { + this.Embeddings = embeddings ?? throw new global::System.ArgumentNullException(nameof(embeddings)); + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceEmbeddingListResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.Json.g.cs new file mode 100644 index 0000000..1a35a13 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceEmbeddingResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceEmbeddingResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceEmbeddingResponse), + jsonSerializerContext) as global::Gradium.VoiceEmbeddingResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceEmbeddingResponse? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceEmbeddingResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceEmbeddingResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceEmbeddingResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.g.cs new file mode 100644 index 0000000..b9d7d04 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceEmbeddingResponse.g.cs @@ -0,0 +1,93 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// Timestamps are UTC. Parse them as UTC whether or not a trailing `Z` is present. + /// + public sealed partial class VoiceEmbeddingResponse + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("embedding_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string EmbeddingId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("ready")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool Ready { get; set; } + + /// + /// The description the candidate was generated from. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + public string? Prompt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime? CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] + public global::System.DateTime? ExpiresAt { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// The description the candidate was generated from. + /// + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceEmbeddingResponse( + string embeddingId, + bool ready, + string? prompt, + string? language, + global::System.DateTime? createdAt, + global::System.DateTime? expiresAt) + { + this.EmbeddingId = embeddingId ?? throw new global::System.ArgumentNullException(nameof(embeddingId)); + this.Ready = ready; + this.Prompt = prompt; + this.Language = language; + this.CreatedAt = createdAt; + this.ExpiresAt = expiresAt; + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceEmbeddingResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.Json.g.cs new file mode 100644 index 0000000..0818228 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceFromEmbeddingCreate + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceFromEmbeddingCreate? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceFromEmbeddingCreate), + jsonSerializerContext) as global::Gradium.VoiceFromEmbeddingCreate; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceFromEmbeddingCreate? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceFromEmbeddingCreate? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceFromEmbeddingCreate), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceFromEmbeddingCreate; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.g.cs new file mode 100644 index 0000000..3c79086 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingCreate.g.cs @@ -0,0 +1,70 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class VoiceFromEmbeddingCreate + { + /// + /// Id of the candidate to keep, as returned by `POST /voice-generator/generate`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("voxium_embedding_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string VoxiumEmbeddingId { get; set; } + + /// + /// A name for the voice. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// An optional description of the voice. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Id of the candidate to keep, as returned by `POST /voice-generator/generate`. + /// + /// + /// A name for the voice. + /// + /// + /// An optional description of the voice. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceFromEmbeddingCreate( + string voxiumEmbeddingId, + string name, + string? description) + { + this.VoxiumEmbeddingId = voxiumEmbeddingId ?? throw new global::System.ArgumentNullException(nameof(voxiumEmbeddingId)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Description = description; + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceFromEmbeddingCreate() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.Json.g.cs new file mode 100644 index 0000000..bceed4f --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceFromEmbeddingResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceFromEmbeddingResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceFromEmbeddingResponse), + jsonSerializerContext) as global::Gradium.VoiceFromEmbeddingResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceFromEmbeddingResponse? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceFromEmbeddingResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceFromEmbeddingResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceFromEmbeddingResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.g.cs new file mode 100644 index 0000000..7106708 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceFromEmbeddingResponse.g.cs @@ -0,0 +1,75 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class VoiceFromEmbeddingResponse + { + /// + /// The permanent `voice_id`. Store this one: it is stable for the life of the voice. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("uid")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Uid { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("language")] + public string? Language { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The permanent `voice_id`. Store this one: it is stable for the life of the voice. + /// + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceFromEmbeddingResponse( + string uid, + string name, + string? description, + string? language) + { + this.Uid = uid ?? throw new global::System.ArgumentNullException(nameof(uid)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Description = description; + this.Language = language; + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceFromEmbeddingResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.Json.g.cs new file mode 100644 index 0000000..e239816 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceGenerationRequest + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceGenerationRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceGenerationRequest), + jsonSerializerContext) as global::Gradium.VoiceGenerationRequest; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceGenerationRequest? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceGenerationRequest? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceGenerationRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceGenerationRequest; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.g.cs new file mode 100644 index 0000000..bddc49e --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequest.g.cs @@ -0,0 +1,84 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class VoiceGenerationRequest + { + /// + /// The voice description, up to 500 characters. Must contain actual text, not only spaces. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// Language the voice will speak. Shapes the accent and the delivery. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("language")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Gradium.JsonConverters.VoiceGenerationRequestLanguageJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Gradium.VoiceGenerationRequestLanguage Language { get; set; } + + /// + /// Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.
+ /// Default Value: 1 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("n_samples")] + public int? NSamples { get; set; } + + /// + /// Advanced sampling options. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("json_config")] + public global::Gradium.VoiceGeneratorConfig? JsonConfig { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The voice description, up to 500 characters. Must contain actual text, not only spaces. + /// + /// + /// Language the voice will speak. Shapes the accent and the delivery. + /// + /// + /// Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.
+ /// Default Value: 1 + /// + /// + /// Advanced sampling options. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceGenerationRequest( + string prompt, + global::Gradium.VoiceGenerationRequestLanguage language, + int? nSamples, + global::Gradium.VoiceGeneratorConfig? jsonConfig) + { + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Language = language; + this.NSamples = nSamples; + this.JsonConfig = jsonConfig; + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceGenerationRequest() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequestLanguage.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequestLanguage.g.cs new file mode 100644 index 0000000..5f19807 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationRequestLanguage.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// Language the voice will speak. Shapes the accent and the delivery. + /// + public enum VoiceGenerationRequestLanguage + { + /// + /// + /// + De, + /// + /// + /// + En, + /// + /// + /// + Es, + /// + /// + /// + Fr, + /// + /// + /// + Pt, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class VoiceGenerationRequestLanguageExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this VoiceGenerationRequestLanguage value) + { + return value switch + { + VoiceGenerationRequestLanguage.De => "de", + VoiceGenerationRequestLanguage.En => "en", + VoiceGenerationRequestLanguage.Es => "es", + VoiceGenerationRequestLanguage.Fr => "fr", + VoiceGenerationRequestLanguage.Pt => "pt", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static VoiceGenerationRequestLanguage? ToEnum(string value) + { + return value switch + { + "de" => VoiceGenerationRequestLanguage.De, + "en" => VoiceGenerationRequestLanguage.En, + "es" => VoiceGenerationRequestLanguage.Es, + "fr" => VoiceGenerationRequestLanguage.Fr, + "pt" => VoiceGenerationRequestLanguage.Pt, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.Json.g.cs new file mode 100644 index 0000000..d389f51 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceGenerationResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceGenerationResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceGenerationResponse), + jsonSerializerContext) as global::Gradium.VoiceGenerationResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceGenerationResponse? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceGenerationResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceGenerationResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceGenerationResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.g.cs new file mode 100644 index 0000000..1ba4278 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGenerationResponse.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// + /// + public sealed partial class VoiceGenerationResponse + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("embeddings")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Embeddings { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceGenerationResponse( + global::System.Collections.Generic.IList embeddings) + { + this.Embeddings = embeddings ?? throw new global::System.ArgumentNullException(nameof(embeddings)); + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceGenerationResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.Json.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.Json.g.cs new file mode 100644 index 0000000..5a220fb --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Gradium +{ + public sealed partial class VoiceGeneratorConfig + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Gradium.VoiceGeneratorConfig? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Gradium.VoiceGeneratorConfig), + jsonSerializerContext) as global::Gradium.VoiceGeneratorConfig; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Gradium.VoiceGeneratorConfig? FromJson( + string json) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Gradium.VoiceGeneratorConfig? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Gradium.VoiceGeneratorConfig), + jsonSerializerContext).ConfigureAwait(false)) as global::Gradium.VoiceGeneratorConfig; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Gradium.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.g.cs b/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.g.cs new file mode 100644 index 0000000..5a828eb --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.Models.VoiceGeneratorConfig.g.cs @@ -0,0 +1,83 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// Advanced sampling options for voice generation. The defaults are tuned, so send only the keys you need. + /// + public sealed partial class VoiceGeneratorConfig + { + /// + /// How closely the sampled voice follows the description. Higher is more literal and less varied.
+ /// Default Value: 5F + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("cfg_scale")] + public double? CfgScale { get; set; } + + /// + /// Sampling steps. More steps takes more time.
+ /// Default Value: 16 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("steps")] + public int? Steps { get; set; } + + /// + /// Fixes the noise draw. Unset by default. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + public int? Seed { get; set; } + + /// + /// Target recording quality of the voice. Defaults to 3.1 for `en` and 3.0 for other languages. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("utmos_score")] + public double? UtmosScore { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// How closely the sampled voice follows the description. Higher is more literal and less varied.
+ /// Default Value: 5F + /// + /// + /// Sampling steps. More steps takes more time.
+ /// Default Value: 16 + /// + /// + /// Fixes the noise draw. Unset by default. + /// + /// + /// Target recording quality of the voice. Defaults to 3.1 for `en` and 3.0 for other languages. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public VoiceGeneratorConfig( + double? cfgScale, + int? steps, + int? seed, + double? utmosScore) + { + this.CfgScale = cfgScale; + this.Steps = steps; + this.Seed = seed; + this.UtmosScore = utmosScore; + } + + /// + /// Initializes a new instance of the class. + /// + public VoiceGeneratorConfig() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs new file mode 100644 index 0000000..c1cf667 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.CreateVoiceFromEmbeddingVoicesFromEmbeddingPost.g.cs @@ -0,0 +1,547 @@ + +#nullable enable + +namespace Gradium +{ + public partial class VoiceDesignClient + { + + + private static readonly global::Gradium.EndPointSecurityRequirement s_CreateVoiceFromEmbeddingVoicesFromEmbeddingPostSecurityRequirement0 = + new global::Gradium.EndPointSecurityRequirement + { + Authorizations = new global::Gradium.EndPointAuthorizationRequirement[] + { new global::Gradium.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXApiKey", + Location = "Header", + Name = "x-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Gradium.EndPointSecurityRequirement[] s_CreateVoiceFromEmbeddingVoicesFromEmbeddingPostSecurityRequirements = + new global::Gradium.EndPointSecurityRequirement[] + { s_CreateVoiceFromEmbeddingVoicesFromEmbeddingPostSecurityRequirement0, + }; + partial void PrepareCreateVoiceFromEmbeddingVoicesFromEmbeddingPostArguments( + global::System.Net.Http.HttpClient httpClient, + global::Gradium.VoiceFromEmbeddingCreate request); + partial void PrepareCreateVoiceFromEmbeddingVoicesFromEmbeddingPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Gradium.VoiceFromEmbeddingCreate request); + partial void ProcessCreateVoiceFromEmbeddingVoicesFromEmbeddingPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCreateVoiceFromEmbeddingVoicesFromEmbeddingPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + + global::Gradium.VoiceFromEmbeddingCreate request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsResponseAsync( + + global::Gradium.VoiceFromEmbeddingCreate request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareCreateVoiceFromEmbeddingVoicesFromEmbeddingPostArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Gradium.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateVoiceFromEmbeddingVoicesFromEmbeddingPostSecurityRequirements, + operationName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync"); + + using var __timeoutCancellationTokenSource = global::Gradium.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Gradium.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Gradium.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Gradium.PathBuilder( + path: "/voices/from-embedding", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Gradium.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::Gradium.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateVoiceFromEmbeddingVoicesFromEmbeddingPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Gradium.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPost", + methodName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync", + pathTemplate: "\"/voices/from-embedding\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPost", + methodName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync", + pathTemplate: "\"/voices/from-embedding\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Gradium.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPost", + methodName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync", + pathTemplate: "\"/voices/from-embedding\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCreateVoiceFromEmbeddingVoicesFromEmbeddingPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPost", + methodName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync", + pathTemplate: "\"/voices/from-embedding\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPost", + methodName: "CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync", + pathTemplate: "\"/voices/from-embedding\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Gradium.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateVoiceFromEmbeddingVoicesFromEmbeddingPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Gradium.VoiceFromEmbeddingResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Gradium.VoiceFromEmbeddingResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Create Voice From Candidate
+ /// Keep a generated candidate as a permanent voice in your organization.
+ /// The response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.
+ /// Keeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made. + ///
+ /// + /// Id of the candidate to keep, as returned by `POST /voice-generator/generate`. + /// + /// + /// A name for the voice. + /// + /// + /// An optional description of the voice. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + string voxiumEmbeddingId, + string name, + string? description = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Gradium.VoiceFromEmbeddingCreate + { + VoxiumEmbeddingId = voxiumEmbeddingId, + Name = name, + Description = description, + }; + + return await CreateVoiceFromEmbeddingVoicesFromEmbeddingPostAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs new file mode 100644 index 0000000..159a598 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete.g.cs @@ -0,0 +1,442 @@ + +#nullable enable + +namespace Gradium +{ + public partial class VoiceDesignClient + { + + + private static readonly global::Gradium.EndPointSecurityRequirement s_DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteSecurityRequirement0 = + new global::Gradium.EndPointSecurityRequirement + { + Authorizations = new global::Gradium.EndPointAuthorizationRequirement[] + { new global::Gradium.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXApiKey", + Location = "Header", + Name = "x-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Gradium.EndPointSecurityRequirement[] s_DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteSecurityRequirements = + new global::Gradium.EndPointSecurityRequirement[] + { s_DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteSecurityRequirement0, + }; + partial void PrepareDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteArguments( + global::System.Net.Http.HttpClient httpClient, + ref string embeddingId); + partial void PrepareDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string embeddingId); + partial void ProcessDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Delete Voice Candidate
+ /// Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days.
+ /// Safe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync( + string embeddingId, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsResponseAsync( + embeddingId: embeddingId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete Voice Candidate
+ /// Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days.
+ /// Safe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsResponseAsync( + string embeddingId, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteArguments( + httpClient: HttpClient, + embeddingId: ref embeddingId); + + + var __authorizations = global::Gradium.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteSecurityRequirements, + operationName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync"); + + using var __timeoutCancellationTokenSource = global::Gradium.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Gradium.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Gradium.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Gradium.PathBuilder( + path: $"/voice-generator/embeddings/{embeddingId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Gradium.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Gradium.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + embeddingId: embeddingId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Gradium.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete", + methodName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync", + pathTemplate: "$\"/voice-generator/embeddings/{embeddingId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete", + methodName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync", + pathTemplate: "$\"/voice-generator/embeddings/{embeddingId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Gradium.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete", + methodName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync", + pathTemplate: "$\"/voice-generator/embeddings/{embeddingId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessDeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete", + methodName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync", + pathTemplate: "$\"/voice-generator/embeddings/{embeddingId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDelete", + methodName: "DeleteVoiceEmbeddingVoiceGeneratorEmbeddingsEmbeddingIdDeleteAsync", + pathTemplate: "$\"/voice-generator/embeddings/{embeddingId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Gradium.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); + } + catch (global::System.Exception __ex) + { + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs new file mode 100644 index 0000000..894a62a --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.GenerateVoiceVoiceGeneratorGeneratePost.g.cs @@ -0,0 +1,521 @@ + +#nullable enable + +namespace Gradium +{ + public partial class VoiceDesignClient + { + + + private static readonly global::Gradium.EndPointSecurityRequirement s_GenerateVoiceVoiceGeneratorGeneratePostSecurityRequirement0 = + new global::Gradium.EndPointSecurityRequirement + { + Authorizations = new global::Gradium.EndPointAuthorizationRequirement[] + { new global::Gradium.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXApiKey", + Location = "Header", + Name = "x-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Gradium.EndPointSecurityRequirement[] s_GenerateVoiceVoiceGeneratorGeneratePostSecurityRequirements = + new global::Gradium.EndPointSecurityRequirement[] + { s_GenerateVoiceVoiceGeneratorGeneratePostSecurityRequirement0, + }; + partial void PrepareGenerateVoiceVoiceGeneratorGeneratePostArguments( + global::System.Net.Http.HttpClient httpClient, + global::Gradium.VoiceGenerationRequest request); + partial void PrepareGenerateVoiceVoiceGeneratorGeneratePostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Gradium.VoiceGenerationRequest request); + partial void ProcessGenerateVoiceVoiceGeneratorGeneratePostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGenerateVoiceVoiceGeneratorGeneratePostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GenerateVoiceVoiceGeneratorGeneratePostAsync( + + global::Gradium.VoiceGenerationRequest request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GenerateVoiceVoiceGeneratorGeneratePostAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GenerateVoiceVoiceGeneratorGeneratePostAsResponseAsync( + + global::Gradium.VoiceGenerationRequest request, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareGenerateVoiceVoiceGeneratorGeneratePostArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Gradium.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GenerateVoiceVoiceGeneratorGeneratePostSecurityRequirements, + operationName: "GenerateVoiceVoiceGeneratorGeneratePostAsync"); + + using var __timeoutCancellationTokenSource = global::Gradium.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Gradium.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Gradium.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Gradium.PathBuilder( + path: "/voice-generator/generate", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Gradium.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::Gradium.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGenerateVoiceVoiceGeneratorGeneratePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Gradium.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateVoiceVoiceGeneratorGeneratePost", + methodName: "GenerateVoiceVoiceGeneratorGeneratePostAsync", + pathTemplate: "\"/voice-generator/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateVoiceVoiceGeneratorGeneratePost", + methodName: "GenerateVoiceVoiceGeneratorGeneratePostAsync", + pathTemplate: "\"/voice-generator/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Gradium.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateVoiceVoiceGeneratorGeneratePost", + methodName: "GenerateVoiceVoiceGeneratorGeneratePostAsync", + pathTemplate: "\"/voice-generator/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGenerateVoiceVoiceGeneratorGeneratePostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateVoiceVoiceGeneratorGeneratePost", + methodName: "GenerateVoiceVoiceGeneratorGeneratePostAsync", + pathTemplate: "\"/voice-generator/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateVoiceVoiceGeneratorGeneratePost", + methodName: "GenerateVoiceVoiceGeneratorGeneratePostAsync", + pathTemplate: "\"/voice-generator/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Gradium.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGenerateVoiceVoiceGeneratorGeneratePostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Gradium.VoiceGenerationResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Gradium.VoiceGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Generate Voice Candidates
+ /// Sample candidate voices from a written description. No reference audio is involved.
+ /// Generation runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.
+ /// Every request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow. + ///
+ /// + /// The voice description, up to 500 characters. Must contain actual text, not only spaces. + /// + /// + /// Language the voice will speak. Shapes the accent and the delivery. + /// + /// + /// Number of candidate voices to sample from the description. All candidates in one request are variations on the same character.
+ /// Default Value: 1 + /// + /// + /// Advanced sampling options. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GenerateVoiceVoiceGeneratorGeneratePostAsync( + string prompt, + global::Gradium.VoiceGenerationRequestLanguage language, + int? nSamples = default, + global::Gradium.VoiceGeneratorConfig? jsonConfig = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Gradium.VoiceGenerationRequest + { + Prompt = prompt, + Language = language, + NSamples = nSamples, + JsonConfig = jsonConfig, + }; + + return await GenerateVoiceVoiceGeneratorGeneratePostAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs new file mode 100644 index 0000000..d89acdc --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet.g.cs @@ -0,0 +1,498 @@ + +#nullable enable + +namespace Gradium +{ + public partial class VoiceDesignClient + { + + + private static readonly global::Gradium.EndPointSecurityRequirement s_ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetSecurityRequirement0 = + new global::Gradium.EndPointSecurityRequirement + { + Authorizations = new global::Gradium.EndPointAuthorizationRequirement[] + { new global::Gradium.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXApiKey", + Location = "Header", + Name = "x-api-key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Gradium.EndPointSecurityRequirement[] s_ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetSecurityRequirements = + new global::Gradium.EndPointSecurityRequirement[] + { s_ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetSecurityRequirement0, + }; + partial void PrepareListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? embeddingId, + ref int? skip, + ref int? limit); + partial void PrepareListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? embeddingId, + int? skip, + int? limit); + partial void ProcessListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Voice Candidates
+ /// Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first.
+ /// Pass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page.
+ /// A lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it. + ///
+ /// + /// + /// Default Value: 0 + /// + /// + /// Default Value: 100 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync( + string? embeddingId = default, + int? skip = default, + int? limit = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsResponseAsync( + embeddingId: embeddingId, + skip: skip, + limit: limit, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Voice Candidates
+ /// Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first.
+ /// Pass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page.
+ /// A lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it. + ///
+ /// + /// + /// Default Value: 0 + /// + /// + /// Default Value: 100 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsResponseAsync( + string? embeddingId = default, + int? skip = default, + int? limit = default, + global::Gradium.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetArguments( + httpClient: HttpClient, + embeddingId: ref embeddingId, + skip: ref skip, + limit: ref limit); + + + var __authorizations = global::Gradium.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetSecurityRequirements, + operationName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync"); + + using var __timeoutCancellationTokenSource = global::Gradium.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Gradium.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Gradium.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Gradium.PathBuilder( + path: "/voice-generator/embeddings", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("embedding_id", embeddingId) + .AddOptionalParameter("skip", skip?.ToString()) + .AddOptionalParameter("limit", limit?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::Gradium.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Gradium.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + embeddingId: embeddingId, + skip: skip, + limit: limit); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Gradium.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet", + methodName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync", + pathTemplate: "\"/voice-generator/embeddings\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet", + methodName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync", + pathTemplate: "\"/voice-generator/embeddings\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Gradium.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Gradium.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet", + methodName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync", + pathTemplate: "\"/voice-generator/embeddings\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Gradium.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet", + methodName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync", + pathTemplate: "\"/voice-generator/embeddings\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Gradium.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Gradium.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGet", + methodName: "ListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetAsync", + pathTemplate: "\"/voice-generator/embeddings\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Gradium.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Gradium.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListVoiceEmbeddingsVoiceGeneratorEmbeddingsGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Gradium.VoiceEmbeddingListResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Gradium.VoiceEmbeddingListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Gradium.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Gradium.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Gradium.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.g.cs b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.g.cs new file mode 100644 index 0000000..eb664a2 --- /dev/null +++ b/src/libs/Gradium/Generated/Gradium.VoiceDesignClient.g.cs @@ -0,0 +1,144 @@ + +#nullable enable + +namespace Gradium +{ + /// + /// Create voices from a written description
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public sealed partial class VoiceDesignClient : global::Gradium.IVoiceDesignClient, global::System.IDisposable + { + /// + /// Gradium API + /// + public const string DefaultBaseUrl = "https://api.gradium.ai/api"; + + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + + /// + public global::Gradium.AutoSDKClientOptions Options { get; } + + internal global::System.Lazy JsonSerializerContextProvider { get; set; } = new(() => global::Gradium.SourceGenerationContext.Default); + + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext + { + get => JsonSerializerContextProvider.Value; + set => JsonSerializerContextProvider = new(() => value); + } + + + /// + /// Creates a new instance of the VoiceDesignClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. + public VoiceDesignClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the VoiceDesignClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public VoiceDesignClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Gradium.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the VoiceDesignClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public VoiceDesignClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Gradium.AutoSDKClientOptions? options, + bool disposeHttpClient = true) + { + + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::Gradium.AutoSDKClientOptions(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Gradium/openapi.yaml b/src/libs/Gradium/openapi.yaml index d186f6e..00d7a74 100644 --- a/src/libs/Gradium/openapi.yaml +++ b/src/libs/Gradium/openapi.yaml @@ -832,6 +832,203 @@ } ] } + }, + "/voice-generator/generate": { + "post": { + "tags": [ + "Voice Design" + ], + "summary": "Generate Voice Candidates", + "description": "Sample candidate voices from a written description. No reference audio is involved.\n\nGeneration runs in the background, so the candidate ids come back immediately with `ready: false`. Poll `GET /voice-generator/embeddings` every two seconds until each is ready, which typically takes three to five seconds for three candidates.\n\nEvery request mints new ids, and the description is expanded before sampling, so the same description gives a fresh voice each time. Capture the ids from the response and carry them through the rest of the flow.", + "operationId": "generate_voice_voice_generator_generate_post", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceGenerationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceGenerationResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/voice-generator/embeddings": { + "get": { + "tags": [ + "Voice Design" + ], + "summary": "List Voice Candidates", + "description": "Check whether a candidate is ready, or list the candidates belonging to the authenticated organization, newest first.\n\nPass `embedding_id` to look up a single candidate. Omit it to page through all of them with `skip` and `limit`, which is also how you recover ids you did not store. A page shorter than `limit` is the last page.\n\nA lookup for an id this organization does not hold returns `200` with an empty `embeddings` list, so check the list before indexing into it.", + "operationId": "list_voice_embeddings_voice_generator_embeddings_get", + "parameters": [ + { + "name": "embedding_id", + "in": "query", + "required": false, + "description": "Look up a single candidate by id. Omit to list all candidates.", + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Embedding Id" + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "default": 0, + "title": "Skip" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 1000, + "default": 100, + "title": "Limit" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceEmbeddingListResponse" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/voice-generator/embeddings/{embedding_id}": { + "delete": { + "tags": [ + "Voice Design" + ], + "summary": "Delete Voice Candidate", + "description": "Remove a candidate you are not keeping. Candidates you leave alone are removed automatically after 30 days.\n\nSafe at any time: a voice kept from a candidate holds its own copy, so deleting the candidate leaves the voice untouched. An id that is already gone returns `404`, so treat cleanup as best effort.", + "operationId": "delete_voice_embedding_voice_generator_embeddings__embedding_id__delete", + "parameters": [ + { + "name": "embedding_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Embedding Id" + } + } + ], + "responses": { + "204": { + "description": "Successful Response" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } + }, + "/voices/from-embedding": { + "post": { + "tags": [ + "Voice Design" + ], + "summary": "Create Voice From Candidate", + "description": "Keep a generated candidate as a permanent voice in your organization.\n\nThe response field `uid` is the `voice_id` every other endpoint expects: the same value under two names. From here the voice behaves like any other Gradium voice, on one-shot Text-to-Speech, the streaming WebSockets and Speech-to-Speech.\n\nKeeping a candidate is free, since generation is already accounted for, and it clears the candidate's expiry. Store the `embedding_id` to `voice_id` mapping: keeping the same candidate twice returns `409`, and your own record is the cleanest way to find the voice you already made.", + "operationId": "create_voice_from_embedding_voices_from_embedding_post", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceFromEmbeddingCreate" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VoiceFromEmbeddingResponse" + } + } + } + }, + "409": { + "description": "A voice already exists for this candidate" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + } + } } }, "components": { @@ -1533,6 +1730,282 @@ "type": "object", "title": "VoiceUpdate", "description": "Schema for updating voice data." + }, + "VoiceGeneratorConfig": { + "properties": { + "cfg_scale": { + "type": "number", + "minimum": 1.0, + "maximum": 20.0, + "default": 5.0, + "title": "Cfg Scale", + "description": "How closely the sampled voice follows the description. Higher is more literal and less varied." + }, + "steps": { + "type": "integer", + "minimum": 1, + "maximum": 128, + "default": 16, + "title": "Steps", + "description": "Sampling steps. More steps takes more time." + }, + "seed": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Seed", + "description": "Fixes the noise draw. Unset by default." + }, + "utmos_score": { + "type": "number", + "minimum": 1.0, + "maximum": 5.0, + "title": "Utmos Score", + "description": "Target recording quality of the voice. Defaults to 3.1 for `en` and 3.0 for other languages." + } + }, + "type": "object", + "title": "VoiceGeneratorConfig", + "description": "Advanced sampling options for voice generation. The defaults are tuned, so send only the keys you need." + }, + "VoiceGenerationRequest": { + "properties": { + "prompt": { + "type": "string", + "minLength": 1, + "maxLength": 500, + "title": "Prompt", + "description": "The voice description, up to 500 characters. Must contain actual text, not only spaces." + }, + "language": { + "type": "string", + "enum": [ + "en", + "fr", + "es", + "pt", + "de" + ], + "title": "Language", + "description": "Language the voice will speak. Shapes the accent and the delivery." + }, + "n_samples": { + "type": "integer", + "minimum": 1, + "maximum": 5, + "default": 1, + "title": "N Samples", + "description": "Number of candidate voices to sample from the description. All candidates in one request are variations on the same character." + }, + "json_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/VoiceGeneratorConfig" + }, + { + "type": "null" + } + ], + "title": "Json Config", + "description": "Advanced sampling options." + } + }, + "type": "object", + "required": [ + "prompt", + "language" + ], + "title": "VoiceGenerationRequest" + }, + "GeneratedEmbedding": { + "properties": { + "embedding_id": { + "type": "string", + "title": "Embedding Id", + "description": "Candidate id, prefixed `vox_emb_`. Pass it as `voice_id` to audition the candidate." + }, + "ready": { + "type": "boolean", + "title": "Ready", + "description": "Whether the candidate has finished generating. Newly created candidates start as `false`." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "title": "Expires At", + "description": "UTC time the candidate is removed, 30 days after creation. Cleared once you keep the candidate." + } + }, + "type": "object", + "required": [ + "embedding_id", + "ready", + "expires_at" + ], + "title": "GeneratedEmbedding" + }, + "VoiceGenerationResponse": { + "properties": { + "embeddings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GeneratedEmbedding" + }, + "title": "Embeddings" + } + }, + "type": "object", + "required": [ + "embeddings" + ], + "title": "VoiceGenerationResponse" + }, + "VoiceEmbeddingResponse": { + "properties": { + "embedding_id": { + "type": "string", + "title": "Embedding Id" + }, + "ready": { + "type": "boolean", + "title": "Ready" + }, + "prompt": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Prompt", + "description": "The description the candidate was generated from." + }, + "language": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Language" + }, + "created_at": { + "type": "string", + "format": "date-time", + "title": "Created At" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "title": "Expires At" + } + }, + "type": "object", + "required": [ + "embedding_id", + "ready" + ], + "title": "VoiceEmbeddingResponse", + "description": "Timestamps are UTC. Parse them as UTC whether or not a trailing `Z` is present." + }, + "VoiceEmbeddingListResponse": { + "properties": { + "embeddings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VoiceEmbeddingResponse" + }, + "title": "Embeddings", + "description": "Matching candidates, newest first. An id this organization does not hold returns an empty list, so check the list before indexing into it." + } + }, + "type": "object", + "required": [ + "embeddings" + ], + "title": "VoiceEmbeddingListResponse" + }, + "VoiceFromEmbeddingCreate": { + "properties": { + "voxium_embedding_id": { + "type": "string", + "title": "Voxium Embedding Id", + "description": "Id of the candidate to keep, as returned by `POST /voice-generator/generate`." + }, + "name": { + "type": "string", + "title": "Name", + "description": "A name for the voice." + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description", + "description": "An optional description of the voice." + } + }, + "type": "object", + "required": [ + "voxium_embedding_id", + "name" + ], + "title": "VoiceFromEmbeddingCreate" + }, + "VoiceFromEmbeddingResponse": { + "properties": { + "uid": { + "type": "string", + "title": "Uid", + "description": "The permanent `voice_id`. Store this one: it is stable for the life of the voice." + }, + "name": { + "type": "string", + "title": "Name" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "language": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Language" + } + }, + "type": "object", + "required": [ + "uid", + "name" + ], + "title": "VoiceFromEmbeddingResponse" } } }, @@ -1551,6 +2024,7 @@ "TTS", "STT", "Voices", + "Voice Design", "Pronunciations", "Credits" ] @@ -1582,6 +2056,10 @@ "name": "Voices", "description": "Manage custom voice clones" }, + { + "name": "Voice Design", + "description": "Create voices from a written description" + }, { "name": "Pronunciations", "description": "Manage pronunciation dictionaries for custom text rewriting"