From 9dd7a609e968a88087cd272eb7a8bbc87f083e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Tue, 19 Jan 2021 14:48:37 +0100 Subject: [PATCH] Add federation to Swagger --- docs/compose.yaml | 311 ++++++++++--------- docs/federation.yaml | 704 +++++++++++++++++++++++++++++++++++++++++++ docs/index.html | 1 + docs/messaging.yaml | 70 ++--- docs/system.yaml | 173 ++++++----- 5 files changed, 1003 insertions(+), 256 deletions(-) create mode 100644 docs/federation.yaml diff --git a/docs/compose.yaml b/docs/compose.yaml index 32fea4e42..8d6bfc751 100644 --- a/docs/compose.yaml +++ b/docs/compose.yaml @@ -2,14 +2,14 @@ openapi: 3.0.0 info: title: Corteza compose API description: Corteza compose REST API definition - version: 2020.12 + version: 1.0.0 contact: - email: info@cortezaproject.org + email: contact@mail.com license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' paths: - /namespace/: + /compose/namespace/: get: tags: - Namespaces @@ -35,6 +35,11 @@ paths: required: false schema: &ref_5 type: string + - in: query + name: labels + description: Labels + required: false + schema: *ref_0 - in: query name: pageCursor description: Page cursor @@ -61,6 +66,9 @@ paths: name: type: string description: Name + labels: + type: string + description: Labels slug: type: string description: Slug (url path part) @@ -78,7 +86,7 @@ paths: schema: type: object properties: *ref_1 - '/namespace/{namespaceID}': + '/compose/namespace/{namespaceID}': get: tags: - Namespaces @@ -125,6 +133,9 @@ paths: type: string format: json description: Meta data + labels: + type: string + description: Labels updatedAt: type: string format: date-time @@ -149,7 +160,7 @@ paths: description: ID required: true schema: *ref_2 - '/namespace/{namespaceID}/trigger': + '/compose/namespace/{namespaceID}/trigger': post: tags: - Namespaces @@ -178,7 +189,7 @@ paths: schema: type: object properties: *ref_4 - '/namespace/{namespaceID}/page/': + '/compose/namespace/{namespaceID}/page/': get: tags: - Pages @@ -202,6 +213,11 @@ paths: description: Search by handle required: false schema: *ref_0 + - in: query + name: labels + description: Labels + required: false + schema: *ref_0 - in: query name: limit description: Limit @@ -253,6 +269,9 @@ paths: weight: type: integer description: Page tree weight + labels: + type: string + description: Labels visible: type: boolean description: Visible in navigation @@ -272,7 +291,7 @@ paths: description: Namespace ID required: true schema: *ref_2 - '/namespace/{namespaceID}/page/{pageID}': + '/compose/namespace/{namespaceID}/page/{pageID}': get: tags: - Pages @@ -333,6 +352,9 @@ paths: weight: type: integer description: Page tree weight + labels: + type: string + description: Labels visible: type: boolean description: Visible in navigation @@ -364,7 +386,7 @@ paths: description: Page ID required: true schema: *ref_2 - '/namespace/{namespaceID}/page/tree': + '/compose/namespace/{namespaceID}/page/tree': get: tags: - Pages @@ -378,7 +400,7 @@ paths: description: Namespace ID required: true schema: *ref_2 - '/namespace/{namespaceID}/page/{selfID}/reorder': + '/compose/namespace/{namespaceID}/page/{selfID}/reorder': post: tags: - Pages @@ -413,7 +435,7 @@ paths: schema: type: object properties: *ref_8 - '/namespace/{namespaceID}/page/{pageID}/attachment': + '/compose/namespace/{namespaceID}/page/{pageID}/attachment': post: tags: - Pages @@ -448,7 +470,7 @@ paths: schema: type: object properties: *ref_9 - '/namespace/{namespaceID}/page/{pageID}/trigger': + '/compose/namespace/{namespaceID}/page/{pageID}/trigger': post: tags: - Pages @@ -482,7 +504,7 @@ paths: schema: type: object properties: *ref_10 - '/namespace/{namespaceID}/module/': + '/compose/namespace/{namespaceID}/module/': get: tags: - Modules @@ -516,6 +538,11 @@ paths: description: Page cursor required: false schema: *ref_0 + - in: query + name: labels + description: Labels + required: false + schema: *ref_0 - in: query name: sort description: Sort items @@ -580,6 +607,9 @@ paths: type: string format: json description: Module meta data + labels: + type: string + description: Module labels required: - name - fields @@ -594,7 +624,7 @@ paths: description: Namespace ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}': + '/compose/namespace/{namespaceID}/module/{moduleID}': get: tags: - Modules @@ -655,6 +685,9 @@ paths: type: string format: date-time description: Last update (or creation) date + labels: + type: string + description: Module labels required: - name - fields @@ -681,7 +714,7 @@ paths: description: Module ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/trigger': + '/compose/namespace/{namespaceID}/module/{moduleID}/trigger': post: tags: - Modules @@ -715,7 +748,7 @@ paths: schema: type: object properties: *ref_14 - '/namespace/{namespaceID}/module/{moduleID}/record/report': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/report': get: tags: - Records @@ -749,7 +782,7 @@ paths: description: Module ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/': get: tags: - Records @@ -768,6 +801,11 @@ paths: description: 'Filtering condition (same as query, deprecated)' required: false schema: *ref_0 + - in: query + name: labels + description: Labels + required: false + schema: *ref_0 - in: query name: deleted description: 'Exclude (0, default), include (1) or return only (2) deleted records' @@ -779,20 +817,21 @@ paths: required: false schema: *ref_5 - in: query - name: offset - description: Offset + name: incTotal + description: Include total records counter required: false - schema: *ref_5 + schema: &ref_15 + type: boolean - in: query - name: page - description: Page number (1-based) + name: incPageNavigation + description: Include page navigation required: false - schema: *ref_5 + schema: *ref_15 - in: query - name: perPage - description: Returned items per page (default 50) + name: pageCursor + description: Page cursor required: false - schema: *ref_5 + schema: *ref_0 - in: query name: sort description: Sort items @@ -820,10 +859,10 @@ paths: application/json: schema: type: object - properties: &ref_15 + properties: &ref_16 values: type: array - items: &ref_20 + items: &ref_21 type: object properties: name: @@ -833,7 +872,7 @@ paths: description: Record values records: type: array - items: &ref_21 + items: &ref_22 type: object properties: recordID: @@ -876,10 +915,13 @@ paths: type: string format: uuid description: Records + labels: + type: string + description: Labels application/x-www-form-urlencoded: schema: type: object - properties: *ref_15 + properties: *ref_16 parameters: - in: path name: namespaceID @@ -903,7 +945,7 @@ paths: application/json: schema: type: object - properties: &ref_16 + properties: &ref_17 recordIDs: type: array items: *ref_0 @@ -913,41 +955,6 @@ paths: description: >- Remove ALL records of a specified module (pending implementation) - application/x-www-form-urlencoded: - schema: - type: object - properties: *ref_16 - parameters: - - in: path - name: namespaceID - description: Namespace ID - required: true - schema: *ref_2 - - in: path - name: moduleID - description: Module ID - required: true - schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/import': - post: - tags: - - Records - summary: Initiate record import session - responses: - '200': - description: OK - requestBody: - content: - application/json: - schema: - type: object - properties: &ref_17 - upload: - type: string - format: binary - description: File import - required: - - upload application/x-www-form-urlencoded: schema: type: object @@ -963,7 +970,42 @@ paths: description: Module ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/import': + post: + tags: + - Records + summary: Initiate record import session + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_18 + upload: + type: string + format: binary + description: File import + required: + - upload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_18 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/compose/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}': patch: tags: - Records @@ -992,7 +1034,7 @@ paths: application/json: schema: type: object - properties: &ref_18 + properties: &ref_19 fields: type: string format: json @@ -1006,7 +1048,7 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_18 + properties: *ref_19 get: tags: - Records @@ -1030,7 +1072,7 @@ paths: description: Import session required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}': get: tags: - Records @@ -1076,7 +1118,7 @@ paths: description: Convert times to this timezone required: false schema: *ref_0 - '/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}': post: tags: - Records @@ -1105,7 +1147,7 @@ paths: application/json: schema: type: object - properties: &ref_19 + properties: &ref_20 args: type: array items: @@ -1119,8 +1161,8 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_19 - '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}': + properties: *ref_20 + '/compose/namespace/{namespaceID}/module/{moduleID}/record/{recordID}': get: tags: - Records @@ -1172,19 +1214,22 @@ paths: application/json: schema: type: object - properties: &ref_22 + properties: &ref_23 values: type: array - items: *ref_20 + items: *ref_21 description: Record values records: type: array - items: *ref_21 + items: *ref_22 description: Records + labels: + type: string + description: Labels application/x-www-form-urlencoded: schema: type: object - properties: *ref_22 + properties: *ref_23 delete: tags: - Records @@ -1208,7 +1253,7 @@ paths: description: Record ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/attachment': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/attachment': post: tags: - Records @@ -1221,7 +1266,7 @@ paths: application/json: schema: type: object - properties: &ref_23 + properties: &ref_24 recordID: type: string description: Record ID @@ -1238,7 +1283,7 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_23 + properties: *ref_24 parameters: - in: path name: namespaceID @@ -1250,7 +1295,7 @@ paths: description: Module ID required: true schema: *ref_2 - '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger': + '/compose/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger': post: tags: - Records @@ -1279,13 +1324,13 @@ paths: application/json: schema: type: object - properties: &ref_24 + properties: &ref_25 script: type: string description: Script to execute values: type: array - items: *ref_20 + items: *ref_21 description: Record values required: - script @@ -1293,8 +1338,8 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_24 - '/namespace/{namespaceID}/module/{moduleID}/record/trigger': + properties: *ref_25 + '/compose/namespace/{namespaceID}/module/{moduleID}/record/trigger': post: tags: - Records @@ -1307,7 +1352,7 @@ paths: application/json: schema: type: object - properties: &ref_25 + properties: &ref_26 script: type: string description: Script to execute @@ -1316,7 +1361,7 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_25 + properties: *ref_26 parameters: - in: path name: namespaceID @@ -1328,7 +1373,7 @@ paths: description: Module ID required: true schema: *ref_2 - '/namespace/{namespaceID}/chart/': + '/compose/namespace/{namespaceID}/chart/': get: tags: - Charts @@ -1347,6 +1392,11 @@ paths: description: Search charts by handle required: false schema: *ref_0 + - in: query + name: labels + description: Labels + required: false + schema: *ref_0 - in: query name: limit description: Limit @@ -1379,7 +1429,7 @@ paths: application/json: schema: type: object - properties: &ref_26 + properties: &ref_27 config: type: string format: json @@ -1390,20 +1440,23 @@ paths: handle: type: string description: Chart handle + labels: + type: string + description: Labels required: - config - name application/x-www-form-urlencoded: schema: type: object - properties: *ref_26 + properties: *ref_27 parameters: - in: path name: namespaceID description: Namespace ID required: true schema: *ref_2 - '/namespace/{namespaceID}/chart/{chartID}': + '/compose/namespace/{namespaceID}/chart/{chartID}': get: tags: - Charts @@ -1445,7 +1498,7 @@ paths: application/json: schema: type: object - properties: &ref_27 + properties: &ref_28 config: type: string format: json @@ -1456,6 +1509,9 @@ paths: handle: type: string description: Chart handle + labels: + type: string + description: Labels updatedAt: type: string format: date-time @@ -1466,7 +1522,7 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_27 + properties: *ref_28 delete: tags: - Charts @@ -1485,7 +1541,7 @@ paths: description: Chart ID required: true schema: *ref_2 - /notification/email: + /compose/notification/email: post: tags: - Notifications @@ -1498,7 +1554,7 @@ paths: application/json: schema: type: object - properties: &ref_28 + properties: &ref_29 to: type: array items: *ref_0 @@ -1527,8 +1583,8 @@ paths: application/x-www-form-urlencoded: schema: type: object - properties: *ref_28 - '/namespace/{namespaceID}/attachment/{kind}/': + properties: *ref_29 + '/compose/namespace/{namespaceID}/attachment/{kind}/': get: tags: - Attachments @@ -1573,20 +1629,10 @@ paths: required: false schema: *ref_5 - in: query - name: offset - description: Offset + name: pageCursor + description: Page cursor required: false - schema: *ref_5 - - in: query - name: page - description: Page number (1-based) - required: false - schema: *ref_5 - - in: query - name: perPage - description: Returned items per page (default 50) - required: false - schema: *ref_5 + schema: *ref_0 - in: path name: kind description: Attachment kind @@ -1597,7 +1643,7 @@ paths: description: Namespace ID required: true schema: *ref_2 - '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}': + '/compose/namespace/{namespaceID}/attachment/{kind}/{attachmentID}': get: tags: - Attachments @@ -1664,7 +1710,7 @@ paths: description: User ID required: false schema: *ref_2 - '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}': + '/compose/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}': get: tags: - Attachments @@ -1707,9 +1753,8 @@ paths: name: download description: Force file download required: false - schema: &ref_30 - type: boolean - '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}': + schema: *ref_15 + '/compose/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}': get: tags: - Attachments @@ -1748,7 +1793,7 @@ paths: description: User ID required: false schema: *ref_2 - /permissions/: + /compose/permissions/: get: tags: - Permissions @@ -1756,7 +1801,7 @@ paths: responses: '200': description: OK - /permissions/effective: + /compose/permissions/effective: get: tags: - Permissions @@ -1770,7 +1815,7 @@ paths: description: Show only rules for a specific resource required: false schema: *ref_0 - '/permissions/{roleID}/rules': + '/compose/permissions/{roleID}/rules': get: tags: - Permissions @@ -1815,29 +1860,17 @@ paths: application/json: schema: type: object - properties: &ref_29 + properties: &ref_30 rules: - type: array - items: - type: object - properties: - roleID: - type: string - format: uuid - resource: - type: string - operation: - type: string - access: - type: string + type: string description: List of permission rules to set required: - rules application/x-www-form-urlencoded: schema: type: object - properties: *ref_29 - /automation/: + properties: *ref_30 + /compose/automation/: get: tags: - Compose automation scripts @@ -1871,18 +1904,18 @@ paths: name: excludeInvalid description: Exclude scripts that can not be used (errors) required: false - schema: *ref_30 + schema: *ref_15 - in: query name: excludeClientScripts description: Do not include client scripts required: false - schema: *ref_30 + schema: *ref_15 - in: query name: excludeServerScripts description: Do not include server scripts required: false - schema: *ref_30 - '/automation/{bundle}-{type}.{ext}': + schema: *ref_15 + '/compose/automation/{bundle}-{type}.{ext}': get: tags: - Compose automation scripts @@ -1906,7 +1939,7 @@ paths: description: Bundle extension required: true schema: *ref_0 - /automation/trigger: + /compose/automation/trigger: post: tags: - Compose automation scripts diff --git a/docs/federation.yaml b/docs/federation.yaml new file mode 100644 index 000000000..0c749e2a6 --- /dev/null +++ b/docs/federation.yaml @@ -0,0 +1,704 @@ +openapi: 3.0.0 +info: + title: Corteza federation API + description: Corteza federation REST API definition + version: 1.0.0 + contact: + email: contact@mail.com + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + '/federation/nodes/{nodeID}/handshake': + post: + tags: + - Federation node handshake + summary: Initialize the handshake step with node B + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_0 + pairToken: + type: string + description: >- + Pairing token to authenticate handshake initialization + request + sharedNodeID: + type: string + description: Remote (invoker's) node ID + authToken: + type: string + description: Authentication token so that remote + required: + - pairToken + - sharedNodeID + - authToken + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_0 + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: &ref_3 + type: string + /federation/nodes/: + get: + tags: + - Federation nodes + summary: Search federated nodes + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Filter nodes by name and host + required: false + schema: &ref_1 + type: string + - in: query + name: status + description: Filter by status + required: false + schema: *ref_1 + post: + tags: + - Federation nodes + summary: Create a new federation node + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_2 + baseURL: + type: string + description: Federation API base URL + name: + type: string + description: Name for this node + contact: + type: string + description: Contact email + pairingURI: + type: string + description: Pairing URI + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_2 + '/federation/nodes/{nodeID}': + get: + tags: + - Federation nodes + summary: Read a federation node + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + post: + tags: + - Federation nodes + summary: Updates existing node + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_4 + name: + type: string + description: Name for this node + contact: + type: string + description: Contact email + baseURL: + type: string + description: Federation API base URL + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_4 + delete: + tags: + - Federation nodes + summary: Deletes node + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/uri': + post: + tags: + - Federation nodes + summary: Creates new sharable federation URI + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/undelete': + post: + tags: + - Federation nodes + summary: Undeletes a node + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/pair': + post: + tags: + - Federation nodes + summary: Initialize the pairing process between the two nodes + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/handshake-confirm': + post: + tags: + - Federation nodes + summary: Confirm the requested handshake + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/handshake-complete': + post: + tags: + - Federation nodes + summary: Complete the handshake + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: NodeID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_5 + authToken: + type: string + description: Node A token + required: + - authToken + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_5 + '/federation/nodes/{nodeID}/modules/{moduleID}/exposed': + get: + tags: + - Manage structure + summary: Exposed settings for module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + post: + tags: + - Manage structure + summary: Update already exposed module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_6 + composeModuleID: + type: string + description: Compose module id + composeNamespaceID: + type: string + description: Compose namespace id + name: + type: string + description: Module name + handle: + type: string + description: Module handle + fields: + type: array + items: &ref_7 + type: object + properties: + fieldID: + type: string + format: uuid + name: + type: string + kind: + type: string + label: + type: string + defaultValue: + type: array + items: + type: string + maxLength: + type: integer + isRequired: + type: boolean + isPrivate: + type: boolean + isMulti: + type: boolean + isSystem: + type: boolean + options: + type: object + description: Exposed module fields + required: + - composeModuleID + - composeNamespaceID + - name + - handle + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_6 + delete: + tags: + - Manage structure + summary: Remove from federation + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/modules/': + put: + tags: + - Manage structure + summary: Add module to federation + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_8 + composeModuleID: + type: string + description: Compose module id + composeNamespaceID: + type: string + description: Compose namespace id + name: + type: string + description: Module name + handle: + type: string + description: Module handle + fields: + type: array + items: *ref_7 + description: Exposed module fields + required: + - composeModuleID + - composeNamespaceID + - name + - handle + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_8 + get: + tags: + - Manage structure + summary: List of shared/exposed modules + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: query + name: shared + description: List shared modules + required: false + schema: &ref_9 + type: boolean + - in: query + name: exposed + description: List exposed modules + required: false + schema: *ref_9 + '/federation/nodes/{nodeID}/modules/{moduleID}/shared': + get: + tags: + - Manage structure + summary: Shared settings for module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/modules/{moduleID}/mapped': + put: + tags: + - Manage structure + summary: Add fields mappings to federated module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_10 + composeModuleID: + type: string + description: Compose module id + composeNamespaceID: + type: string + description: Compose namespace id + fields: + type: string + description: Exposed module fields + required: + - composeModuleID + - composeNamespaceID + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_10 + get: + tags: + - Manage structure + summary: Fields mappings for module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + '/federation/nodes/{nodeID}/modules/exposed/': + get: + tags: + - Sync structure + summary: List all exposed modules changes + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: query + name: lastSync + description: Last sync timestamp + required: false + schema: *ref_3 + - in: query + name: query + description: Search query + required: false + schema: *ref_1 + - in: query + name: limit + description: Limit + required: false + schema: &ref_11 + type: string + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_1 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_1 + '/federation/nodes/{nodeID}/modules/exposed/records/': + get: + tags: + - Sync data + summary: List all record changes + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: query + name: lastSync + description: Last sync timestamp + required: false + schema: *ref_3 + - in: query + name: query + description: Search query + required: false + schema: *ref_1 + - in: query + name: limit + description: Limit + required: false + schema: *ref_11 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_1 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_1 + '/federation/nodes/{nodeID}/modules/{moduleID}/records/': + get: + tags: + - Sync data + summary: List all records per module + responses: + '200': + description: OK + parameters: + - in: path + name: nodeID + description: Node ID + required: true + schema: *ref_3 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_3 + - in: query + name: lastSync + description: Last sync timestamp + required: false + schema: *ref_3 + - in: query + name: query + description: Search query + required: false + schema: *ref_1 + - in: query + name: limit + description: Limit + required: false + schema: *ref_11 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_1 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_1 + /federation/permissions/: + get: + tags: + - Permissions + summary: Retrieve defined permissions + responses: + '200': + description: OK + /federation/permissions/effective: + get: + tags: + - Permissions + summary: Effective rules for current user + responses: + '200': + description: OK + parameters: + - in: query + name: resource + description: Show only rules for a specific resource + required: false + schema: *ref_1 + '/federation/permissions/{roleID}/rules': + get: + tags: + - Permissions + summary: Retrieve role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_3 + delete: + tags: + - Permissions + summary: Remove all defined role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_3 + patch: + tags: + - Permissions + summary: Update permission settings + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_3 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_12 + rules: + type: string + description: List of permission rules to set + required: + - rules + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_12 diff --git a/docs/index.html b/docs/index.html index c9a03941f..6bf5761ab 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,6 +43,7 @@ { url: "system.yaml", name: 'System' }, { url: "compose.yaml", name: 'Compose' }, { url: "messaging.yaml", name: 'Messaging' }, + { url: "federation.yaml", name: 'Federation' }, ], dom_id: '#swagger-ui', deepLinking: true, diff --git a/docs/messaging.yaml b/docs/messaging.yaml index f074a1e35..88d58a856 100644 --- a/docs/messaging.yaml +++ b/docs/messaging.yaml @@ -2,14 +2,14 @@ openapi: 3.0.0 info: title: Corteza messaging API description: Corteza messaging REST API definition - version: 2020.12 + version: 1.0.0 contact: - email: info@cortezaproject.org + email: contact@mail.com license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' paths: - /commands/: + /messaging/commands/: get: tags: - Commands @@ -17,7 +17,7 @@ paths: responses: '200': description: OK - /status/: + /messaging/status/: get: tags: - Status @@ -60,7 +60,7 @@ paths: responses: '200': description: OK - /activity/: + /messaging/activity/: post: tags: - User activity @@ -93,7 +93,7 @@ paths: schema: type: object properties: *ref_1 - /channels/: + /messaging/channels/: get: tags: - Channels @@ -141,7 +141,7 @@ paths: schema: type: object properties: *ref_3 - '/channels/{channelID}': + '/messaging/channels/{channelID}': put: tags: - Channels @@ -194,7 +194,7 @@ paths: description: Channel ID required: true schema: *ref_5 - '/channels/{channelID}/state': + '/messaging/channels/{channelID}/state': put: tags: - Channels @@ -223,7 +223,7 @@ paths: schema: type: object properties: *ref_6 - '/channels/{channelID}/flag': + '/messaging/channels/{channelID}/flag': put: tags: - Channels @@ -265,7 +265,7 @@ paths: description: Channel ID required: true schema: *ref_5 - '/channels/{channelID}/members': + '/messaging/channels/{channelID}/members': get: tags: - Channels @@ -279,7 +279,7 @@ paths: description: Channel ID required: true schema: *ref_5 - '/channels/{channelID}/members/{userID}': + '/messaging/channels/{channelID}/members/{userID}': put: tags: - Channels @@ -316,7 +316,7 @@ paths: description: Member ID required: true schema: *ref_5 - '/channels/{channelID}/invite': + '/messaging/channels/{channelID}/invite': post: tags: - Channels @@ -344,7 +344,7 @@ paths: schema: type: object properties: *ref_8 - '/channels/{channelID}/attach': + '/messaging/channels/{channelID}/attach': post: tags: - Channels @@ -377,7 +377,7 @@ paths: schema: type: object properties: *ref_9 - '/channels/{channelID}/messages/': + '/messaging/channels/{channelID}/messages/': post: tags: - Messages @@ -406,7 +406,7 @@ paths: description: Channel ID required: true schema: *ref_5 - '/channels/{channelID}/messages/command/{command}/exec': + '/messaging/channels/{channelID}/messages/command/{command}/exec': post: tags: - Messages @@ -442,7 +442,7 @@ paths: schema: type: object properties: *ref_11 - '/channels/{channelID}/messages/mark-as-read': + '/messaging/channels/{channelID}/messages/mark-as-read': get: tags: - Messages @@ -466,7 +466,7 @@ paths: description: ID of the last read message required: false schema: *ref_5 - '/channels/{channelID}/messages/{messageID}': + '/messaging/channels/{channelID}/messages/{messageID}': put: tags: - Messages @@ -518,7 +518,7 @@ paths: description: Message ID required: true schema: *ref_5 - '/channels/{channelID}/messages/{messageID}/replies': + '/messaging/channels/{channelID}/messages/{messageID}/replies': post: tags: - Messages @@ -552,7 +552,7 @@ paths: schema: type: object properties: *ref_13 - '/channels/{channelID}/messages/{messageID}/pin': + '/messaging/channels/{channelID}/messages/{messageID}/pin': post: tags: - Messages @@ -589,7 +589,7 @@ paths: description: Message ID required: true schema: *ref_5 - '/channels/{channelID}/messages/{messageID}/bookmark': + '/messaging/channels/{channelID}/messages/{messageID}/bookmark': post: tags: - Messages @@ -626,7 +626,7 @@ paths: description: Message ID required: true schema: *ref_5 - '/channels/{channelID}/messages/{messageID}/reaction/{reaction}': + '/messaging/channels/{channelID}/messages/{messageID}/reaction/{reaction}': post: tags: - Messages @@ -673,7 +673,7 @@ paths: description: Reaction required: true schema: *ref_2 - '/attachment/{attachmentID}/original/{name}': + '/messaging/attachment/{attachmentID}/original/{name}': get: tags: - Attachments @@ -708,7 +708,7 @@ paths: required: false schema: &ref_14 type: boolean - '/attachment/{attachmentID}/preview.{ext}': + '/messaging/attachment/{attachmentID}/preview.{ext}': get: tags: - Attachments @@ -737,7 +737,7 @@ paths: description: User ID required: true schema: *ref_5 - /search/messages: + /messaging/search/messages: get: tags: - Search entry point @@ -815,7 +815,7 @@ paths: required: false schema: &ref_15 type: string - /search/threads: + /messaging/search/threads: get: tags: - Search entry point @@ -841,7 +841,7 @@ paths: description: Max number of messages required: false schema: *ref_15 - /permissions/: + /messaging/permissions/: get: tags: - Permissions @@ -849,7 +849,7 @@ paths: responses: '200': description: OK - /permissions/effective: + /messaging/permissions/effective: get: tags: - Permissions @@ -863,7 +863,7 @@ paths: description: Show only rules for a specific resource required: false schema: *ref_2 - '/permissions/{roleID}/rules': + '/messaging/permissions/{roleID}/rules': get: tags: - Permissions @@ -910,19 +910,7 @@ paths: type: object properties: &ref_16 rules: - type: array - items: - type: object - properties: - roleID: - type: string - format: uuid - resource: - type: string - operation: - type: string - access: - type: string + type: string description: List of permission rules to set required: - rules diff --git a/docs/system.yaml b/docs/system.yaml index b7c6dafdf..4728fc7f6 100644 --- a/docs/system.yaml +++ b/docs/system.yaml @@ -1,15 +1,15 @@ openapi: 3.0.0 info: - title: Corteza System API - description: Corteza System REST API definition - version: 2020.12 + title: Corteza system API + description: Corteza system REST API definition + version: 1.0.0 contact: - email: info@cortezaproject.org + email: contact@mail.com license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' paths: - /auth/: + /system/auth/: get: tags: - Authentication @@ -17,7 +17,7 @@ paths: responses: '200': description: OK - /auth/check: + /system/auth/check: get: tags: - Authentication @@ -25,7 +25,7 @@ paths: responses: '200': description: OK - /auth/impersonate: + /system/auth/impersonate: post: tags: - Authentication @@ -48,7 +48,7 @@ paths: schema: type: object properties: *ref_0 - /auth/exchange: + /system/auth/exchange: post: tags: - Authentication @@ -71,7 +71,7 @@ paths: schema: type: object properties: *ref_1 - /auth/logout: + /system/auth/logout: get: tags: - Authentication @@ -79,7 +79,7 @@ paths: responses: '200': description: OK - /auth/internal/login: + /system/auth/internal/login: post: tags: - Internal authentication @@ -107,7 +107,7 @@ paths: schema: type: object properties: *ref_2 - /auth/internal/signup: + /system/auth/internal/signup: post: tags: - Internal authentication @@ -144,7 +144,7 @@ paths: schema: type: object properties: *ref_3 - /auth/internal/request-password-reset: + /system/auth/internal/request-password-reset: post: tags: - Internal authentication @@ -167,7 +167,7 @@ paths: schema: type: object properties: *ref_4 - /auth/internal/exchange-password-reset-token: + /system/auth/internal/exchange-password-reset-token: post: tags: - Internal authentication @@ -190,7 +190,7 @@ paths: schema: type: object properties: *ref_5 - /auth/internal/reset-password: + /system/auth/internal/reset-password: post: tags: - Internal authentication @@ -218,7 +218,7 @@ paths: schema: type: object properties: *ref_6 - /auth/internal/confirm-email: + /system/auth/internal/confirm-email: post: tags: - Internal authentication @@ -241,7 +241,7 @@ paths: schema: type: object properties: *ref_7 - /auth/internal/change-password: + /system/auth/internal/change-password: post: tags: - Internal authentication @@ -268,7 +268,7 @@ paths: schema: type: object properties: *ref_8 - /settings/: + /system/settings/: get: tags: - Settings @@ -314,7 +314,7 @@ paths: schema: type: object properties: *ref_9 - '/settings/{key}': + '/system/settings/{key}': get: tags: - Settings @@ -364,7 +364,7 @@ paths: schema: type: object properties: *ref_11 - /settings/current: + /system/settings/current: get: tags: - Settings @@ -372,7 +372,7 @@ paths: responses: '200': description: OK - /subscription/: + /system/subscription/: get: tags: - Subscription @@ -380,7 +380,7 @@ paths: responses: '200': description: OK - /roles/: + /system/roles/: get: tags: - Roles @@ -405,6 +405,11 @@ paths: description: 'Exclude (0, default), include (1) or return only (2) achived roles' required: false schema: *ref_12 + - in: query + name: labels + description: Labels + required: false + schema: *ref_10 - in: query name: limit description: Limit @@ -443,6 +448,9 @@ paths: type: array items: *ref_10 description: Role member IDs + labels: + type: string + description: Labels required: - name - handle @@ -450,7 +458,7 @@ paths: schema: type: object properties: *ref_13 - '/roles/{roleID}': + '/system/roles/{roleID}': put: tags: - Roles @@ -480,6 +488,9 @@ paths: type: array items: *ref_10 description: Role member IDs + labels: + type: string + description: Labels application/x-www-form-urlencoded: schema: type: object @@ -510,7 +521,7 @@ paths: description: Role ID required: true schema: *ref_14 - '/roles/{roleID}/archive': + '/system/roles/{roleID}/archive': post: tags: - Roles @@ -524,7 +535,7 @@ paths: description: Role ID required: true schema: *ref_14 - '/roles/{roleID}/unarchive': + '/system/roles/{roleID}/unarchive': post: tags: - Roles @@ -538,7 +549,7 @@ paths: description: Role ID required: true schema: *ref_14 - '/roles/{roleID}/undelete': + '/system/roles/{roleID}/undelete': post: tags: - Roles @@ -552,7 +563,7 @@ paths: description: Role ID required: true schema: *ref_14 - '/roles/{roleID}/move': + '/system/roles/{roleID}/move': post: tags: - Roles @@ -581,7 +592,7 @@ paths: schema: type: object properties: *ref_16 - '/roles/{roleID}/merge': + '/system/roles/{roleID}/merge': post: tags: - Roles @@ -610,7 +621,7 @@ paths: schema: type: object properties: *ref_17 - '/roles/{roleID}/members': + '/system/roles/{roleID}/members': get: tags: - Roles @@ -624,7 +635,7 @@ paths: description: Source Role ID required: true schema: *ref_14 - '/roles/{roleID}/member/{userID}': + '/system/roles/{roleID}/member/{userID}': post: tags: - Roles @@ -661,7 +672,7 @@ paths: description: User ID required: true schema: *ref_14 - '/roles/{roleID}/trigger': + '/system/roles/{roleID}/trigger': post: tags: - Roles @@ -690,7 +701,7 @@ paths: schema: type: object properties: *ref_18 - /users/: + /system/users/: get: tags: - Users @@ -760,6 +771,11 @@ paths: description: 'Exclude (0, default), include (1) or return only (2) suspended users' required: false schema: *ref_12 + - in: query + name: labels + description: Labels + required: false + schema: *ref_10 - in: query name: limit description: Limit @@ -800,13 +816,16 @@ paths: kind: type: string description: 'Kind (normal, bot)' + labels: + type: string + description: Labels required: - email application/x-www-form-urlencoded: schema: type: object properties: *ref_20 - '/users/{userID}': + '/system/users/{userID}': put: tags: - Users @@ -838,6 +857,9 @@ paths: kind: type: string description: 'Kind (normal, bot)' + labels: + type: string + description: Labels required: - email - name @@ -871,7 +893,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/suspend': + '/system/users/{userID}/suspend': post: tags: - Users @@ -885,7 +907,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/unsuspend': + '/system/users/{userID}/unsuspend': post: tags: - Users @@ -899,7 +921,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/undelete': + '/system/users/{userID}/undelete': post: tags: - Users @@ -913,7 +935,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/password': + '/system/users/{userID}/password': post: tags: - Users @@ -943,7 +965,7 @@ paths: schema: type: object properties: *ref_22 - '/users/{userID}/membership': + '/system/users/{userID}/membership': get: tags: - Users @@ -957,7 +979,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/membership/{roleID}': + '/system/users/{userID}/membership/{roleID}': post: tags: - Users @@ -994,7 +1016,7 @@ paths: description: User ID required: true schema: *ref_14 - '/users/{userID}/trigger': + '/system/users/{userID}/trigger': post: tags: - Users @@ -1023,7 +1045,7 @@ paths: schema: type: object properties: *ref_23 - /application/: + /system/application/: get: tags: - Applications @@ -1047,6 +1069,11 @@ paths: description: 'Exclude (0, default), include (1) or return only (2) deleted roles' required: false schema: *ref_12 + - in: query + name: labels + description: Labels + required: false + schema: *ref_10 - in: query name: limit description: Limit @@ -1089,13 +1116,16 @@ paths: type: string format: json description: Arbitrary JSON holding application configuration + labels: + type: string + description: Labels required: - name application/x-www-form-urlencoded: schema: type: object properties: *ref_24 - '/application/{applicationID}': + '/system/application/{applicationID}': put: tags: - Applications @@ -1129,6 +1159,9 @@ paths: type: string format: json description: Arbitrary JSON holding application configuration + labels: + type: string + description: Labels required: - name application/x-www-form-urlencoded: @@ -1161,7 +1194,7 @@ paths: description: Application ID required: true schema: *ref_14 - '/application/{applicationID}/undelete': + '/system/application/{applicationID}/undelete': post: tags: - Applications @@ -1175,7 +1208,7 @@ paths: description: Application ID required: true schema: *ref_14 - '/application/{applicationID}/trigger': + '/system/application/{applicationID}/trigger': post: tags: - Applications @@ -1204,7 +1237,7 @@ paths: schema: type: object properties: *ref_26 - /permissions/: + /system/permissions/: get: tags: - Permissions @@ -1212,7 +1245,7 @@ paths: responses: '200': description: OK - /permissions/effective: + /system/permissions/effective: get: tags: - Permissions @@ -1226,7 +1259,7 @@ paths: description: Show only rules for a specific resource required: false schema: *ref_10 - '/permissions/{roleID}/rules': + '/system/permissions/{roleID}/rules': get: tags: - Permissions @@ -1273,19 +1306,7 @@ paths: type: object properties: &ref_27 rules: - type: array - items: - type: object - properties: - roleID: - type: string - format: uuid - resource: - type: string - operation: - type: string - access: - type: string + type: string description: List of permission rules to set required: - rules @@ -1293,7 +1314,7 @@ paths: schema: type: object properties: *ref_27 - /reminder/: + /system/reminder/: get: tags: - Reminders @@ -1391,7 +1412,7 @@ paths: schema: type: object properties: *ref_29 - '/reminder/{reminderID}': + '/system/reminder/{reminderID}': put: tags: - Reminders @@ -1459,7 +1480,7 @@ paths: description: Reminder ID required: true schema: *ref_14 - '/reminder/{reminderID}/dismiss': + '/system/reminder/{reminderID}/dismiss': patch: tags: - Reminders @@ -1473,7 +1494,7 @@ paths: description: reminder ID required: true schema: *ref_14 - '/reminder/{reminderID}/snooze': + '/system/reminder/{reminderID}/snooze': patch: tags: - Reminders @@ -1503,7 +1524,7 @@ paths: schema: type: object properties: *ref_31 - '/attachment/{kind}/{attachmentID}': + '/system/attachment/{kind}/{attachmentID}': get: tags: - Attachments @@ -1560,7 +1581,7 @@ paths: description: User ID required: false schema: *ref_14 - '/attachment/{kind}/{attachmentID}/original/{name}': + '/system/attachment/{kind}/{attachmentID}/original/{name}': get: tags: - Attachments @@ -1599,7 +1620,7 @@ paths: description: Force file download required: false schema: *ref_19 - '/attachment/{kind}/{attachmentID}/preview.{ext}': + '/system/attachment/{kind}/{attachmentID}/preview.{ext}': get: tags: - Attachments @@ -1633,7 +1654,7 @@ paths: description: User ID required: false schema: *ref_14 - /stats/: + /system/stats/: get: tags: - Statistics @@ -1641,7 +1662,7 @@ paths: responses: '200': description: OK - /automation/: + /system/automation/: get: tags: - System automation scripts @@ -1686,7 +1707,7 @@ paths: description: Do not include server scripts required: false schema: *ref_19 - '/automation/{bundle}-{type}.{ext}': + '/system/automation/{bundle}-{type}.{ext}': get: tags: - System automation scripts @@ -1710,7 +1731,7 @@ paths: description: Bundle extension required: true schema: *ref_10 - /automation/trigger: + /system/automation/trigger: post: tags: - System automation scripts @@ -1733,7 +1754,7 @@ paths: schema: type: object properties: *ref_32 - /actionlog/: + /system/actionlog/: get: tags: - Action log @@ -1752,6 +1773,11 @@ paths: description: To required: false schema: *ref_28 + - in: query + name: beforeActionID + description: Entries before specified action ID + required: false + schema: *ref_14 - in: query name: resource description: Resource @@ -1774,8 +1800,3 @@ paths: description: Limit required: false schema: *ref_12 - - in: query - name: pageCursor - description: Page cursor - required: false - schema: *ref_10