2
2
using System . Text . Json ;
3
3
using Microsoft . AspNetCore . Mvc ;
4
4
using Microsoft . Extensions . Logging ;
5
+ using Swashbuckle . AspNetCore . Annotations ;
5
6
using TramsDataApi . ResponseModels ;
6
7
using TramsDataApi . UseCases ;
7
8
8
9
namespace TramsDataApi . Controllers . V3
9
10
{
11
+ /// <summary>
12
+ /// Manages operations related to trusts using the Master schema.
13
+ /// </summary>
10
14
[ ApiVersion ( "3.0" ) ]
11
15
[ ApiController ]
12
16
[ Route ( "v{version:apiVersion}/" ) ]
17
+ [ SwaggerTag ( "Operations related to Trusts using the Master schema" ) ]
13
18
public class TrustsController : ControllerBase
14
19
{
15
20
private readonly IGetMstrTrustByUkprn _getMstrTrustByUkPrn ;
@@ -23,8 +28,16 @@ public TrustsController(IGetMstrTrustByUkprn getMstrTrustByUkPrn, IMstrSearchTru
23
28
_logger = logger ;
24
29
}
25
30
31
+ /// <summary>
32
+ /// Searches for trusts based on given criteria.
33
+ /// </summary>
34
+ /// <remarks>
35
+ /// Search can be performed using the groupName, ukPrn, and companiesHouseNumber parameters.
36
+ /// </remarks>
26
37
[ HttpGet ( "trusts" ) ]
27
38
[ MapToApiVersion ( "3.0" ) ]
39
+ [ SwaggerOperation ( Summary = "Search Trusts" , Description = "Search for trusts using the specified parameters, within the Master schema." ) ]
40
+ [ SwaggerResponse ( 200 , "Successfully found and returned the list of trusts." ) ]
28
41
public ActionResult < ApiResponseV2 < TrustSummaryResponse > > SearchTrusts ( string groupName , string ukPrn , string companiesHouseNumber ,
29
42
int page = 1 , int count = 50 , bool includeEstablishments = true )
30
43
{
@@ -50,9 +63,15 @@ public ActionResult<ApiResponseV2<TrustSummaryResponse>> SearchTrusts(string gro
50
63
return new OkObjectResult ( response ) ;
51
64
}
52
65
66
+ /// <summary>
67
+ /// Retrieves a specific trust by UKPRN.
68
+ /// </summary>
53
69
[ HttpGet ]
54
70
[ Route ( "trust/{ukprn}" ) ]
55
71
[ MapToApiVersion ( "3.0" ) ]
72
+ [ SwaggerOperation ( Summary = "Get Trust By UKPRN" , Description = "Retrieve a single trust by its UKPRN." ) ]
73
+ [ SwaggerResponse ( 200 , "Successfully retrieved the trust." ) ]
74
+ [ SwaggerResponse ( 404 , "The trust was not found." ) ]
56
75
public ActionResult < ApiSingleResponseV2 < MasterTrustResponse > > GetTrustByUkPrn ( string ukprn )
57
76
{
58
77
_logger . LogInformation ( "Attempting to get trust by UKPRN {prn}" , ukprn ) ;
0 commit comments