From 3d4d1775e9336a6f1840eaafd3b378bd89b878e8 Mon Sep 17 00:00:00 2001 From: Tit Petric Date: Sun, 3 Jun 2018 18:21:43 +0200 Subject: [PATCH] update specs with structs info --- docs/README.md | 18 ++++----- docs/README.php | 1 + docs/src/spec.json | 67 ++++++++++++++++++++++++++++----- docs/src/spec/channel.json | 2 +- docs/src/spec/member.json | 2 +- docs/src/spec/message.json | 2 +- docs/src/spec/organisation.json | 2 +- docs/src/spec/team.json | 2 +- docs/src/spec/websocket.json | 2 +- 9 files changed, 73 insertions(+), 25 deletions(-) diff --git a/docs/README.md b/docs/README.md index d812ff736..5f86a5abe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -762,15 +762,15 @@ The following event types may be sent with a message event: -# Members +# Users -## Member login +## User login #### Method | URI | Protocol | Method | Authentication | | --- | -------- | ------ | -------------- | -| `/member/login` | HTTP/S | POST | Client ID, Session ID | +| `/users/login` | HTTP/S | POST | Client ID, Session ID | #### Request parameters @@ -779,13 +779,13 @@ The following event types may be sent with a message event: | username | string | POST | Username or email | N/A | YES | | password | string | POST | Password for user | N/A | YES | -## Search members (Directory) +## Search users (Directory) #### Method | URI | Protocol | Method | Authentication | | --- | -------- | ------ | -------------- | -| `/member/search` | HTTP/S | GET | Client ID, Session ID | +| `/users/search` | HTTP/S | GET | Client ID, Session ID | #### Request parameters @@ -793,13 +793,13 @@ The following event types may be sent with a message event: | --------- | ---- | ------ | ----------- | ------- | --------- | | query | string | GET | Search query to match against users | N/A | NO | -## Member login +## User login #### Method | URI | Protocol | Method | Authentication | | --- | -------- | ------ | -------------- | -| `/member/login` | HTTP/S | POST | Client ID, Session ID | +| `/users/login` | HTTP/S | POST | Client ID, Session ID | #### Request parameters @@ -808,13 +808,13 @@ The following event types may be sent with a message event: | username | string | POST | Username or email | N/A | YES | | password | string | POST | Password for user | N/A | YES | -## Search members (Directory) +## Search users (Directory) #### Method | URI | Protocol | Method | Authentication | | --- | -------- | ------ | -------------- | -| `/member/search` | HTTP/S | GET | Client ID, Session ID | +| `/users/search` | HTTP/S | GET | Client ID, Session ID | #### Request parameters diff --git a/docs/README.php b/docs/README.php index 50fb93dcf..317c6d938 100755 --- a/docs/README.php +++ b/docs/README.php @@ -57,6 +57,7 @@ foreach ($spec as $api) { } $tpl = new Monotek\MiniTPL\Template; +$tpl->set_compile_location("/tmp", true); $tpl->set_paths("./"); $tpl->load("README.tpl"); $tpl->assign("apis", $apis); diff --git a/docs/src/spec.json b/docs/src/spec.json index 44ef82eab..e0f280800 100644 --- a/docs/src/spec.json +++ b/docs/src/spec.json @@ -2,9 +2,15 @@ { "title": "Organisations", "description": "Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.", - "package": "crust", + "package": "sam", "entrypoint": "organisation", "authentication": ["Client ID", "Session ID"], + "structs": { + "Organisation": [ + { "name": "ID", "type": "uint64" }, + { "name": "Name", "type": "string" } + ] + }, "apis": [ { "name": "edit", @@ -62,9 +68,17 @@ { "title": "Teams", "description": "An organisation may have many teams. Teams may have many channels available. Access to channels may be shared between teams.", - "package": "crust", + "package": "sam", "entrypoint": "team", "authentication": ["Client ID", "Session ID"], + "structs": { + "Team": [ + { "type": "uint64", "name": "ID" }, + { "type": "string", "name": "Name" }, + { "type": "[]uint64", "name": "MemberIDs", "tag": "json:\"-\"" }, + { "type": "[]User", "name": "Members", "tag": "json:\",omitempty\"" } + ] + }, "apis": [ { "name": "edit", @@ -134,9 +148,16 @@ { "title": "Channels", "description": "A channel is a representation of a sequence of messages. It has meta data like channel subject. Channels may be public, private or direct (between two users).", - "package": "crust", + "package": "sam", "entrypoint": "channel", "authentication": ["Client ID", "Session ID"], + "structs": { + "Channels": [ + { "type": "uint64", "name": "ID" }, + { "type": "string", "name": "Name" }, + { "type": "string", "name": "Topic" } + ] + }, "apis": [ { "name": "edit", @@ -215,9 +236,22 @@ }, { "title": "Messages", - "package": "crust", + "package": "sam", "entrypoint": "message", "authentication": ["Client ID", "Session ID"], + "structs": { + "Message": [ + { "name": "Service", "type": "string" }, + { "name": "Channel", "type": "string" }, + { "name": "UserName", "type": "string" }, + { "name": "UserID", "type": "uint64" }, + { "name": "User", "type": "*User" }, + { "name": "UserAvatar", "type": "string" }, + { "name": "Message", "type": "string" }, + { "name": "MessageID", "type": "string" }, + { "name": "Type", "type": "MessageType" } + ] + }, "apis": [ { "name": "edit", @@ -302,15 +336,22 @@ ] }, { - "title": "Members", - "package": "crust", - "entrypoint": "member", + "title": "Users", + "package": "sam", + "entrypoint": "users", "authentication": ["Client ID", "Session ID"], + "structs": { + "User": [ + { "type": "uint64", "name": "ID" }, + { "username": "string", "name": "Username" }, + { "password": "string", "name": "Password", "tag": "json:\"-\"" } + ] + }, "apis": [ { "name": "login", "method": "POST", - "title": "Member login", + "title": "User login", "parameters": { "post": [ { "type": "string", "name": "username", "required": true, "title": "Username or email" }, @@ -321,7 +362,7 @@ { "name": "search", "method": "GET", - "title": "Search members (Directory)", + "title": "Search users (Directory)", "parameters": { "get": [ { "type": "string", "name": "query", "required": false, "title": "Search query to match against users" } @@ -332,10 +373,16 @@ }, { "title": "Websocket", - "package": "crust", + "package": "sam", "entrypoint": "websocket", "protocol": "WebSockets", "authentication": ["Client ID", "Session ID"], + "structs": { + "WebSocket": [ + { "type": "uint64", "name": "UserID" }, + { "type": "User", "name": "User" } + ] + }, "apis": [ { "name": "client", diff --git a/docs/src/spec/channel.json b/docs/src/spec/channel.json index 115c4bb28..a14ae0f91 100644 --- a/docs/src/spec/channel.json +++ b/docs/src/spec/channel.json @@ -1,7 +1,7 @@ { "Title": "Channels", "Description": "A channel is a representation of a sequence of messages. It has meta data like channel subject. Channels may be public, private or direct (between two users).", - "Package": "crust", + "Package": "sam", "Interface": "Channel", "Protocol": "", "Authentication": [ diff --git a/docs/src/spec/member.json b/docs/src/spec/member.json index c666acd92..dd0294a0e 100644 --- a/docs/src/spec/member.json +++ b/docs/src/spec/member.json @@ -1,6 +1,6 @@ { "Title": "Members", - "Package": "crust", + "Package": "sam", "Interface": "Member", "Protocol": "", "Authentication": [ diff --git a/docs/src/spec/message.json b/docs/src/spec/message.json index 12891e9e5..34f6ed10c 100644 --- a/docs/src/spec/message.json +++ b/docs/src/spec/message.json @@ -1,6 +1,6 @@ { "Title": "Messages", - "Package": "crust", + "Package": "sam", "Interface": "Message", "Protocol": "", "Authentication": [ diff --git a/docs/src/spec/organisation.json b/docs/src/spec/organisation.json index b2b7fcd34..eec2fa459 100644 --- a/docs/src/spec/organisation.json +++ b/docs/src/spec/organisation.json @@ -1,7 +1,7 @@ { "Title": "Organisations", "Description": "Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.", - "Package": "crust", + "Package": "sam", "Interface": "Organisation", "Protocol": "", "Authentication": [ diff --git a/docs/src/spec/team.json b/docs/src/spec/team.json index 435561ca0..ce68b8987 100644 --- a/docs/src/spec/team.json +++ b/docs/src/spec/team.json @@ -1,7 +1,7 @@ { "Title": "Teams", "Description": "An organisation may have many teams. Teams may have many channels available. Access to channels may be shared between teams.", - "Package": "crust", + "Package": "sam", "Interface": "Team", "Protocol": "", "Authentication": [ diff --git a/docs/src/spec/websocket.json b/docs/src/spec/websocket.json index ca2a14463..b60db36de 100644 --- a/docs/src/spec/websocket.json +++ b/docs/src/spec/websocket.json @@ -1,6 +1,6 @@ { "Title": "Websocket", - "Package": "crust", + "Package": "sam", "Interface": "Websocket", "Protocol": "WebSockets", "Authentication": [