Skip to content

Commit

Permalink
ElevenLabs-DotNet-Proxy 2.2.2 (#45)
Browse files Browse the repository at this point in the history
- Updated EndpointRouteBuilder with optional route prefix parameter
  • Loading branch information
StephenHodgson authored May 9, 2024
1 parent 9e89efe commit c7a2a95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions ElevenLabs-DotNet-Proxy/ElevenLabs-DotNet-Proxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
<PackageTags>ElevenLabs, AI, ML, API, api-proxy, proxy, gateway</PackageTags>
<Title>ElevenLabs API Proxy</Title>
<PackageId>ElevenLabs-DotNet-Proxy</PackageId>
<Version>2.2.1</Version>
<Version>2.2.2</Version>
<RootNamespace>ElevenLabs.Proxy</RootNamespace>
<PackageReleaseNotes>Version 2.2.1
<PackageReleaseNotes>Version 2.2.2
- Updated EndpointRouteBuilder with optional route prefix parameter
Version 2.2.1
- Refactor with modern WebApplication builder
- Added ElevenLabs.Proxy.EndpointRouteBuilder
</PackageReleaseNotes>
Expand Down
2 changes: 1 addition & 1 deletion ElevenLabs-DotNet-Proxy/Proxy/ElevenLabsProxyStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static IHost CreateDefaultHost<T>(string[] args, ElevenLabsClient elevenL
/// </summary>
/// <typeparam name="T"><see cref="IAuthenticationFilter"/> type to use to validate your custom issued tokens.</typeparam>
/// <param name="args">Startup args.</param>
/// <param name="openAIClient"><see cref="OpenAIClient"/> with configured <see cref="OpenAIAuthentication"/> and <see cref="OpenAIClientSettings"/>.</param>
/// <param name="elevenLabsClient"><see cref="ElevenLabsClient"/> with configured <see cref="ElevenLabsAuthentication"/> and <see cref="ElevenLabsClientSettings"/>.</param>
public static WebApplication CreateWebApplication<T>(string[] args, ElevenLabsClient elevenLabsClient) where T : class, IAuthenticationFilter
{
var builder = WebApplication.CreateBuilder(args);
Expand Down
12 changes: 9 additions & 3 deletions ElevenLabs-DotNet-Proxy/Proxy/EndpointRouteBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ public static class EndpointRouteBuilder
#endif
};

public static void MapElevenLabsEndpoints(this IEndpointRouteBuilder endpoints,
ElevenLabsClient elevenLabsClient, IAuthenticationFilter authenticationFilter)
/// <summary>
/// Maps the <see cref="ElevenLabsClient"/> endpoints.
/// </summary>
/// <param name="endpoints"><see cref="IEndpointRouteBuilder"/>.</param>
/// <param name="elevenLabsClient"><see cref="ElevenLabsClient"/>.</param>
/// <param name="authenticationFilter"><see cref="IAuthenticationFilter"/>.</param>
/// <param name="routePrefix">Optional, custom route prefix. i.e. '/elevenlabs'.</param>
public static void MapElevenLabsEndpoints(this IEndpointRouteBuilder endpoints, ElevenLabsClient elevenLabsClient, IAuthenticationFilter authenticationFilter, string routePrefix = "")
{
endpoints.Map($"{elevenLabsClient.ElevenLabsClientSettings.BaseRequest}{{**endpoint}}", HandleRequest);
endpoints.Map($"{routePrefix}{elevenLabsClient.ElevenLabsClientSettings.BaseRequest}{{**endpoint}}", HandleRequest);

async Task HandleRequest(HttpContext httpContext, string endpoint)
{
Expand Down

0 comments on commit c7a2a95

Please sign in to comment.