diff --git a/server/src/Org.OpenAPITools/ControllersImpl/DefaultApiImpl.cs b/server/src/Org.OpenAPITools/ControllersImpl/DefaultApiImpl.cs index 05d7b2cd24a949d4da4d10e3ecc74f5648789e01..f2805b3a1569dbc8665976b8dbb542747514d55d 100644 --- a/server/src/Org.OpenAPITools/ControllersImpl/DefaultApiImpl.cs +++ b/server/src/Org.OpenAPITools/ControllersImpl/DefaultApiImpl.cs @@ -31,7 +31,7 @@ namespace Org.OpenAPITools.Controllers { /// - /// Get the version of the server. + /// Get the state of the server. /// /// OK, world storage server ready. [HttpGet] @@ -47,13 +47,14 @@ namespace Org.OpenAPITools.Controllers } /// - /// Test the server availability + /// Test the server availability. /// - /// OK, world storage alive. + /// Ok, returns a string message. [HttpGet] [Route("/ping")] [ValidateModelState] [SwaggerOperation("GetPing")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "Ok, returns a string message.")] public override IActionResult GetPing() { string answer = "OK, world storage alive."; diff --git a/server/src/Org.OpenAPITools/ControllersImpl/TrackablesApiImpl.cs b/server/src/Org.OpenAPITools/ControllersImpl/TrackablesApiImpl.cs index 8564cffbde63601e4863c7d0e29850381a97b7b8..44d96e0faa4b334720bc160e2086ad10b59bae75 100644 --- a/server/src/Org.OpenAPITools/ControllersImpl/TrackablesApiImpl.cs +++ b/server/src/Org.OpenAPITools/ControllersImpl/TrackablesApiImpl.cs @@ -43,10 +43,11 @@ namespace Org.OpenAPITools.Controllers /// - /// Create a trackable + /// Create a Trackable. /// - /// The trackable to be added to the world storage. - /// OK, returns the UUID of the Trackable defined by the world storage. + /// Create a new Trackable from a json object containing all the required informations and add it to the world storage. <br>As a result you will get the ID of the newly created Trackable. + /// The Trackable to be added to the world storage. + /// OK, return the UUID of the Trackable defined by the world storage. /// Null response. /// Bad request. /// Invalid UUID, id must be a Nil value. @@ -56,7 +57,10 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("AddTrackable")] - [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, returns the UUID of the Trackable defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the Trackable defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 409, type: typeof(string), description: "Invalid UUID, id must be a Nil value.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult AddTrackable([FromBody] Trackable trackable) { @@ -67,17 +71,18 @@ namespace Org.OpenAPITools.Controllers try { Trackable mytrackable = _trackableService.Create(trackable); - return new ObjectResult(mytrackable); + return StatusCode(200, mytrackable.UUID.ToString()); } catch (Exception e) - { + { return StatusCode(400, e.Message); } } /// - /// Deletes a trackable. + /// Delete a Trackable. /// + /// Delete a single Trackable stored in the world storage from its ID. /// Trackable UUID to delete. /// OK, delete successful. /// Invalid UUID supplied. @@ -86,6 +91,9 @@ namespace Org.OpenAPITools.Controllers [Route("/trackables/{trackableUUID}")] [ValidateModelState] [SwaggerOperation("DeleteTrackable")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, delete successful.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult DeleteTrackable([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID) { DeleteResult answer = _trackableService.Remove(trackableUUID); @@ -116,9 +124,10 @@ namespace Org.OpenAPITools.Controllers } /// - /// Find a trackable by its UUID. + /// Find a Trackable by its UUID. /// - /// UUID of the trackable to retrieve. + /// Get a single Trackable stored in the world storage from its ID. + /// UUID of the Trackable to retrieve. /// Successful operation. /// Invalid UUID supplied. /// Not found, could not find UUID in database. @@ -127,6 +136,8 @@ namespace Org.OpenAPITools.Controllers [ValidateModelState] [SwaggerOperation("GetTrackableById")] [SwaggerResponse(statusCode: 200, type: typeof(Trackable), description: "Successful operation.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult GetTrackableById([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID) { Trackable trackable = _trackableService.Get(trackableUUID); @@ -134,16 +145,18 @@ namespace Org.OpenAPITools.Controllers } /// - /// returns the list of all trackables defined by the world storage. + /// Return all the Trackables. /// - /// OK, returns all the Trackables defined by the world storage. + /// Get all the Trackables currently being stored in the world storage. + /// OK, return all the Trackables defined by the world storage. /// Null response. /// Unexpected error. [HttpGet] [Route("/trackables")] [ValidateModelState] [SwaggerOperation("GetTrackables")] - [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK, returns all the Trackables defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK, return all the Trackables defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult GetTrackables() { @@ -167,6 +180,9 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("ModifyTrackable")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the modified Trackable.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult ModifyTrackable([FromBody] Trackable trackable) { @@ -177,7 +193,7 @@ namespace Org.OpenAPITools.Controllers } else { - return StatusCode(200, trackable.UUID); + return StatusCode(200, trackable.UUID.ToString()); } } } diff --git a/server/src/Org.OpenAPITools/ControllersImpl/WorldAnchorsApiImpl.cs b/server/src/Org.OpenAPITools/ControllersImpl/WorldAnchorsApiImpl.cs index 890aebdc6745be412bb3b251654e226ec8b4a904..be55581a12c8f518a48194d9d6783978d218256a 100644 --- a/server/src/Org.OpenAPITools/ControllersImpl/WorldAnchorsApiImpl.cs +++ b/server/src/Org.OpenAPITools/ControllersImpl/WorldAnchorsApiImpl.cs @@ -43,10 +43,11 @@ namespace Org.OpenAPITools.Controllers /// - /// Create a world anchor. + /// Create a World Anchor. /// - /// The world anchor to be added to the world storage. - /// OK, returns the UUID of the World Anchor defined by the world storage. + /// Create a new World Anchor from a json object containing all the required informations and add it to the world storage. <br>As a result you will get the ID of the newly created World Anchor. + /// The World Anchor to be added to the world storage. + /// OK, return the UUID of the World Anchor defined by the world storage. /// Null response. /// Bad request. /// Invalid UUID, id must be a Nil value. @@ -56,7 +57,10 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("AddWorldAnchor")] - [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, returns the UUID of the World Anchor defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the World Anchor defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 409, type: typeof(string), description: "Invalid UUID, id must be a Nil value.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult AddWorldAnchor([FromBody] WorldAnchor worldAnchor) { @@ -67,7 +71,7 @@ namespace Org.OpenAPITools.Controllers try { WorldAnchor myworldanchor = _worldAnchorService.Create(worldAnchor); - return new ObjectResult(myworldanchor); + return StatusCode(200, myworldanchor.UUID.ToString()); } catch (Exception e) { @@ -76,9 +80,10 @@ namespace Org.OpenAPITools.Controllers } /// - /// Deletes a world anchor. + /// Delete a World Anchor. /// - /// World anchor UUID to delete. + /// Delete a single World Anchor stored in the world storage from its ID. + /// World Anchor UUID to delete. /// OK, delete successful. /// Invalid UUID supplied. /// Not found, could not find UUID in database. @@ -86,6 +91,9 @@ namespace Org.OpenAPITools.Controllers [Route("/worldAnchors/{worldAnchorUUID}")] [ValidateModelState] [SwaggerOperation("DeleteWorldAnchor")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, delete successful.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult DeleteWorldAnchor([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID) { DeleteResult answer = _worldAnchorService.Remove((worldAnchorUUID)); @@ -116,9 +124,10 @@ namespace Org.OpenAPITools.Controllers } /// - /// Find a world anchor by its UUID. + /// Find a World Anchor by its UUID. /// - /// UUID of the world anchor to retrieve. + /// Get a single World Anchor stored in the world storage from its ID. + /// UUID of the World Anchor to retrieve. /// Successful operation. /// Invalid UUID supplied. /// Not found, could not find UUID in database. @@ -127,6 +136,8 @@ namespace Org.OpenAPITools.Controllers [ValidateModelState] [SwaggerOperation("GetWorldAnchorById")] [SwaggerResponse(statusCode: 200, type: typeof(WorldAnchor), description: "Successful operation.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult GetWorldAnchorById([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID) { WorldAnchor myworldanchor = _worldAnchorService.Get(worldAnchorUUID); @@ -134,16 +145,18 @@ namespace Org.OpenAPITools.Controllers } /// - /// Returns the list of all world anchors defined by the world storage. + /// Return all the World Anchors. /// - /// OK, returns all the world anchors defined by the world storage. + /// Get all the World Anchors currently being stored in the world storage. + /// OK, return all the World Anchors defined by the world storage. /// Null response. /// Unexpected error. [HttpGet] [Route("/worldAnchors")] [ValidateModelState] [SwaggerOperation("GetWorldAnchors")] - [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK, returns all the world anchors defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK, return all the World Anchors defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult GetWorldAnchors() { @@ -167,6 +180,9 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("ModifyWorldAnchor")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the modified World Anchor.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult ModifyWorldAnchor([FromBody] WorldAnchor worldAnchor) { @@ -177,7 +193,7 @@ namespace Org.OpenAPITools.Controllers } else { - return StatusCode(200, worldAnchor.UUID); + return StatusCode(200, worldAnchor.UUID.ToString()); } } diff --git a/server/src/Org.OpenAPITools/ControllersImpl/WorldLinksApiImpl.cs b/server/src/Org.OpenAPITools/ControllersImpl/WorldLinksApiImpl.cs index 60d1335c93a7589a8dd10b4e9b7f10ec1053b976..1c31a85f36a00d14de2ad53df83cc6aa0eb54654 100644 --- a/server/src/Org.OpenAPITools/ControllersImpl/WorldLinksApiImpl.cs +++ b/server/src/Org.OpenAPITools/ControllersImpl/WorldLinksApiImpl.cs @@ -42,11 +42,12 @@ namespace Org.OpenAPITools.Controllers } /// - /// Create a link between world anchors and trackables. + /// Create a World Link between elements (world anchors and/or trackables). /// + /// Create a new World Link from a json object containing all the required informations and add it to the world storage. <br>As a result you will get the ID of the newly created World Link. /// The link to be added to the world storage. - /// OK, returns the UUID of the link defined by the world storage. - /// Null response + /// OK, return the UUID of the World Link defined by the world storage. + /// Null response. /// Bad request. /// Invalid UUID, id must be a Nil value. /// Unexpected error. @@ -55,7 +56,10 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("AddWorldLink")] - [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, returns the UUID of the link defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the World Link defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 409, type: typeof(string), description: "Invalid UUID, id must be a Nil value.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult AddWorldLink([FromBody] WorldLink worldLink) { @@ -66,7 +70,7 @@ namespace Org.OpenAPITools.Controllers try { WorldLink myworldlink = _worldLinkService.Create(worldLink); - return new ObjectResult(myworldlink); + return StatusCode(200, myworldlink.UUID.ToString()); } catch (Exception e) { @@ -75,16 +79,20 @@ namespace Org.OpenAPITools.Controllers } /// - /// Deletes a worldLink. + /// Delete a World Link. /// - /// link id to delete - /// OK + /// Delete a single World Link stored in the world storage from its ID. + /// World Link id to delete. + /// OK, delete successful. /// Invalid UUID supplied. /// Not found, could not find UUID in database. [HttpDelete] [Route("/worldLinks/{worldLinkUUID}")] [ValidateModelState] [SwaggerOperation("DeleteWorldLink")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, delete successful.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult DeleteWorldLink([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID) { DeleteResult answer = _worldLinkService.Remove((worldLinkUUID)); @@ -93,9 +101,10 @@ namespace Org.OpenAPITools.Controllers /// - /// Find a link by its UUID. + /// Find a World Link by its UUID. /// - /// UUID of the link to retrieve. + /// Get a single World Link stored in the world storage from its ID. + /// UUID of the World Link to retrieve. /// Successful operation. /// Invalid UUID supplied. /// Not found, could not find UUID in database. @@ -104,6 +113,8 @@ namespace Org.OpenAPITools.Controllers [ValidateModelState] [SwaggerOperation("GetWorldLinkById")] [SwaggerResponse(statusCode: 200, type: typeof(WorldLink), description: "Successful operation.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Invalid UUID supplied.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] public override IActionResult GetWorldLinkById([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID) { WorldLink myworldlink = _worldLinkService.Get(worldLinkUUID); @@ -148,16 +159,18 @@ namespace Org.OpenAPITools.Controllers } /// - /// Returns the list of all links defined by the world storage. + /// Return all World Links. /// - /// OK returns all the worldLinks defined by the world storage. - /// Null response + /// Get all the World Links currently being stored in the world storage. + /// OK return all the World Links defined by the world storage. + /// Null response. /// Unexpected error. [HttpGet] [Route("/worldLinks")] [ValidateModelState] [SwaggerOperation("GetWorldLinks")] - [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK returns all the worldLinks defined by the world storage.")] + [SwaggerResponse(statusCode: 200, type: typeof(List), description: "OK return all the World Links defined by the world storage.")] + [SwaggerResponse(statusCode: 201, type: typeof(string), description: "Null response.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult GetWorldLinks() { @@ -218,6 +231,9 @@ namespace Org.OpenAPITools.Controllers [Consumes("application/json")] [ValidateModelState] [SwaggerOperation("ModifyWorldLink")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "OK, return the UUID of the modified World Link.")] + [SwaggerResponse(statusCode: 400, type: typeof(string), description: "Bad request.")] + [SwaggerResponse(statusCode: 404, type: typeof(string), description: "Not found, could not find UUID in database.")] [SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")] public override IActionResult ModifyWorldLink([FromBody] WorldLink worldLink) { @@ -228,7 +244,7 @@ namespace Org.OpenAPITools.Controllers } else { - return StatusCode(200, worldLink.UUID); + return StatusCode(200, worldLink.UUID.ToString()); } } }