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
4 changes: 2 additions & 2 deletions src/cli/Rime.CLI/Rime.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MinVer" Version="8.0.0">
<PackageReference Include="MinVer" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.12" />
<PackageReference Include="System.CommandLine" Version="2.0.7" />
<ProjectReference Include="../../libs/Rime/Rime.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#nullable enable

namespace Rime
{
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 Rime
{
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,35 @@

#nullable enable

namespace Rime
{
public sealed partial class TextToSpeechClient
{

/// <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::Rime.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 Rime
{
public sealed partial class TextToSpeechClient
{
/// <inheritdoc cref="TextToSpeechClient(global::System.Net.Http.HttpClient?, global::System.Uri?, global::System.Collections.Generic.List{global::Rime.EndPointAuthorization}?, bool)"/>

public TextToSpeechClient(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::Rime.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
@@ -0,0 +1,35 @@

#nullable enable

namespace Rime
{
public sealed partial class VoicesClient
{

/// <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::Rime.EndPointAuthorization
{
Type = "Http",
SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
Value = apiKey,
});
}
}
}
31 changes: 31 additions & 0 deletions src/libs/Rime/Generated/Rime.VoicesClient.Constructors.Bearer.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#nullable enable

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

public VoicesClient(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::Rime.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);

}
}
Loading