git.schokokeks.org
Repositories
Help
Report an Issue
wirc-backend.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
993b94a
Branches
Tags
master
wirc-backend.git
doc
api.md
[mod] stateless
Christian Fraß
commited
993b94a
at 2021-11-20 15:05:30
api.md
Blame
History
Raw
## Usage Simply file an HTTP request to the server with: - method: `POST` (or any other, that accepts a body) - body: JSON encoded data of type `record<id:(null|string),action:string,data:any>`, where: - `id` is the connection identifier - `action` is the name of the action to execute - `data` is the data for the action; its concrete structure is described as the input type of the action Example: `curl 'http://localhost:7979' -d '{"id":"foo1bar2",action":"send","data":{"channel":"#main","message":"hello"}}'` ## Actions ### `connect` - description: starts to establish a connection and returns the connection identifier - input type: `record<server:string,nickname:string,channels:list<string>>` - output type: `integer` ### `disconnect` - description: ends an established connection - input type: `void` - output type: `void` ### `check` - description: checks if the connection is established - input type: `void` - output type: `boolean` ### `send_channel` - description: sends a message to a channel - input type: `record<channel:string,content:string>` - output type: `void` ### `send_query` - description: sends a message to a query - input type: `record<receiver:string,content:string>` - output type: `void` ### `fetch` - description: gets the current user list and all new (since the last call) events - input type: `void` - output type: `record<users:list<record<name:string,role:string>>,events:list<record<timestamp:integer,kind:string,data:map<string,any>>>>`