Commit 3f2d420f authored by Detlef Runde's avatar Detlef Runde
Browse files

returning only UUID with POST-requests (instead of returning the complete object)

parent 89c0cc8e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ namespace Org.OpenAPITools.Controllers
  {

    /// <summary>
    /// Get the version of the server.
        /// Get the state of the server.
    /// </summary>
    /// <response code="200">OK, world storage server ready.</response>
    [HttpGet]
@@ -47,13 +47,14 @@ namespace Org.OpenAPITools.Controllers
    }

    /// <summary>
    /// Test the server availability
        /// Test the server availability.
    /// </summary>
    /// <response code="200">OK, world storage alive.</response>
        /// <response code="200">Ok, returns a string message.</response>
    [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.";
+29 −13
Original line number Diff line number Diff line
@@ -43,10 +43,11 @@ namespace Org.OpenAPITools.Controllers


    /// <summary>
    /// Create a trackable
    /// Create a Trackable.
    /// </summary>
    /// <param name="trackable">The trackable to be added to the world storage.</param>
    /// <response code="200">OK, returns the UUID of the Trackable defined by the world storage.</response>
    /// <remarks>Create a new Trackable from a json object containing all the required informations and add it to the world storage. &lt;br&gt;As a result you will get the ID of the newly created Trackable.</remarks>
    /// <param name="trackable">The Trackable to be added to the world storage.</param>
    /// <response code="200">OK, return the UUID of the Trackable defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="400">Bad request.</response>
    /// <response code="409">Invalid UUID, id must be a Nil value.</response>
@@ -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,7 +71,7 @@ namespace Org.OpenAPITools.Controllers
      try
      {
        Trackable mytrackable = _trackableService.Create(trackable);
        return new ObjectResult(mytrackable);
        return StatusCode(200, mytrackable.UUID.ToString());
      }
      catch (Exception e)
      {
@@ -76,8 +80,9 @@ namespace Org.OpenAPITools.Controllers
    }

    /// <summary>
    /// Deletes a trackable.
    /// Delete a Trackable.
    /// </summary>
    /// <remarks>Delete a single Trackable stored in the world storage from its ID.</remarks>
    /// <param name="trackableUUID">Trackable UUID to delete.</param>
    /// <response code="200">OK, delete successful.</response>
    /// <response code="400">Invalid UUID supplied.</response>
@@ -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
    }

    /// <summary>
    /// Find a trackable by its UUID.
    /// Find a Trackable by its UUID.
    /// </summary>
    /// <param name="trackableUUID">UUID of the trackable to retrieve.</param>
    /// <remarks>Get a single Trackable stored in the world storage from its ID.</remarks>
    /// <param name="trackableUUID">UUID of the Trackable to retrieve.</param>
    /// <response code="200">Successful operation.</response>
    /// <response code="400">Invalid UUID supplied.</response>
    /// <response code="404">Not found, could not find UUID in database.</response>
@@ -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
    }

    /// <summary>
    /// returns the list of all trackables defined by the world storage.
    /// Return all the Trackables.
    /// </summary>
    /// <response code="200">OK, returns all the Trackables defined by the world storage.</response>
    /// <remarks>Get all the Trackables currently being stored in the world storage.</remarks>
    /// <response code="200">OK, return all the Trackables defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="0">Unexpected error.</response>
    [HttpGet]
    [Route("/trackables")]
    [ValidateModelState]
    [SwaggerOperation("GetTrackables")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<Trackable>), description: "OK, returns all the Trackables defined by the world storage.")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<Trackable>), 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());
      }
    }
  }
+29 −13
Original line number Diff line number Diff line
@@ -43,10 +43,11 @@ namespace Org.OpenAPITools.Controllers


    /// <summary>
    /// Create a world anchor.
    /// Create a World Anchor.
    /// </summary>
    /// <param name="worldAnchor">The world anchor to be added to the world storage.</param>
    /// <response code="200">OK, returns the UUID of the World Anchor defined by the world storage.</response>
    /// <remarks>Create a new World Anchor from a json object containing all the required informations and add it to the world storage. &lt;br&gt;As a result you will get the ID of the newly created World Anchor.</remarks>
    /// <param name="worldAnchor">The World Anchor to be added to the world storage.</param>
    /// <response code="200">OK, return the UUID of the World Anchor defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="400">Bad request.</response>
    /// <response code="409">Invalid UUID, id must be a Nil value.</response>
@@ -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
    }

    /// <summary>
    /// Deletes a world anchor.
    /// Delete a World Anchor.
    /// </summary>
    /// <param name="worldAnchorUUID">World anchor UUID to delete.</param>
    /// <remarks>Delete a single World Anchor stored in the world storage from its ID.</remarks>
    /// <param name="worldAnchorUUID">World Anchor UUID to delete.</param>
    /// <response code="200">OK, delete successful.</response>
    /// <response code="400">Invalid UUID supplied.</response>
    /// <response code="404">Not found, could not find UUID in database.</response>
@@ -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
    }

    /// <summary>
    /// Find a world anchor by its UUID.
    /// Find a World Anchor by its UUID.
    /// </summary>
    /// <param name="worldAnchorUUID">UUID of the world anchor to retrieve.</param>
    /// <remarks>Get a single World Anchor stored in the world storage from its ID.</remarks>
    /// <param name="worldAnchorUUID">UUID of the World Anchor to retrieve.</param>
    /// <response code="200">Successful operation.</response>
    /// <response code="400">Invalid UUID supplied.</response>
    /// <response code="404">Not found, could not find UUID in database.</response>
@@ -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
    }

    /// <summary>
    /// Returns the list of all world anchors defined by the world storage.
    /// Return all the World Anchors.
    /// </summary>
    /// <response code="200">OK, returns all the world anchors defined by the world storage.</response>
    /// <remarks>Get all the World Anchors currently being stored in the world storage.</remarks>
    /// <response code="200">OK, return all the World Anchors defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="0">Unexpected error.</response>
    [HttpGet]
    [Route("/worldAnchors")]
    [ValidateModelState]
    [SwaggerOperation("GetWorldAnchors")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<WorldAnchor>), description: "OK, returns all the world anchors defined by the world storage.")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<WorldAnchor>), 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());
      }
    }

+31 −15
Original line number Diff line number Diff line
@@ -42,11 +42,12 @@ namespace Org.OpenAPITools.Controllers
    }

    /// <summary>
    /// Create a link between world anchors and trackables.
    /// Create a World Link between elements (world anchors and/or trackables).
    /// </summary>
    /// <remarks>Create a new World Link from a json object containing all the required informations and add it to the world storage. &lt;br&gt;As a result you will get the ID of the newly created World Link.</remarks>
    /// <param name="worldLink">The link to be added to the world storage.</param>
    /// <response code="200">OK, returns the UUID of the link defined by the world storage.</response>
    /// <response code="201">Null response</response>
    /// <response code="200">OK, return the UUID of the World Link defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="400">Bad request.</response>
    /// <response code="409">Invalid UUID, id must be a Nil value.</response>
    /// <response code="0">Unexpected error.</response>
@@ -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
    }

    /// <summary>
    /// Deletes a worldLink.
    /// Delete a World Link.
    /// </summary>
    /// <param name="worldLinkUUID">link id to delete</param>
    /// <response code="200">OK</response>
    /// <remarks>Delete a single World Link stored in the world storage from its ID.</remarks>
    /// <param name="worldLinkUUID">World Link id to delete.</param>
    /// <response code="200">OK, delete successful.</response>
    /// <response code="400">Invalid UUID supplied.</response>
    /// <response code="404">Not found, could not find UUID in database.</response>
    [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


    /// <summary>
    /// Find a link by its UUID.
    /// Find a World Link by its UUID.
    /// </summary>
    /// <param name="worldLinkUUID">UUID of the link to retrieve.</param>
    /// <remarks>Get a single World Link stored in the world storage from its ID.</remarks>
    /// <param name="worldLinkUUID">UUID of the World Link to retrieve.</param>
    /// <response code="200">Successful operation.</response>
    /// <response code="400">Invalid UUID supplied.</response>
    /// <response code="404">Not found, could not find UUID in database.</response>
@@ -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
    }

    /// <summary>
    /// Returns the list of all links defined by the world storage.
    /// Return all World Links.
    /// </summary>
    /// <response code="200">OK returns all the worldLinks defined by the world storage.</response>
    /// <response code="201">Null response</response>
    /// <remarks>Get all the World Links currently being stored in the world storage.</remarks>
    /// <response code="200">OK return all the World Links defined by the world storage.</response>
    /// <response code="201">Null response.</response>
    /// <response code="0">Unexpected error.</response>
    [HttpGet]
    [Route("/worldLinks")]
    [ValidateModelState]
    [SwaggerOperation("GetWorldLinks")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<WorldLink>), description: "OK returns all the worldLinks defined by the world storage.")]
    [SwaggerResponse(statusCode: 200, type: typeof(List<WorldLink>), 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());
      }
    }
  }