Skip to content

[OpenAPI] Add endpoint for view event details #207 #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
9 changes: 9 additions & 0 deletions src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEndpointUrls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace AzureOpenAIProxy.ApiApp.Endpoints;

public static class AdminEndpointUrls
{
/// <summary>
/// Declares the admin event details endpoint.
/// </summary>
public const string AdminEventDetails = "/admin/events/{eventId}";
}
43 changes: 43 additions & 0 deletions src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using AzureOpenAIProxy.ApiApp.Models;

using Microsoft.AspNetCore.Mvc;

namespace AzureOpenAIProxy.ApiApp.Endpoints;

/// <summary>
/// This represents the endpoint entity for get event details by admin
/// </summary>
public static class AdminEventEndpoints
{
/// <summary>
/// Adds the get event details by admin endpoint
/// </summary>
/// <param name="app"><see cref="WebApplication"/> instance.</param>
/// <returns>Returns <see cref="RouteHandlerBuilder"/> instance.</returns>
public static RouteHandlerBuilder AddAdminEvents(this WebApplication app)
{
// Todo: Issue #19 https://github.com/aliencube/azure-openai-sdk-proxy/issues/19
// Need authorization by admin
var builder = app.MapGet(AdminEndpointUrls.AdminEventDetails, (
[FromRoute] string eventId) =>
{
// Todo: Issue #208 https://github.com/aliencube/azure-openai-sdk-proxy/issues/208
return Results.Ok();
// Todo: Issue #208
})
.Produces<AdminEventDetails>(statusCode: StatusCodes.Status200OK, contentType: "application/json")
.Produces(statusCode: StatusCodes.Status401Unauthorized)
.Produces<string>(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain")
.WithTags("admin")
.WithName("GetAdminEventDetails")
.WithOpenApi(operation =>
{
operation.Summary = "Gets event details from the given event ID";
operation.Description = "This endpoint gets the event details from the given event ID.";

return operation;
});

return builder;
}
}
2 changes: 1 addition & 1 deletion src/AzureOpenAIProxy.ApiApp/Endpoints/EndpointUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static class EndpointUrls
/// Declares the chat completions endpoint.
/// </summary>
public const string ChatCompletions = "/openai/deployments/{deploymentName}/chat/completions";
}
}
77 changes: 77 additions & 0 deletions src/AzureOpenAIProxy.ApiApp/Models/AdminEventDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
namespace AzureOpenAIProxy.ApiApp.Models;

/// <summary>
/// This represent the event detail data for response by admin event endpoint.
/// </summary>
public class AdminEventDetails
{
/// <summary>
/// Gets or sets the event id.
/// </summary>
public required string? EventId { get; set; }

/// <summary>
/// Gets or sets the event title name.
/// </summary>
public required string? Title { get; set; }

/// <summary>
/// Gets or sets the event summary.
/// </summary>
public required string? Summary { get; set; }

/// <summary>
/// Gets or sets the event description.
/// </summary>
public string? Description { get; set; }

/// <summary>
/// Gets or sets the event start date.
/// </summary>
public required DateTimeOffset? DateStart { get; set; }

/// <summary>
/// Gets or sets the event end date.
/// </summary>
public required DateTimeOffset? DateEnd { get; set; }

/// <summary>
/// Gets or sets the event start to end date timezone.
/// </summary>
public required string? TimeZone { get; set; }

/// <summary>
/// Gets or sets the event active status.
/// </summary>
public required bool? IsActive { get; set; }

/// <summary>
/// Gets or sets the event organizer name.
/// </summary>
public required string? OrganizerName { get; set; }

/// <summary>
/// Gets or sets the event organizer email.
/// </summary>
public required string? OrganizerEmail { get; set; }

/// <summary>
/// Gets or sets the event coorganizer name.
/// </summary>
public string? CoorganizerName { get; set; }

/// <summary>
/// Gets or sets the event coorganizer email.
/// </summary>
public string? CoorganizerEmail { get; set; }

/// <summary>
/// Gets or sets the Azure OpenAI Service request max token capacity.
/// </summary>
public required int? MaxTokenCap { get; set; }

/// <summary>
/// Gets or sets the Azure OpenAI Service daily request capacity.
/// </summary>
public required int? DailyRequestCap { get; set; }
}
3 changes: 3 additions & 0 deletions src/AzureOpenAIProxy.ApiApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@
app.AddWeatherForecast();
app.AddChatCompletions();

// Admin Endpoints
app.AddAdminEvents();

await app.RunAsync();
Loading