3
0
corteza/api/system/spec.json
2018-12-04 15:26:51 +01:00

625 lines
14 KiB
JSON

[
{
"title": "Authentication",
"package": "auth",
"path": "/auth",
"entrypoint": "auth",
"authentication": [],
"apis": [
{
"name": "check",
"method": "GET",
"title": "Check JWT token",
"path": "/check",
"parameters": {}
},
{
"name": "login",
"method": "POST",
"title": "Login user",
"path": "/login",
"parameters": {
"post": [
{
"name": "username",
"type": "string",
"required": true,
"title": "Username"
},
{
"name": "password",
"type": "string",
"required": true,
"title": "Password"
}
]
}
},
{
"name": "logout",
"method": "GET",
"title": "Delete JWT token (Sign Out)",
"path": "/logout",
"parameters": {}
}
]
},
{
"title": "Organisations",
"description": "Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.",
"package": "sam",
"path": "/organisations",
"entrypoint": "organisation",
"authentication": [
"Client ID",
"Session ID"
],
"apis": [
{
"name": "list",
"method": "GET",
"title": "List organisations",
"path": "/",
"parameters": {
"get": [
{
"type": "string",
"name": "query",
"required": false,
"title": "Search query"
}
]
}
},
{
"name": "create",
"method": "POST",
"title": "Create organisation",
"path": "/",
"parameters": {
"post": [
{
"type": "string",
"name": "name",
"required": true,
"title": "Organisation Name"
}
]
}
},
{
"name": "edit",
"method": "PUT",
"title": "Update organisation details",
"path": "/{id}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "id",
"required": false,
"title": "Organisation ID"
}
],
"post": [
{
"type": "string",
"name": "name",
"required": true,
"title": "Organisation Name"
}
]
}
},
{
"name": "remove",
"method": "DELETE",
"title": "Remove organisation",
"path": "/{id}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "id",
"required": true,
"title": "Organisation ID"
}
]
}
},
{
"name": "read",
"method": "GET",
"title": "Read organisation details",
"path": "/{id}",
"parameters": {
"get": [
{
"type": "uint64",
"name": "id",
"required": true,
"title": "Organisation ID"
}
]
}
},
{
"name": "archive",
"method": "POST",
"title": "Archive organisation",
"path": "/{id}/archive",
"parameters": {
"path": [
{
"type": "uint64",
"name": "id",
"required": true,
"title": "Organisation ID"
}
]
}
}
]
},
{
"title": "Teams",
"description": "An organisation may have many teams. Teams may have many channels available. Access to channels may be shared between teams.",
"package": "sam",
"path": "/teams",
"entrypoint": "team",
"authentication": [
"Client ID",
"Session ID"
],
"apis": [
{
"name": "list",
"method": "GET",
"title": "List teams",
"path": "/",
"parameters": {
"get": [
{
"type": "string",
"name": "query",
"required": false,
"title": "Search query"
}
]
}
},
{
"name": "create",
"method": "POST",
"title": "Update team details",
"path": "/",
"parameters": {
"post": [
{
"type": "string",
"name": "name",
"required": true,
"title": "Name of Team"
},
{
"type": "[]uint64",
"name": "members",
"required": false,
"title": "Team member IDs"
}
]
}
},
{
"name": "edit",
"method": "PUT",
"title": "Update team details",
"path": "/{teamID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Team ID"
}
],
"post": [
{
"type": "string",
"name": "name",
"required": false,
"title": "Name of Team"
},
{
"type": "[]uint64",
"name": "members",
"required": false,
"title": "Team member IDs"
}
]
}
},
{
"name": "read",
"method": "GET",
"title": "Read team details and memberships",
"path": "/{teamID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Team ID"
}
]
}
},
{
"name": "remove",
"method": "DELETE",
"title": "Remove team",
"path": "/{teamID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Team ID"
}
]
}
},
{
"name": "archive",
"method": "POST",
"title": "Archive team",
"path": "/{teamID}/archive",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Team ID"
}
]
}
},
{
"name": "move",
"method": "POST",
"title": "Move team to different organisation",
"path": "/{teamID}/move",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Team ID"
}
],
"post": [
{
"type": "uint64",
"name": "organisationID",
"required": true,
"title": "Team ID"
}
]
}
},
{
"name": "merge",
"method": "POST",
"title": "Merge one team into another",
"path": "/{teamID}/merge",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Source Team ID"
}
],
"post": [
{
"type": "uint64",
"name": "destination",
"required": true,
"title": "Destination Team ID"
}
]
}
},
{
"name": "memberAdd",
"method": "POST",
"title": "Add member to a team",
"path": "/{teamID}/memberAdd",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Source Team ID"
}
],
"post": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
},
{
"name": "memberRemove",
"method": "POST",
"title": "Remove member from a team",
"path": "/{teamID}/memberRemove",
"parameters": {
"path": [
{
"type": "uint64",
"name": "teamID",
"required": true,
"title": "Source Team ID"
}
],
"post": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
}
]
},
{
"title": "Users",
"package": "sam",
"path": "/users",
"entrypoint": "user",
"authentication": [
"Client ID",
"Session ID"
],
"struct": [
{
"imports": [
"sqlxTypes github.com/jmoiron/sqlx/types"
]
}
],
"apis": [
{
"name": "list",
"method": "GET",
"title": "Search users (Directory)",
"path": "/",
"parameters": {
"get": [
{
"type": "string",
"name": "query",
"required": false,
"title": "Search query to match against users"
}
]
}
},
{
"name": "create",
"method": "POST",
"title": "Create user",
"path": "/",
"parameters": {
"post": [
{
"name": "email",
"type": "string",
"required": true,
"title": "Email"
},
{
"name": "username",
"type": "string",
"required": true,
"title": "Username"
},
{
"name": "password",
"type": "string",
"required": true,
"title": "Password"
},
{
"name": "name",
"type": "string",
"required": true,
"title": "Name"
},
{
"name": "handle",
"type": "string",
"required": true,
"title": "Handle"
},
{
"name": "kind",
"type": "string",
"required": false,
"title": "Kind (normal, bot)"
},
{
"name": "meta",
"type": "sqlxTypes.JSONText",
"required": false,
"title": "Meta data"
},
{
"name": "satosaID",
"type": "string",
"required": false,
"title": "Satosa ID"
},
{
"name": "organisationID",
"type": "uint64",
"required": false,
"title": "Organisation ID"
}
]
}
},
{
"name": "edit",
"method": "PUT",
"title": "Update user details",
"path": "/{userID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
],
"post": [
{
"name": "email",
"type": "string",
"required": true,
"title": "Email"
},
{
"name": "username",
"type": "string",
"required": true,
"title": "Username"
},
{
"name": "password",
"type": "string",
"required": true,
"title": "Password"
},
{
"name": "name",
"type": "string",
"required": true,
"title": "Name"
},
{
"name": "handle",
"type": "string",
"required": true,
"title": "Handle"
},
{
"name": "kind",
"type": "string",
"required": false,
"title": "Kind (normal, bot)"
},
{
"name": "meta",
"type": "sqlxTypes.JSONText",
"required": false,
"title": "Meta data"
},
{
"name": "satosaID",
"type": "string",
"required": false,
"title": "Satosa ID"
},
{
"name": "organisationID",
"type": "uint64",
"required": false,
"title": "Organisation ID"
}
]
}
},
{
"name": "read",
"method": "GET",
"title": "Read user details and memberships",
"path": "/{userID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
},
{
"name": "remove",
"method": "DELETE",
"title": "Remove user",
"path": "/{userID}",
"parameters": {
"path": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
},
{
"name": "suspend",
"method": "POST",
"title": "Suspend user",
"path": "/{userID}/suspend",
"parameters": {
"path": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
},
{
"name": "unsuspend",
"method": "POST",
"title": "Unsuspend user",
"path": "/{userID}/unsuspend",
"parameters": {
"path": [
{
"type": "uint64",
"name": "userID",
"required": true,
"title": "User ID"
}
]
}
}
]
}
]