Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#nullable enable

namespace SmallestAI
{
public sealed partial class ElectronClient
{

/// <inheritdoc/>
public void AuthorizeUsingBearer(
string apiKey)
{
apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));

for (var i = Authorizations.Count - 1; i >= 0; i--)
{
var __authorization = Authorizations[i];
if (__authorization.Type == "Http" &&
__authorization.Name == "Bearer")
{
Authorizations.RemoveAt(i);
}
}

Authorizations.Add(new global::SmallestAI.EndPointAuthorization
{
Type = "Http",
SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
Value = apiKey,
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#nullable enable

namespace SmallestAI
{
public sealed partial class ElectronClient
{
/// <inheritdoc cref="ElectronClient(global::System.Net.Http.HttpClient?, global::System.Uri?, global::System.Collections.Generic.List{global::SmallestAI.EndPointAuthorization}?, bool)"/>

public ElectronClient(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::SmallestAI.EndPointAuthorization>? authorizations = null,
bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient)
{
Authorizing(HttpClient, ref apiKey);

AuthorizeUsingBearer(apiKey);

Authorized(HttpClient);
}

partial void Authorizing(
global::System.Net.Http.HttpClient client,
ref string apiKey);
partial void Authorized(
global::System.Net.Http.HttpClient client);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed partial class ElectronClient : global::SmallestAI.IElectronClient,
/// <inheritdoc/>
public global::SmallestAI.AutoSDKClientOptions Options { get; }

internal global::System.Lazy<global::System.Text.Json.Serialization.JsonSerializerContext> JsonSerializerContextProvider { get; set; } = new(() => global::SmallestAI.SourceGenerationContext.Default);
internal global::System.Lazy<global::System.Text.Json.Serialization.JsonSerializerContext> JsonSerializerContextProvider { get; set; } = new(() => global::SmallestAI.ElectronSourceGenerationContext.Default);

/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface IElectronClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface IPronunciationDictionariesClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface ISpeechToTextClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface ITextToSpeechClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface IVoiceCloningClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace SmallestAI
{
public partial interface IVoicesClient
{
/// <summary>
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@

#nullable enable

#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant

namespace SmallestAI
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonSourceGenerationOptions(
DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
Converters = new global::System.Type[]
{
})]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary<string, string>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary<string, object>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<object>), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Text.Json.JsonElement?))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(string))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(bool))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.PronunciationItem))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.PronunciationDict))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList<global::SmallestAI.PronunciationItem>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.ErrorResponseDetailsItems))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.ErrorResponse))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList<global::SmallestAI.ErrorResponseDetailsItems>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.CreatePronunciationDictRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.UpdatePronunciationDictRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.UpdatePronunciationDictResponse))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.DeletePronunciationDictRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::SmallestAI.DeletePronunciationDictResponse))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList<global::SmallestAI.PronunciationDict>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(bool?))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime?))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::SmallestAI.PronunciationItem>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::SmallestAI.ErrorResponseDetailsItems>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::SmallestAI.PronunciationDict>))]
internal sealed partial class PronunciationDictionariesSourceGenerationContextChunk0 : global::System.Text.Json.Serialization.JsonSerializerContext
{
}
/// <summary>
///
/// </summary>
public sealed partial class PronunciationDictionariesSourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext
{
private static readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver Resolver = new LazyChunkResolver();


private static readonly global::System.Text.Json.JsonSerializerOptions DefaultOptions = CreateDefaultOptions();

/// <summary>
///
/// </summary>
public static PronunciationDictionariesSourceGenerationContext Default { get; } = new(DefaultOptions);

private PronunciationDictionariesSourceGenerationContext(global::System.Text.Json.JsonSerializerOptions options)
: base(options)
{
}

/// <inheritdoc />
protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions => DefaultOptions;

/// <inheritdoc />
public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)
{
return Resolver.GetTypeInfo(type, Options);
}

/// <summary>
/// Adds this package's converters to <paramref name="options"/>.
/// </summary>
/// <remarks>
/// A converter has to be on the options a chained resolver builds its JsonTypeInfo against,
/// and a context resolves types from every package below it. Each package contributes only
/// what it owns and calls down the chain for the rest, so the family's converter table is
/// written once rather than copied into all of them.
/// </remarks>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public static void AddConverters(global::System.Text.Json.JsonSerializerOptions options)
{
options.Converters.Add(new global::SmallestAI.JsonConverters.UnixTimestampJsonConverter());
}

private static global::System.Text.Json.JsonSerializerOptions CreateDefaultOptions()
{
var options = new global::System.Text.Json.JsonSerializerOptions
{
DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
TypeInfoResolver = Resolver,
};
AddConverters(options);

return options;
}

private sealed class LazyChunkResolver : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver
{
private readonly object _gate = new();
private readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[] _resolvers = new global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[1];

public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(
global::System.Type type,
global::System.Text.Json.JsonSerializerOptions options)
{
for (var index = 0; index < _resolvers.Length; index++)
{
var typeInfo = GetResolver(index).GetTypeInfo(type, options);
if (typeInfo is not null)
{
return typeInfo;
}
}

return null;
}

private global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver GetResolver(int index)
{
var resolver = global::System.Threading.Volatile.Read(ref _resolvers[index]);
if (resolver is not null)
{
return resolver;
}

lock (_gate)
{
return _resolvers[index] ??= CreateResolver(index);
}
}

private static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver CreateResolver(int index)
{
return index switch
{
0 => new PronunciationDictionariesSourceGenerationContextChunk0(new global::System.Text.Json.JsonSerializerOptions()),
_ => throw new global::System.ArgumentOutOfRangeException(nameof(index)),
};
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#nullable enable

namespace SmallestAI
{
public sealed partial class PronunciationDictionariesClient
{

/// <inheritdoc/>
public void AuthorizeUsingBearer(
string apiKey)
{
apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));

for (var i = Authorizations.Count - 1; i >= 0; i--)
{
var __authorization = Authorizations[i];
if (__authorization.Type == "Http" &&
__authorization.Name == "Bearer")
{
Authorizations.RemoveAt(i);
}
}

Authorizations.Add(new global::SmallestAI.EndPointAuthorization
{
Type = "Http",
SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
Value = apiKey,
});
}
}
}
Loading