Skip to content

Commit be2e141

Browse files
committed
add EndpointDescriptions for all endpoints
1 parent 9b7292d commit be2e141

6 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/Server/Controllers/Api/v1/Admin/RefreshCacheController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class RefreshCacheController : ControllerBase
2121
[ProducesResponseType(StatusCodes.Status404NotFound)]
2222
[ProducesResponseType(StatusCodes.Status429TooManyRequests)]
2323
[ProducesResponseType(StatusCodes.Status202Accepted)]
24+
[EndpointDescription("Causes the internal version cache for the given release channel to refresh." +
25+
"Requires Admin Token authentication via 'Authorization' header." +
26+
"Ratelimit of one request per channel per minute.")]
2427
[SuppressMessage("ReSharper.DPA", "DPA0011: High execution time of MVC action")]
2528
public async Task<ActionResult> Action([FromQuery] string rc, [FromHeader(Name = "Authorization")] string adminAccessToken)
2629
{

src/Server/Controllers/Api/v1/Admin/VersioningController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public VersioningController(ILogger<VersioningController> logger)
1616
}
1717

1818
[HttpGet(Constants.RouteName_Api_Versioning_GetNextVersion)]
19+
[EndpointDescription("Query the next Ryubing version from the version provider.")]
1920
public ActionResult<string> GetNext([FromQuery] string rc, [FromQuery] bool major = false)
2021
{
2122
if (!rc.TryParseAsReleaseChannel(out var releaseChannel))
@@ -34,6 +35,7 @@ public ActionResult<string> GetNext([FromQuery] string rc, [FromQuery] bool majo
3435
}
3536

3637
[HttpGet(Constants.RouteName_Api_Versioning_GetCurrentVersion)]
38+
[EndpointDescription("Query the current Ryubing version from the version provider.")]
3739
public ActionResult<string> GetCurrent([FromQuery] string rc)
3840
{
3941
if (!rc.TryParseAsReleaseChannel(out var releaseChannel))
@@ -56,6 +58,8 @@ public ActionResult<string> GetCurrent([FromQuery] string rc)
5658
[ProducesResponseType(StatusCodes.Status418ImATeapot)]
5759
[ProducesResponseType(StatusCodes.Status404NotFound)]
5860
[ProducesResponseType(StatusCodes.Status202Accepted)]
61+
[EndpointDescription("Increment the current Ryubing version in the version provider for the given release channel." +
62+
"Requires Admin Token authentication via 'Authorization' header.")]
5963
public ActionResult Increment([FromQuery] string rc, [FromHeader(Name = "Authorization")] string adminAccessToken)
6064
{
6165
if (!AdminEndpointMetadata.Enabled)
@@ -88,6 +92,8 @@ public ActionResult Increment([FromQuery] string rc, [FromHeader(Name = "Authori
8892
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
8993
[ProducesResponseType(StatusCodes.Status418ImATeapot)]
9094
[ProducesResponseType(StatusCodes.Status202Accepted)]
95+
[EndpointDescription("Increases the major version number for the Ryubing version provider for both release channels." +
96+
"Requires Admin Token authentication via 'Authorization' header.")]
9197
public ActionResult Advance([FromHeader(Name = "Authorization")] string adminAccessToken)
9298
{
9399
if (!AdminEndpointMetadata.Enabled)

src/Server/Controllers/Api/v1/MetaController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public class MetaController : ControllerBase
1818
[HttpGet]
1919
[ProducesResponseType(StatusCodes.Status200OK)]
2020
[Produces("application/json")]
21-
public async Task<ActionResult<Dictionary<string, VersionCacheSource>>> Action()
21+
[EndpointDescription("Query the UpdateServer's internal version caches to determine what GitLab projects back each release channel.")]
22+
public ActionResult<Dictionary<string, VersionCacheSource>> Action()
2223
{
2324
var stableCache = HttpContext.RequestServices.GetRequiredKeyedService<VersionCache>("stableCache");
2425

src/Server/Controllers/Api/v1/VersionController.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class VersionController : ControllerBase
1212
[ProducesResponseType(StatusCodes.Status404NotFound)]
1313
[ProducesResponseType(StatusCodes.Status200OK)]
1414
[Produces("application/json")]
15+
[EndpointDescription("Query the latest Stable Ryubing release build matching the provided query parameters.")]
1516
public async Task<ActionResult<VersionResponse>> GetLatestStable(
1617
[FromKeyedServices("stableCache")] VersionCache vcache,
1718
[FromQuery] string? os = null,
@@ -39,6 +40,7 @@ public async Task<ActionResult<VersionResponse>> GetLatestStable(
3940
[ProducesResponseType(StatusCodes.Status404NotFound)]
4041
[ProducesResponseType(StatusCodes.Status200OK)]
4142
[Produces("application/json")]
43+
[EndpointDescription("Query the latest Canary Ryubing release build matching the provided query parameters.")]
4244
public async Task<ActionResult<VersionResponse>> GetLatestCanary(
4345
[FromKeyedServices("canaryCache")] VersionCache vcache,
4446
[FromQuery] string? os = null,
@@ -66,6 +68,7 @@ public async Task<ActionResult<VersionResponse>> GetLatestCanary(
6668
[ProducesResponseType(StatusCodes.Status404NotFound)]
6769
[ProducesResponseType(StatusCodes.Status200OK)]
6870
[Produces("application/json")]
71+
[EndpointDescription("Query a specific Stable Ryubing version cache entry.")]
6972
public async Task<ActionResult<VersionCacheEntry>> GetSpecificStable(
7073
[FromKeyedServices("stableCache")] VersionCache vcache,
7174
string version
@@ -81,6 +84,7 @@ string version
8184
[ProducesResponseType(StatusCodes.Status404NotFound)]
8285
[ProducesResponseType(StatusCodes.Status200OK)]
8386
[Produces("application/json")]
87+
[EndpointDescription("Query a specific Canary Ryubing version cache entry.")]
8488
public async Task<ActionResult<VersionCacheEntry>> GetSpecificCanary(
8589
[FromKeyedServices("canaryCache")] VersionCache vcache,
8690
string version

src/Server/Controllers/DownloadController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class DownloadController : ControllerBase
1212
[ProducesResponseType(StatusCodes.Status302Found)]
1313
[ProducesResponseType(StatusCodes.Status404NotFound)]
1414
[ProducesResponseType(StatusCodes.Status400BadRequest)]
15+
[EndpointDescription("Download a version of Ryubing.")]
1516
public async Task<ActionResult> DownloadCustom(
1617
[FromQuery] string os,
1718
[FromQuery] string arch,
@@ -54,6 +55,7 @@ public async Task<ActionResult> DownloadCustom(
5455
[HttpGet(Constants.StableRoute)]
5556
[ProducesResponseType(StatusCodes.Status302Found)]
5657
[ProducesResponseType(StatusCodes.Status404NotFound)]
58+
[EndpointDescription("Download the latest Stable version of Ryubing.")]
5759
public async Task<ActionResult> DownloadLatestStable(
5860
[FromKeyedServices("stableCache")] VersionCache vcache,
5961
[FromServices] ILogger<DownloadController> logger
@@ -68,6 +70,7 @@ [FromServices] ILogger<DownloadController> logger
6870
[HttpGet(Constants.CanaryRoute)]
6971
[ProducesResponseType(StatusCodes.Status302Found)]
7072
[ProducesResponseType(StatusCodes.Status404NotFound)]
73+
[EndpointDescription("Download the latest Canary version of Ryubing.")]
7174
public async Task<ActionResult> DownloadLatestCanary(
7275
[FromKeyedServices("canaryCache")] VersionCache vcache,
7376
[FromServices] ILogger<DownloadController> logger

src/Server/Controllers/LatestController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class LatestController : ControllerBase
1212
[ProducesResponseType(StatusCodes.Status200OK)]
1313
[ProducesResponseType(StatusCodes.Status404NotFound)]
1414
[ProducesResponseType(StatusCodes.Status400BadRequest)]
15+
[EndpointDescription("Query the latest version of Ryubing.")]
1516
public async Task<ActionResult<VersionResponse>> GetLatestCustom(
1617
[FromQuery] string? os,
1718
[FromQuery] string? arch,
@@ -53,6 +54,7 @@ public async Task<ActionResult<VersionResponse>> GetLatestCustom(
5354
[HttpGet(Constants.StableRoute), HttpGet]
5455
[ProducesResponseType(StatusCodes.Status302Found)]
5556
[ProducesResponseType(StatusCodes.Status404NotFound)]
57+
[EndpointDescription("Redirect to the GitLab release URL of the latest Stable Ryubing release.")]
5658
public async Task<ActionResult> RedirectLatestStable(
5759
[FromKeyedServices("stableCache")] VersionCache vcache)
5860
{
@@ -65,6 +67,7 @@ public async Task<ActionResult> RedirectLatestStable(
6567
[HttpGet(Constants.CanaryRoute)]
6668
[ProducesResponseType(StatusCodes.Status302Found)]
6769
[ProducesResponseType(StatusCodes.Status404NotFound)]
70+
[EndpointDescription("Redirect to the GitLab release URL of the latest Canary Ryubing release.")]
6871
public async Task<ActionResult> RedirectLatestCanary(
6972
[FromKeyedServices("canaryCache")] VersionCache vcache)
7073
{

0 commit comments

Comments
 (0)