11using System ;
22using System . Collections . Generic ;
33using System . Linq ;
4+ using Certify . Models . Hub ;
45using SourceGenerator ;
56
67namespace Certify . SourceGenerators
@@ -31,6 +32,8 @@ public static List<GeneratedAPI> GetApiDefinitions()
3132 // - map the call from the public API to the background service API in the service API Client (interface and implementation)
3233 // - to then generate the public API clients, run nswag when the public API is running.
3334
35+ var actionResultName = "Certify.Models.Config.ActionResult" ;
36+
3437 return new List < GeneratedAPI > {
3538
3639 new ( ) {
@@ -41,7 +44,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
4144 PublicAPIRoute = "securityprinciple/allowedaction" ,
4245 ServiceAPIRoute = "access/securityprinciple/allowedaction" ,
4346 ReturnType = "bool" ,
44- Params = new Dictionary < string , string > { { "check" , " Certify.Models.Hub.AccessCheck" } }
47+ Params = new Dictionary < string , string > { { "check" , nameof ( Certify . Models . Hub . AccessCheck ) } }
4548 } ,
4649 new ( ) {
4750 OperationName = "GetSecurityPrincipleAssignedRoles" ,
@@ -50,7 +53,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
5053 PublicAPIController = "Access" ,
5154 PublicAPIRoute = "securityprinciple/{id}/assignedroles" ,
5255 ServiceAPIRoute = "access/securityprinciple/{id}/assignedroles" ,
53- ReturnType = "ICollection<AssignedRole>" ,
56+ ReturnType = $ "ICollection<{ nameof ( AssignedRole ) } >",
5457 Params = new Dictionary < string , string > { { "id" , "string" } }
5558 } ,
5659 new ( ) {
@@ -60,7 +63,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
6063 PublicAPIController = "Access" ,
6164 PublicAPIRoute = "securityprinciple/{id}/rolestatus" ,
6265 ServiceAPIRoute = "access/securityprinciple/{id}/rolestatus" ,
63- ReturnType = " RoleStatus" ,
66+ ReturnType = nameof ( RoleStatus ) ,
6467 Params = new Dictionary < string , string > { { "id" , "string" } }
6568 } ,
6669 new ( ) {
@@ -70,7 +73,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
7073 PublicAPIController = "Access" ,
7174 PublicAPIRoute = "roles" ,
7275 ServiceAPIRoute = "access/roles" ,
73- ReturnType = "ICollection<Role>"
76+ ReturnType = $ "ICollection<{ nameof ( Role ) } >"
7477 } ,
7578 new ( ) {
7679 OperationName = "GetAssignedAccessTokens" ,
@@ -79,7 +82,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
7982 PublicAPIController = "Access" ,
8083 PublicAPIRoute = "assignedtoken" ,
8184 ServiceAPIRoute = "access/assignedtoken/list" ,
82- ReturnType = "ICollection<Certify.Models.Hub. AssignedAccessToken>"
85+ ReturnType = $ "ICollection<{ nameof ( AssignedAccessToken ) } >"
8386 } ,
8487 new ( ) {
8588 OperationName = "AddAssignedAccessToken" ,
@@ -88,7 +91,7 @@ public static List<GeneratedAPI> GetApiDefinitions()
8891 PublicAPIController = "Access" ,
8992 PublicAPIRoute = "assignedtoken" ,
9093 ServiceAPIRoute = "access/assignedtoken" ,
91- ReturnType = "Models.Config.ActionResult" ,
94+ ReturnType = actionResultName ,
9295 Params = new Dictionary < string , string > { { "token" , "Certify.Models.Hub.AssignedAccessToken" } }
9396 } ,
9497 new ( ) {
@@ -175,39 +178,39 @@ public static List<GeneratedAPI> GetApiDefinitions()
175178 PublicAPIController = "Access" ,
176179 PublicAPIRoute = "securityprinciple" ,
177180 ServiceAPIRoute = "access/securityprinciple/{id}" ,
178- ReturnType = "Models.Config.ActionResult" ,
181+ ReturnType = actionResultName ,
179182 Params = new Dictionary < string , string > { { "id" , "string" } }
180183 } ,
181184 new ( ) {
182185 OperationName = "AddHubManagedInstance" ,
183186 OperationMethod = HttpPost ,
184187 Comment = "Add new managed instance to the hub" ,
185188 ServiceAPIRoute = "managedinstance" ,
186- ReturnType = "Models.Config.ActionResult<ManagedInstanceInfo>" ,
187- Params = new Dictionary < string , string > { { "item" , "Certify. Models.Hub.ManagedInstanceInfo" } }
189+ ReturnType = $ "Models.Config.ActionResult<{ nameof ( Models . Hub . ManagedInstanceInfo ) } >",
190+ Params = new Dictionary < string , string > { { "item" , nameof ( Models . Hub . ManagedInstanceInfo ) } }
188191 } ,
189192 new ( ) {
190193 OperationName = "UpdateHubManagedInstance" ,
191194 OperationMethod = HttpPost ,
192195 Comment = "Update existing managed instance in the hub" ,
193196 ServiceAPIRoute = "managedinstance" ,
194- ReturnType = "Models.Config.ActionResult" ,
195- Params = new Dictionary < string , string > { { "item" , "Certify. Models.Hub.ManagedInstanceInfo" } }
197+ ReturnType = actionResultName ,
198+ Params = new Dictionary < string , string > { { "item" , nameof ( Models . Hub . ManagedInstanceInfo ) } }
196199 } ,
197200 new ( ) {
198201 OperationName = "GetHubManagedInstance" ,
199202 OperationMethod = HttpGet ,
200203 Comment = "Get managed instance info" ,
201204 ServiceAPIRoute = "managedinstance/{id}" ,
202- ReturnType = " Models.Hub.ManagedInstanceInfo" ,
205+ ReturnType = nameof ( Models . Hub . ManagedInstanceInfo ) ,
203206 Params = new Dictionary < string , string > { { "id" , "string" } }
204207 } ,
205208 new ( ) {
206209 OperationName = "GetHubManagedInstances" ,
207210 OperationMethod = HttpGet ,
208211 Comment = "Get managed instances" ,
209- ServiceAPIRoute = "managedinstance" ,
210- ReturnType = "ICollection<Models.Hub.ManagedInstanceInfo>" ,
212+ ServiceAPIRoute = "managedinstance/list " ,
213+ ReturnType = $ "ICollection<{ nameof ( Models . Hub . ManagedInstanceInfo ) } >",
211214 Params = new Dictionary < string , string > { }
212215 } ,
213216 new ( ) {
0 commit comments