From f655b2a71048411db41199d4bbcadef528648360 Mon Sep 17 00:00:00 2001 From: Roland Bernard <rolbernard@unibz.it> Date: Wed, 16 Jun 2021 21:32:36 +0200 Subject: [PATCH] Added API documentation for authentication --- README.md | 2 +- docs/api-docs.md | 13 ++++++ docs/api/authentication.md | 87 ++++++++++++++++++++++++++++++++++++++ docs/api/comments.md | 1 + docs/api/projects.md | 1 + docs/api/tasks.md | 1 + docs/api/teams.md | 1 + docs/api/users.md | 1 + docs/api/work.md | 1 + docs/mockups.md | 1 + 10 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 docs/api/authentication.md create mode 100644 docs/api/comments.md create mode 100644 docs/api/projects.md create mode 100644 docs/api/tasks.md create mode 100644 docs/api/teams.md create mode 100644 docs/api/users.md create mode 100644 docs/api/work.md diff --git a/README.md b/README.md index 7803c70..ba29a56 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ facilitates effective collaboration. * [Mockups](docs/mockups.md) * [Accessibility Report](docs/accessibility.md) * [User Documentation](docs/user-docs.md) -* [API Documentation](docs/user-docs.md) +* [API Documentation](docs/api-docs.md) ## Getting Started diff --git a/docs/api-docs.md b/docs/api-docs.md index e69de29..523d322 100644 --- a/docs/api-docs.md +++ b/docs/api-docs.md @@ -0,0 +1,13 @@ +# API v1 documentation + +This document lists and describes all of the api paths in the current version of the backend api +implementation. The documentation is split into multiple different files: + +* [Authentication](api/authentication.md) +* [Users](api/users.md) +* [Teams](api/teams.md) +* [Projects](api/projects.md) +* [Tasks](api/tasks.md) +* [Comments](api/comments.md) +* [Work](api/work.md) + diff --git a/docs/api/authentication.md b/docs/api/authentication.md new file mode 100644 index 0000000..9f3b769 --- /dev/null +++ b/docs/api/authentication.md @@ -0,0 +1,87 @@ +## Authentication + +### POST `/auth/register` + +Register a new user account with the given username and password. Optionally a email and real name +can also be supplied. + +#### Request body + +```typescript +interface Body { + username: string; + password: string; + email?: string; + realname?: string; +} +``` + +#### Response body + +```typescript +interface Body { + status: string; + token: string; +} +``` + +### POST `/auth/token` + +Request a authentication token for this API. Only if the username and password match one of the +users registered, a token for authentication will be generated and returned. + +#### Request body + +```typescript +interface Body { + username: string; + password: string; +} +``` + +#### Response body + +```typescript +interface Body { + status: string; + token: string; +} +``` + +### GET `/auth/extend` [requires authentication] + +Request an extension of the token that is used during the request. After successful extension the +new token will be returned in the response body. + +#### Response body + +```typescript +interface Body { + status: string; + token: string; +} +``` + +### PUT `/auth/username` [requires authentication] + +Request a change of the username for the current user. + +#### Request body + +```typescript +interface Body { + username: string; +} +``` + +### PUT `/auth/password` [requires authentication] + +Request a change of the password for the current user. + +#### Request body + +```typescript +interface Body { + password: string; +} +``` diff --git a/docs/api/comments.md b/docs/api/comments.md new file mode 100644 index 0000000..1802bce --- /dev/null +++ b/docs/api/comments.md @@ -0,0 +1 @@ +## Comments diff --git a/docs/api/projects.md b/docs/api/projects.md new file mode 100644 index 0000000..c05bb3a --- /dev/null +++ b/docs/api/projects.md @@ -0,0 +1 @@ +## Projects diff --git a/docs/api/tasks.md b/docs/api/tasks.md new file mode 100644 index 0000000..256eeae --- /dev/null +++ b/docs/api/tasks.md @@ -0,0 +1 @@ +## Tasks diff --git a/docs/api/teams.md b/docs/api/teams.md new file mode 100644 index 0000000..fe195f3 --- /dev/null +++ b/docs/api/teams.md @@ -0,0 +1 @@ +## Teams diff --git a/docs/api/users.md b/docs/api/users.md new file mode 100644 index 0000000..9bfeefc --- /dev/null +++ b/docs/api/users.md @@ -0,0 +1 @@ +## Users diff --git a/docs/api/work.md b/docs/api/work.md new file mode 100644 index 0000000..bc25cb9 --- /dev/null +++ b/docs/api/work.md @@ -0,0 +1 @@ +## Work diff --git a/docs/mockups.md b/docs/mockups.md index b950a0d..b2dda54 100644 --- a/docs/mockups.md +++ b/docs/mockups.md @@ -14,3 +14,4 @@ This document includes some of the mockups created during the design phase of th    + -- GitLab