From 16ef41800d219e4ed4a55a9f202e357c4c0c5f32 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Fri, 22 Nov 2024 12:20:33 +0100 Subject: [PATCH] added endpoint documentation --- docs/README.md | 2 +- docs/api/endpoints.md | 21 +++++++++++++++++++++ docs/api/logicresults.md | 2 +- docs/api/models.md | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 docs/api/models.md diff --git a/docs/README.md b/docs/README.md index 9b12c36..3d1b031 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,5 +9,5 @@ - [x] AuthService usage - [x] AuthMiddleware usage - [ ] AdminPages usage -- [ ] Endpoints usage +- [x] Endpoints usage - [ ] Blazor pages usage diff --git a/docs/api/endpoints.md b/docs/api/endpoints.md index e69de29..f082a1d 100644 --- a/docs/api/endpoints.md +++ b/docs/api/endpoints.md @@ -0,0 +1,21 @@ +# HopFrame Endpoints +HopFrame currently only supports endpoints for authentication out of the box. + +> **Hint:** with the help of the [repositories](../repositories.md) you can very easily create missing endpoints for HopFrame components yourself. + +## All currently supported endpoints + +> **Hint:** you can use the build-in [swagger](https://swagger.io/) ui to explore and test all endpoints of your application __including__ HopFrame endpoints. + +### SecurityController +Base endpoint: `api/v1/authentication`\ +**Important:** All primitive data types (including `string`) are return as a [`SingleValueResult`](./models.md#SingleValueResult) + + +| Method | Endpoint | Payload | Returns | +| ------ | -------- | ------- | ------- | +| PUT | login | [UserLogin](./models.md#UserLogin) | access token (string) | +| POST | register | [UserRegister](./models#UserRegister) | access token (string) | +| GET | authenticate | | access token (string) | +| DELETE | logout | | | +| DELETE | delete | [UserPasswordValidation](./models.md#UserPasswordValidation) | | diff --git a/docs/api/logicresults.md b/docs/api/logicresults.md index aacb6e5..ad2fe43 100644 --- a/docs/api/logicresults.md +++ b/docs/api/logicresults.md @@ -30,4 +30,4 @@ They help you sending the right `HttpStatusCode` with the right data. return LogicResult.Ok("Hello, World!"); } ``` - **Hint:** You can also provide an error message for status codes that are not in the 200 range. \ No newline at end of file + > **Hint:** You can also provide an error message for status codes that are not in the 200 range. \ No newline at end of file diff --git a/docs/api/models.md b/docs/api/models.md new file mode 100644 index 0000000..049ea1f --- /dev/null +++ b/docs/api/models.md @@ -0,0 +1,33 @@ +# HopFrame Models +All models used by the RestAPI are listed below + +## SingleValueResult +```csharp +public struct SingleValueResult(TValue value) { + public TValue Value { get; set; } = value; +} +``` + +## UserLogin +```csharp +public class UserLogin { + public string Email { get; set; } + public string Password { get; set; } +} +``` + +## UserRegister +```csharp +public class UserRegister { + public string Username { get; set; } + public string Email { get; set; } + public string Password { get; set; } +} +``` + +## UserPasswordValidation +```csharp +public sealed class UserPasswordValidation { + public string Password { get; set; } +} +```