upd(all): codegen update handlers/request pkgs

This commit is contained in:
Tit Petric
2019-04-03 14:45:38 +02:00
parent a1aadeaa2f
commit e27720dc93
41 changed files with 397 additions and 200 deletions
+77 -1
View File
@@ -1,5 +1,12 @@
# Attachments
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/attachment/{kind}/` | List, filter all page attachments |
| `GET` | `/attachment/{kind}/{attachmentID}` | Attachment details |
| `GET` | `/attachment/{kind}/{attachmentID}/original/{name}` | Serves attached file |
| `GET` | `/attachment/{kind}/{attachmentID}/preview.{ext}` | Serves preview of an attached file |
## List, filter all page attachments
#### Method
@@ -68,11 +75,21 @@
| ext | string | PATH | Preview extension/format | N/A | YES |
| kind | string | PATH | Attachment kind | N/A | YES |
---
# Charts
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/chart/` | List/read charts from module section |
| `POST` | `/chart/` | List/read charts from module section |
| `GET` | `/chart/{chartID}` | Read charts by ID from module section |
| `POST` | `/chart/{chartID}` | Add/update charts in module section |
| `DELETE` | `/chart/{chartID}` | Delete chart |
## List/read charts from module section
#### Method
@@ -145,6 +162,8 @@
| --------- | ---- | ------ | ----------- | ------- | --------- |
| chartID | uint64 | PATH | Chart ID | N/A | YES |
---
@@ -152,6 +171,14 @@
CRM module definitions
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/module/` | List modules |
| `POST` | `/module/` | Create module |
| `GET` | `/module/{moduleID}` | Read module |
| `POST` | `/module/{moduleID}` | Update module |
| `DELETE` | `/module/{moduleID}` | Delete module |
## List modules
#### Method
@@ -227,6 +254,8 @@ CRM module definitions
| --------- | ---- | ------ | ----------- | ------- | --------- |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
---
@@ -234,6 +263,10 @@ CRM module definitions
CRM Notifications
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `POST` | `/notification/email` | Send email from the CRM |
## Send email from the CRM
#### Method
@@ -252,6 +285,8 @@ CRM Notifications
| subject | string | POST | Email subject | N/A | NO |
| content | sqlxTypes.JSONText | POST | Message content | N/A | YES |
---
@@ -259,6 +294,17 @@ CRM Notifications
CRM module pages
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/page/` | List available pages |
| `POST` | `/page/` | Create page |
| `GET` | `/page/{pageID}` | Get page details |
| `GET` | `/page/tree` | Get page all (non-record) pages, hierarchically |
| `POST` | `/page/{pageID}` | Update page |
| `POST` | `/page/{selfID}/reorder` | Reorder pages |
| `Delete` | `/page/{pageID}` | Delete page |
| `POST` | `/page/{pageID}/attachment` | Uploads attachment to page |
## List available pages
#### Method
@@ -383,11 +429,17 @@ CRM module pages
| pageID | uint64 | PATH | Page ID | N/A | YES |
| upload | *multipart.FileHeader | POST | File to upload | N/A | YES |
---
# Permissions
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/permissions/effective` | Effective rules for current user |
## Effective rules for current user
#### Method
@@ -402,6 +454,8 @@ CRM module pages
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resource | string | GET | Show only rules for a specific resource | N/A | NO |
---
@@ -409,6 +463,16 @@ CRM module pages
CRM records
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/module/{moduleID}/record/report` | Generates report from module records |
| `GET` | `/module/{moduleID}/record/` | List/read records from module section |
| `POST` | `/module/{moduleID}/record/` | Create record in module section |
| `GET` | `/module/{moduleID}/record/{recordID}` | Read records by ID from module section |
| `POST` | `/module/{moduleID}/record/{recordID}` | Update records in module section |
| `DELETE` | `/module/{moduleID}/record/{recordID}` | Delete record row from module section |
| `POST` | `/module/{moduleID}/record/{recordID}/{fieldName}/attachment` | Uploads attachment and validates it against record field requirements |
## Generates report from module records
#### Method
@@ -522,6 +586,8 @@ CRM records
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| upload | *multipart.FileHeader | POST | File to upload | N/A | YES |
---
@@ -529,6 +595,14 @@ CRM records
CRM Triggers
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/trigger/` | List available triggers |
| `POST` | `/trigger/` | Create trigger |
| `GET` | `/trigger/{triggerID}` | Get trigger details |
| `POST` | `/trigger/{triggerID}` | Update trigger |
| `Delete` | `/trigger/{triggerID}` | Delete trigger |
## List available triggers
#### Method
@@ -606,4 +680,6 @@ CRM Triggers
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| triggerID | uint64 | PATH | Trigger ID | N/A | YES |
| triggerID | uint64 | PATH | Trigger ID | N/A | YES |
---
+55 -1
View File
@@ -1,5 +1,10 @@
# Attachments
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/attachment/{attachmentID}/original/{name}` | Serves attached file |
| `GET` | `/attachment/{attachmentID}/preview.{ext}` | Serves preview of an attached file |
## Serves attached file
#### Method
@@ -31,6 +36,8 @@
| ext | string | PATH | Preview extension/format | N/A | YES |
| attachmentID | uint64 | PATH | Attachment ID | N/A | YES |
---
@@ -38,6 +45,21 @@
A channel is a representation of a sequence of messages. It has meta data like channel subject. Channels may be public, private or group.
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/channels/` | List channels |
| `POST` | `/channels/` | Create new channel |
| `PUT` | `/channels/{channelID}` | Update channel details |
| `PUT` | `/channels/{channelID}/state` | Update channel state |
| `PUT` | `/channels/{channelID}/flag` | Update channel membership flag |
| `DELETE` | `/channels/{channelID}/flag` | Remove channel membership flag |
| `GET` | `/channels/{channelID}` | Read channel details |
| `GET` | `/channels/{channelID}/members` | List channel members |
| `PUT` | `/channels/{channelID}/members/{userID}` | Join channel |
| `DELETE` | `/channels/{channelID}/members/{userID}` | Remove member from channel |
| `POST` | `/channels/{channelID}/invite` | Join channel |
| `POST` | `/channels/{channelID}/attach` | Attach file to channel |
## List channels
#### Method
@@ -220,6 +242,8 @@ A channel is a representation of a sequence of messages. It has meta data like c
| replyTo | uint64 | POST | Upload as a reply | N/A | NO |
| upload | *multipart.FileHeader | POST | File to upload | N/A | YES |
---
@@ -245,6 +269,22 @@ The following event types may be sent with a message event:
| EDITED | A message has been edited by the sender |
| REMOVED | A message has been removed by the sender |
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `POST` | `/channels/{channelID}/messages/` | Post new message to the channel |
| `GET` | `/channels/{channelID}/messages/` | All messages (channel history) |
| `GET` | `/channels/{channelID}/messages/mark-as-read` | Manages read/unread messages in a channel or a thread |
| `PUT` | `/channels/{channelID}/messages/{messageID}` | Edit existing message |
| `DELETE` | `/channels/{channelID}/messages/{messageID}` | Delete existing message |
| `GET` | `/channels/{channelID}/messages/{messageID}/replies` | Returns all replies to a message |
| `POST` | `/channels/{channelID}/messages/{messageID}/replies` | Reply to a message |
| `POST` | `/channels/{channelID}/messages/{messageID}/pin` | Pin message to channel (public bookmark) |
| `DELETE` | `/channels/{channelID}/messages/{messageID}/pin` | Pin message to channel (public bookmark) |
| `POST` | `/channels/{channelID}/messages/{messageID}/bookmark` | Bookmark a message (private bookmark) |
| `DELETE` | `/channels/{channelID}/messages/{messageID}/bookmark` | Remove boomark from message (private bookmark) |
| `POST` | `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | React to a message |
| `DELETE` | `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | Delete reaction from a message |
## Post new message to the channel
#### Method
@@ -445,11 +485,17 @@ The following event types may be sent with a message event:
| reaction | string | PATH | Reaction | N/A | YES |
| channelID | uint64 | PATH | Channel ID | N/A | YES |
---
# Permissions
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/permissions/effective` | Effective rules for current user |
## Effective rules for current user
#### Method
@@ -464,11 +510,17 @@ The following event types may be sent with a message event:
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resource | string | GET | Show only rules for a specific resource | N/A | NO |
---
# Search entry point
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/search/messages` | Search for messages |
## Search for messages
#### Method
@@ -485,4 +537,6 @@ The following event types may be sent with a message event:
| fromUser | uint64 | GET | Search only from one user | N/A | NO |
| firstID | uint64 | GET | Paging; return newer messages only (higher id) | N/A | NO |
| lastID | uint64 | GET | Paging; return older messages only (lower id) | N/A | NO |
| query | string | GET | Search query | N/A | NO |
| query | string | GET | Search query | N/A | NO |
---
+68 -1
View File
@@ -1,5 +1,13 @@
# Applications
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/application/` | List applications |
| `POST` | `/application/` | Create application |
| `PUT` | `/application/{applicationID}` | Update user details |
| `GET` | `/application/{applicationID}` | Read application details |
| `DELETE` | `/application/{applicationID}` | Remove application |
## List applications
#### Method
@@ -76,11 +84,19 @@
| --------- | ---- | ------ | ----------- | ------- | --------- |
| applicationID | uint64 | PATH | Application ID | N/A | YES |
---
# Authentication
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/auth/check` | Check JWT token |
| `POST` | `/auth/login` | Login user |
| `GET` | `/auth/logout` | Delete JWT token (Sign Out) |
## Check JWT token
#### Method
@@ -122,6 +138,8 @@
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
---
@@ -129,6 +147,15 @@
Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/organisations/` | List organisations |
| `POST` | `/organisations/` | Create organisation |
| `PUT` | `/organisations/{id}` | Update organisation details |
| `DELETE` | `/organisations/{id}` | Remove organisation |
| `GET` | `/organisations/{id}` | Read organisation details |
| `POST` | `/organisations/{id}/archive` | Archive organisation |
## List organisations
#### Method
@@ -214,11 +241,21 @@ Organisations represent a top-level grouping entity. There may be many organisat
| --------- | ---- | ------ | ----------- | ------- | --------- |
| id | uint64 | PATH | Organisation ID | N/A | YES |
---
# Permissions
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/permissions/` | Retrieve defined permissions |
| `GET` | `/permissions/effective` | Effective rules for current user |
| `GET` | `/permissions/{roleID}/rules` | Retrieve role permissions |
| `DELETE` | `/permissions/{roleID}/rules` | Remove all defined role permissions |
| `PATCH` | `/permissions/{roleID}/rules` | Update permission settings |
## Retrieve defined permissions
#### Method
@@ -289,6 +326,8 @@ Organisations represent a top-level grouping entity. There may be many organisat
| roleID | uint64 | PATH | Role ID | N/A | YES |
| permissions | []rules.Rule | POST | List of permissions to set | N/A | YES |
---
@@ -296,6 +335,20 @@ Organisations represent a top-level grouping entity. There may be many organisat
An organisation may have many roles. Roles may have many channels available. Access to channels may be shared between roles.
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/roles/` | List roles |
| `POST` | `/roles/` | Update role details |
| `PUT` | `/roles/{roleID}` | Update role details |
| `GET` | `/roles/{roleID}` | Read role details and memberships |
| `DELETE` | `/roles/{roleID}` | Remove role |
| `POST` | `/roles/{roleID}/archive` | Archive role |
| `POST` | `/roles/{roleID}/move` | Move role to different organisation |
| `POST` | `/roles/{roleID}/merge` | Merge one role into another |
| `GET` | `/roles/{roleID}/members` | Returns all role members |
| `POST` | `/roles/{roleID}/member/{userID}` | Add member to a role |
| `DELETE` | `/roles/{roleID}/member/{userID}` | Remove member from a role |
## List roles
#### Method
@@ -457,11 +510,23 @@ An organisation may have many roles. Roles may have many channels available. Acc
| roleID | uint64 | PATH | Source Role ID | N/A | YES |
| userID | uint64 | PATH | User ID | N/A | YES |
---
# Users
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/users/` | Search users (Directory) |
| `POST` | `/users/` | Create user |
| `PUT` | `/users/{userID}` | Update user details |
| `GET` | `/users/{userID}` | Read user details and memberships |
| `DELETE` | `/users/{userID}` | Remove user |
| `POST` | `/users/{userID}/suspend` | Suspend user |
| `POST` | `/users/{userID}/unsuspend` | Unsuspend user |
## Search users (Directory)
#### Method
@@ -567,4 +632,6 @@ An organisation may have many roles. Roles may have many channels available. Acc
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| userID | uint64 | PATH | User ID | N/A | YES |
| userID | uint64 | PATH | User ID | N/A | YES |
---