diff --git a/research/API Documentation.md b/research/API Documentation.md index 8a5aaf8..73732e1 100644 --- a/research/API Documentation.md +++ b/research/API Documentation.md @@ -3,19 +3,19 @@ ___ > Values required in **`bold`**. ### **Accounts** | `account` -| field | data type | metadata | -| :-------------| :---------------- | :-------------------------------------------------- | -| id | unsigned integer | primary key, auto-increments, generated by database | -| username | varchar | required | -| email | varchar | required | -| password | varchar | required | -| timezone | varchar | | -| earliest_time | varchar | | -| latest_time | varchar | | -| created_at | datetime | generated by database | +| field | data type | metadata | +| :-------------| :---------------- | :-------------------------- | +| id | unsigned integer | primary key, auto-increment | +| username | varchar | required | +| email | varchar | required | +| password | varchar | required | +| timezone | varchar | | +| earliest_time | varchar | | +| latest_time | varchar | | +| created_at | datetime | generated by database | -#### Register an account -**`POST /api/account/register`** +#### Add an account +**`POST /api/accounts/add`** ##### Request A json object for the user to register with **`username`**, **`email`**, **`password`**, `timezone`, `earliest_time` and `latest_time`. @@ -49,7 +49,7 @@ A json object for the registered user with `id`, `username`, `email`, `timezone` ``` #### Log in an account -**`POST /api/account/login`** +**`POST /api/accounts/login`** ##### Request A json object for the user to login with either **`email`** or **`username`**, and **`password`** . @@ -79,7 +79,7 @@ A json object for the registered user with `id`, `username`, `email`, `timezone` ``` #### Update an account -**`PUT /api/account/:id/profile`** +**`PUT /api/accounts/:id`** ##### Request A json object for the user to register with `id` and any of `username`, `email`, `password`, `timezone`, `earliest_time`, `latest_time`. @@ -110,7 +110,7 @@ A json object for the registered user with `id`, `username`, `email`, `timezone` ``` #### Delete an account -**`DELETE /api/account/:id`** +**`DELETE /api/accounts/:id`** ##### Request A json object for the user to delete with `id`. @@ -135,53 +135,8 @@ A json object for the deleted user with `username` and `email`. } ``` -### **Meetings** | `meeting` -| field | data type | metadata | -| :---------- | :-------- | :-------------------------------------------------------------------------------- | -| id | varchar | primary key, first 30 chars of `title` with words separated by `-` + 5 random int | -| title | varchar | required | -| description | varchar | | -| start_time | datetime | | -| timezone | varchar | | -| duration | int | required | -| status | boolean | required: `0` (proposed) or `1` (confirmed) | -| password | varchar | | -| created_at | datetime | generated by database | - -#### Add a meeting -**`POST /api/meeting/add`** - -##### Request -A json object for the meeting to add with **`id`**, **`title`**, `description`, `start_time`, **`duration`** and `password`. - -``` -{ - "id": "worldwide-strategy-meeting-for-11059", - "title": "Worldwide strategy meeting for growth", - "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.", - "duration": 90, - "password": "generic-password" -} -``` - -##### Response -A json object for the added meeting with `id`, `title`, `description`, `start_time`, `duration`, `status` and `password`. - -``` -{ - "status": 201, - "data": { - "id": "worldwide-strategy-meeting-for-11059", - "title": "Worldwide strategy meeting for growth", - "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.", - "duration": 90, - "status": 0 - } -} -``` - #### Get a list of meetings for an account -**`GET /api/meeting/account/:account_id`** +**`GET /api/accounts/:account_id/meetings`** ##### Request A json object with an `account_id`. @@ -218,8 +173,53 @@ A json object for the specified account with an array of `meeting`. } ``` +### **Meetings** | `meeting` +| field | data type | metadata | +| :---------- | :-------- | :-------------------------------------------------------------------------------- | +| id | varchar | primary key, first 30 chars of `title` with words separated by `-` + 5 random int | +| title | varchar | required | +| description | varchar | | +| start_time | datetime | | +| timezone | varchar | | +| duration | int | required | +| status | boolean | required: `0` (proposed) or `1` (confirmed) | +| password | varchar | | +| created_at | datetime | generated by database | + +#### Add a meeting +**`POST /api/meetings/add`** + +##### Request +A json object for the meeting to add with **`id`**, **`title`**, `description`, `start_time`, **`duration`** and `password`. + +``` +{ + "id": "worldwide-strategy-meeting-for-11059", + "title": "Worldwide strategy meeting for growth", + "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.", + "duration": 90, + "password": "generic-password" +} +``` + +##### Response +A json object for the added meeting with `id`, `title`, `description`, `start_time`, `duration`, `status` and `password`. + +``` +{ + "status": 201, + "data": { + "id": "worldwide-strategy-meeting-for-11059", + "title": "Worldwide strategy meeting for growth", + "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.", + "duration": 90, + "status": 0 + } +} +``` + #### Update a meeting -**`PUT /api/meeting/:id`** +**`PUT /api/meetings/:id`** ##### Request A json object for the meeting to update with `id`, `acount_id` and any of `title`, `description`, `start_time`, `timezone`, `duration`, `status` and `password`. @@ -253,7 +253,7 @@ A json object for the updated meeting with `id`, `title`, `description`, `start_ ``` #### Delete a meeting -**`DELETE /api/account/:id`** +**`DELETE /api/meetings/:id`** ##### Request A json object for the meeting to delete with `id` and `account_id`. @@ -276,4 +276,232 @@ A json object for the deleted user with `username` and `email`. "title": "Worldwide strategy meeting for growth", } } -``` \ No newline at end of file +``` + +#### Get a list of all invited for a meeting +**`GET /api/meeting/:id/invited`** + +##### Request +A json object with an `account_id`. + +``` +{ + "id": "worldwide-strategy-meeting-for-11059", + "account_id": 5 +} +``` + +##### Response +A json object for the specified meeting with an array of `invited`. + +``` +{ + "status": 200, + "data": [ + { + "id": 23, + "account_id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "earliest_time": "09:30 AM", + "latest_time": "05:00 PM", + "quorum": 1, + "mandatory": 1, + "host": 1, + "answered": 1, + "timezone": "Europe/Brussels" + }, + { + "id": 28, + "account_id": 11, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "earliest_time": "10:00 AM", + "latest_time": "09:00 PM", + "quorum": 0, + "mandatory": 1, + "host": 0, + "answered": 1, + "timezone": "Europe/Brussels" + } + ] +} +``` + + +### **Possible Dates** | `possible_date` +| field | data type | metadata | +| :------------ | :-------- | :-------------------------- | +| id | int | primary key, auto-increment | +| meeting_id | varchar | foreign key, required | +| possible_date | date | foreign key, required | + +#### Add a possible date +**`POST /api/possible-dates`** + +##### Request +A json object for the meeting to add with **`meeting_id`** and **`possible_date`**. + +``` +{ + "meeting_id": "worldwide-strategy-meeting-for-11059", + "possible_date": 2020-02-18 +} +``` + +##### Response +A json object for the added meeting with `id`, `meeting_id` and `possible_date`. + +``` +{ + "status": 201, + "data": { + "id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "possible_date": 2020-02-18 + } +} +``` +#### Delete a possible date +**`DELETE /api/possible-dates/:id`** + +##### Request +A json object for the possible date to delete with `id` and `account_id`. + +``` +{ + "id": 12, + "account_id": 5 +} +``` + +##### Response +A json object for the deleted possible date with `id` and `possible_date`. + +``` +{ + "status": 200, + "data": { + "id": 15, + "possible_date": 2020-02-18 + } +} +``` + +### **Invited** | `invited` +| field | data type | metadata | +| :------------ | :-------- | :-------------------------- | +| account_id | int | primary key, auto-increment | +| meeting_id | varchar | required | +| earliest_time | datetime | | +| latest_time | datetime | | +| quorum | boolean | `0` (no) or `1` (yes) | +| mandatory | boolean | `0` (no) or `1` (yes) | +| host | boolean | `0` (no) or `1` (yes) | +| answered | boolean | `0` (no) or `1` (yes) | +| timezone | varchar | required | +| created_at | datetime | generated by database | + +#### Add an invited +**`POST /api/invited`** + +##### Request +A json object for the invited to add with **`account_id`**, **`meeting_id`**, **`earliest_time`**, **`latest_time`**, **`quorum`**, **`mandatory`**, **`host`**, **`answered`** and **`timezone`**. + +``` +{ + "account_id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "earliest_time": "08:30 AM", + "latest_time": "08:00 PM", + "quorum": 0, + "mandatory": 1, + "host": 0, + "answered": 0, + "timezone": "Europe/Brussels" +} +``` + +##### Response +A json object for the invited with `id`, `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`. + +``` +{ + "status": 201, + "data": { + "id": 23, + "account_id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "earliest_time": "08:30 AM", + "latest_time": "08:00 PM", + "quorum": 0, + "mandatory": 1, + "host": 0, + "answered": 0, + "timezone": "Europe/Brussels" + } +} +``` + +#### Update an invited +**`PUT /api/invited/:id`** + +##### Request +A json object for the user to invite with `id` and any of `id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`. + +``` +{ + "account_id": 5, + "earliest_time": "09:30 AM", + "latest_time": "05:00 PM", + "quorum": 1, + "host": 1, + "answered": 1, +} +``` + +##### Response +A json object for the invited user with `id`, `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`. + +``` +{ + "status": 200, + "data": { + "id": 23, + "account_id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059", + "earliest_time": "09:30 AM", + "latest_time": "05:00 PM", + "quorum": 1, + "mandatory": 1, + "host": 1, + "answered": 1, + "timezone": "Europe/Brussels" + } +} +``` + +#### Delete an invited +**`DELETE /api/invited/:id`** + +##### Request +A json object for the invited to delete with `id`. + +``` +{ + "id": 23 +} +``` + +##### Response +A json object for the deleted user with `id`, `account_id` and `meeting_id`. + +``` +{ + "status": 200, + "data": { + "id": 15, + "account_id": 5, + "meeting_id": "worldwide-strategy-meeting-for-11059" + } +} +``` +