diff --git a/docs/content/endpoints/neighbors.md b/docs/content/endpoints/neighbors.md new file mode 100644 index 0000000..7f5ea24 --- /dev/null +++ b/docs/content/endpoints/neighbors.md @@ -0,0 +1,115 @@ +--- +title: Neighbors +anchor: neighbors-ep +weight: 18 +--- + +### `GET /neighbor/list` + +* Required query string parameters + + * jwt: String + +* Returns + * neighbors: Array\ + + +Example +``` + > GET /neighbor/list?jwt=... + + < { + < "neighbors": [ + < { + < "name": "Instance Name", + < "url": "https://instance.xyz", + < "wsurl": "wss://instance.xyz", + < "description": "Interesting description", + < "tags": ["tech", "code", "docs"] + < }, + < ... + < ] + < } +``` + + +### `POST /neighbor/add` + +* Required query string parameters + + * jwt: String + +* Required HTTP Headers + * content-type: Must be of `application/json` + * content-length +* Required Body + * Neighbor structure data(json encoded) + +* Returns + * On sucess: 200 OK + +Example +``` + > POST /neighbor/add + > content-type: application/json + > content-length: ... + > { + > "name": "Instance Name", + > "url": "https://instance.xyz", + > "wsurl": "wss://instance.xyz", + > "description": "Interesting description", + > "tags": ["tech", "code", "docs"] + > } + + < 200 OK +``` + + + +### `PUT /neighbor/update` + +This route requires the full neighbor structure in the body with all the fields modified to satisfaction. +The url parameter in the query string is used to uniquely identify a listed neighbor. +_Note that the url can also be changed but the original/previous url must be used to identify +what is currently listed_. + + +* Required query string parameters + * jwt: String + * url: String := target url of the neighbor to update + +* Required headers + * content-type: application/json + * content-length + +Example +``` + > PUT /neighbor/update + > content-type: application/json + > content-length: ... + > { + > "name": "New Instance Name", + > "url": "https://new.instance.xyz", + > "wsurl": "wss://new.instance.xyz", + > "description": "New Interesting description", + > "tags": ["new", "tags", "tech", "code", "docs"] + > } + + < 200 OK +``` + +### `DELETE /neighbor/delete` + +As long as the permissions are correct this route will basically always 200. +Even if nothing is found the endpoint will still 200. + +* Required query string parameters + * jwt: String + * url: String + +Example +``` + > PUT /neighbor/update?url=https%3A%2F%2Finstance.xyz + + < 200 OK +``` diff --git a/docs/content/structures/neighbors.md b/docs/content/structures/neighbors.md new file mode 100644 index 0000000..a10ec7f --- /dev/null +++ b/docs/content/structures/neighbors.md @@ -0,0 +1,18 @@ +--- +title: Neighbors +anchor: neighbors-structure +weight: 45 +--- + +Neighbors contain the following structure + +Name | Type +:-----:|:-----: + url\* | String + wsurl | String + name | String +description | String +tags | Array\ + + +* url: is used as the primary key for identifying neighbors from one another diff --git a/roadmap.md b/roadmap.md index d21c3fd..f99ce90 100644 --- a/roadmap.md +++ b/roadmap.md @@ -37,9 +37,9 @@ I'd like to be able to support people that make good software and give them a pl -* More server meta endpoint support: Some basic server metadata is stored in environment vars but we can probably store these somewhere a bit smarter idk. +* ~~More server meta endpoint support: Some basic server metadata is stored in environment vars but we can probably store these somewhere a bit smarter idk.~~ - * This is now actively being worked with /neighbor/list and /neighbor/add now being added to the supported routes. Further testing is required, as well as relevant documentation. At least this should be done within the next few days as I find time for it among other projects. + * ~~This is now actively being worked with /neighbor/list and /neighbor/add now being added to the supported routes. Further testing is required, as well as relevant documentation. At least this should be done within the next few days as I find time for it among other projects.~~ * RTC Permissions: Unprivileged users shouldn't receive messaegs if they don't have the required permissions