From 9dfbc74377bc7c9018c17ad68315eeccab11d697 Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sun, 18 Mar 2018 20:21:24 +0100 Subject: [PATCH] Add basic infos and login endpoint to docs --- api/apib/auth/login.apib | 11 ++++++++ api/apib/auth/signup.apib | 12 ++++++++ api/apib/base/authentication.apib | 1 - api/apib/base/datetime.apib | 10 +++++++ api/apib/data_structures/_auth.apib | 41 ++++++++++++++++++++++++++++ api/apib/data_structures/_squad.apib | 12 ++++++++ api/apib/data_structures/index.apib | 5 ++++ api/apib/documentation.apib | 40 ++++++++++++++++++++++++++- api/package.json | 2 +- package.json | 2 +- 10 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 api/apib/auth/login.apib create mode 100644 api/apib/auth/signup.apib delete mode 100644 api/apib/base/authentication.apib create mode 100644 api/apib/base/datetime.apib create mode 100644 api/apib/data_structures/_auth.apib create mode 100644 api/apib/data_structures/_squad.apib create mode 100644 api/apib/data_structures/index.apib diff --git a/api/apib/auth/login.apib b/api/apib/auth/login.apib new file mode 100644 index 0000000..acb264a --- /dev/null +++ b/api/apib/auth/login.apib @@ -0,0 +1,11 @@ +### Login - Generate Token [POST /authenticate] + +Generate a token which can be used to make API requests. + ++ Request Generate Token (application/json) + + + Attributes (Login) + ++ Response 200 (application/json;charset=UTF-8) + + + Attributes (LoginResponse) diff --git a/api/apib/auth/signup.apib b/api/apib/auth/signup.apib new file mode 100644 index 0000000..1309040 --- /dev/null +++ b/api/apib/auth/signup.apib @@ -0,0 +1,12 @@ +### Sign up - Create account [POST /authenticate/signup] + +Create a new application user account. + + ++ Request Create Account (application/json) + + + Attributes (Registration) + ++ Response 201 (application/json;charset=UTF-8) + + + Attributes (RegistrationResponse) diff --git a/api/apib/base/authentication.apib b/api/apib/base/authentication.apib deleted file mode 100644 index 0c8163d..0000000 --- a/api/apib/base/authentication.apib +++ /dev/null @@ -1 +0,0 @@ -## Authentication diff --git a/api/apib/base/datetime.apib b/api/apib/base/datetime.apib new file mode 100644 index 0000000..08b9a7b --- /dev/null +++ b/api/apib/base/datetime.apib @@ -0,0 +1,10 @@ +## Timezones & Date Format + +**Date Format** + +In general the API returns and expects dates & times in the ISO 8601 format including the timezone specification. +For example: `2017-02-27T17:05:06+01:00` for a time or `2017-02-27` for a date. + +**Timezone** + +The default timezone returned will be the server timezone: Europe/Berlin (UTC+1). diff --git a/api/apib/data_structures/_auth.apib b/api/apib/data_structures/_auth.apib new file mode 100644 index 0000000..33affb9 --- /dev/null +++ b/api/apib/data_structures/_auth.apib @@ -0,0 +1,41 @@ +# Login (object) +User related entity for creating a token using application credentials + +## Properties + ++ username: `hardiready` (string, required) - username of the app-user ++ password: `password` (string, required) - password of the app-user + +# LoginResponse (object) +Response object on successful token creation + +## Properties + ++ _id: `593d632772d35225232bcabb` (string, required) - the unique id of the app-user ++ username: `hardiready` (string, required) - the username of the app-user ++ permission: 1 - the permission level of the app-user (0 - user, 1 - sql, 2 - hl, 3 - maintainer, 4 - admin) ++ squad (Squad, required) - squad the app-user is member of ++ token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1OTNkNWUzZjcyZDM1MjI1MjIyYmNhYmEiLCJpYXQiOjE1MjEzOTQ5NDYsImV4cCI6MTUyMzgxNDE0Nn0.vOAwA5--qrx8BglhyGZWVYx7LeuRKOHH0NQXmHFNhIQ` (string,required) - generated token ++ tokenExpireDate: `2018-04-15T17:42:25.050Z` (string,required) - expiration date of the token + + +# Registration (object) +User related entity for reflecting membership to another resource (groups, material databases) + +## Properties + ++ email: `darth.vader@starwars.com` (string, required) - email of the user ++ password: `password` (string, required) - password of the user ++ first_name: `Anakin` (string, required) - first name of the user ++ last_name: `Skywalker` (string, required) - last name of the user ++ role: `Fleet Commander` (string) - role of the user in his organization ++ organization: `Imperium` (string) - organization the user is member of + + +# RegistrationResponse (object) +Response object on successful user registration + +## Properties + ++ email: `darth.vader@starwars.com` (string) - email the new user has been created with ++ uuid: `123e4567-e89b-12d3-a456-426655440000` (string) - a unique key to the user which is to be used across 3rd party applications diff --git a/api/apib/data_structures/_squad.apib b/api/apib/data_structures/_squad.apib new file mode 100644 index 0000000..b69789a --- /dev/null +++ b/api/apib/data_structures/_squad.apib @@ -0,0 +1,12 @@ +# Squad (object) +Default API Squad entity + +## Properties + ++ _id: `591470249e9fae286e008e31` (string, required) ++ sortingNumber: 30 (number, required) ++ updatedAt: `2017-05-31T20:43:07.165Z` (string, required) ++ timestamp: `2017-05-11T14:07:32.471Z` (string, required) ++ name: `Alpha` (string, required) ++ fraction: `BLUFOR` (string, required) ++ __v: 2 (number, required) diff --git a/api/apib/data_structures/index.apib b/api/apib/data_structures/index.apib new file mode 100644 index 0000000..734606b --- /dev/null +++ b/api/apib/data_structures/index.apib @@ -0,0 +1,5 @@ +# Data Structures + + + + diff --git a/api/apib/documentation.apib b/api/apib/documentation.apib index d2f9ecb..762d91d 100644 --- a/api/apib/documentation.apib +++ b/api/apib/documentation.apib @@ -1,3 +1,41 @@ +FORMAT: 1A + # Operation Pandora Trigger Command Center API Documentation - + + +# Group General Introduction + + + +# Group Access + +## Authentication + + + + + +# Group Account + +# Group Awardings + +# Group Campaigns + +# Group Decorations + +# Group Logs + +# Group Overview + +# Group Players + +# Group Ranks + +# Group Requests + +# Group Squads + +# Group Users + +# Group Wars diff --git a/api/package.json b/api/package.json index 1006e9c..cb402f0 100644 --- a/api/package.json +++ b/api/package.json @@ -12,7 +12,7 @@ "lint": "eslint '**/*.js'", "test": "mocha --require ./test/config/spec_helper.js", "e2e": "NODE_ENV=test node server.js", - "api:docs": "$(npm bin)/aglio -i ./apib/documentation.apib -o ../public/api-docs.html" + "api:docs": "$(npm bin)/aglio --theme-variables slate -i ./apib/documentation.apib -o ../public/api-docs.html" }, "dependencies": { "async": "^2.5.0", diff --git a/package.json b/package.json index a6f5d7a..9e3a705 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opt-cc", - "version": "1.7.1", + "version": "1.7.2", "author": "Florian Hartwich ", "private": true, "scripts": {