Skip to content

Commit e63d908

Browse files
authored
[OpenAPI] Add endpoint for view event details #207 (#231)
1 parent 72a255f commit e63d908

File tree

8 files changed

+452
-6
lines changed

8 files changed

+452
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace AzureOpenAIProxy.ApiApp.Endpoints;
2+
3+
public static class AdminEndpointUrls
4+
{
5+
/// <summary>
6+
/// Declares the admin event details endpoint.
7+
/// </summary>
8+
public const string AdminEventDetails = "/admin/events/{eventId}";
9+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using AzureOpenAIProxy.ApiApp.Models;
2+
3+
using Microsoft.AspNetCore.Mvc;
4+
5+
namespace AzureOpenAIProxy.ApiApp.Endpoints;
6+
7+
/// <summary>
8+
/// This represents the endpoint entity for get event details by admin
9+
/// </summary>
10+
public static class AdminEventEndpoints
11+
{
12+
/// <summary>
13+
/// Adds the get event details by admin endpoint
14+
/// </summary>
15+
/// <param name="app"><see cref="WebApplication"/> instance.</param>
16+
/// <returns>Returns <see cref="RouteHandlerBuilder"/> instance.</returns>
17+
public static RouteHandlerBuilder AddAdminEvents(this WebApplication app)
18+
{
19+
// Todo: Issue #19 https://github.com/aliencube/azure-openai-sdk-proxy/issues/19
20+
// Need authorization by admin
21+
var builder = app.MapGet(AdminEndpointUrls.AdminEventDetails, (
22+
[FromRoute] string eventId) =>
23+
{
24+
// Todo: Issue #208 https://github.com/aliencube/azure-openai-sdk-proxy/issues/208
25+
return Results.Ok();
26+
// Todo: Issue #208
27+
})
28+
.Produces<AdminEventDetails>(statusCode: StatusCodes.Status200OK, contentType: "application/json")
29+
.Produces(statusCode: StatusCodes.Status401Unauthorized)
30+
.Produces<string>(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain")
31+
.WithTags("admin")
32+
.WithName("GetAdminEventDetails")
33+
.WithOpenApi(operation =>
34+
{
35+
operation.Summary = "Gets event details from the given event ID";
36+
operation.Description = "This endpoint gets the event details from the given event ID.";
37+
38+
return operation;
39+
});
40+
41+
return builder;
42+
}
43+
}

src/AzureOpenAIProxy.ApiApp/Endpoints/EndpointUrls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public static class EndpointUrls
1414
/// Declares the chat completions endpoint.
1515
/// </summary>
1616
public const string ChatCompletions = "/openai/deployments/{deploymentName}/chat/completions";
17-
}
17+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
namespace AzureOpenAIProxy.ApiApp.Models;
2+
3+
/// <summary>
4+
/// This represent the event detail data for response by admin event endpoint.
5+
/// </summary>
6+
public class AdminEventDetails
7+
{
8+
/// <summary>
9+
/// Gets or sets the event id.
10+
/// </summary>
11+
public required string? EventId { get; set; }
12+
13+
/// <summary>
14+
/// Gets or sets the event title name.
15+
/// </summary>
16+
public required string? Title { get; set; }
17+
18+
/// <summary>
19+
/// Gets or sets the event summary.
20+
/// </summary>
21+
public required string? Summary { get; set; }
22+
23+
/// <summary>
24+
/// Gets or sets the event description.
25+
/// </summary>
26+
public string? Description { get; set; }
27+
28+
/// <summary>
29+
/// Gets or sets the event start date.
30+
/// </summary>
31+
public required DateTimeOffset? DateStart { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets the event end date.
35+
/// </summary>
36+
public required DateTimeOffset? DateEnd { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets the event start to end date timezone.
40+
/// </summary>
41+
public required string? TimeZone { get; set; }
42+
43+
/// <summary>
44+
/// Gets or sets the event active status.
45+
/// </summary>
46+
public required bool? IsActive { get; set; }
47+
48+
/// <summary>
49+
/// Gets or sets the event organizer name.
50+
/// </summary>
51+
public required string? OrganizerName { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets the event organizer email.
55+
/// </summary>
56+
public required string? OrganizerEmail { get; set; }
57+
58+
/// <summary>
59+
/// Gets or sets the event coorganizer name.
60+
/// </summary>
61+
public string? CoorganizerName { get; set; }
62+
63+
/// <summary>
64+
/// Gets or sets the event coorganizer email.
65+
/// </summary>
66+
public string? CoorganizerEmail { get; set; }
67+
68+
/// <summary>
69+
/// Gets or sets the Azure OpenAI Service request max token capacity.
70+
/// </summary>
71+
public required int? MaxTokenCap { get; set; }
72+
73+
/// <summary>
74+
/// Gets or sets the Azure OpenAI Service daily request capacity.
75+
/// </summary>
76+
public required int? DailyRequestCap { get; set; }
77+
}

src/AzureOpenAIProxy.ApiApp/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@
3939
app.AddWeatherForecast();
4040
app.AddChatCompletions();
4141

42+
// Admin Endpoints
43+
app.AddAdminEvents();
44+
4245
await app.RunAsync();

0 commit comments

Comments
 (0)