993b94ac8ee4fa02dfb60bab89ddcc2d23ecc341
Christian Fraß [add] doc

Christian Fraß authored 2 years ago

1) ## Usage
2) 
3) Simply file an HTTP request to the server with:
4) 
5) - method: `POST` (or any other, that accepts a body)
6) - body: JSON encoded data of type `record<id:(null|string),action:string,data:any>`, where:
7) 	- `id` is the connection identifier
8) 	- `action` is the name of the action to execute
9) 	- `data` is the data for the action; its concrete structure is described as the input type of the action
10) 
11) Example: `curl 'http://localhost:7979' -d '{"id":"foo1bar2",action":"send","data":{"channel":"#main","message":"hello"}}'`
12) 
13) 
14) ## Actions
15) 
16) ### `connect`
17) 
18) - description: starts to establish a connection and returns the connection identifier
19) - input type: `record<server:string,nickname:string,channels:list<string>>`
20) - output type: `integer`
21) 
22) 
23) ### `disconnect`
24) 
25) - description: ends an established connection
26) - input type: `void`
27) - output type: `void`
28) 
29) 
30) ### `check`
31) 
32) - description: checks if the connection is established
33) - input type: `void`
34) - output type: `boolean`
35) 
36) 
Christian Fraß [mod] stateless

Christian Fraß authored 2 years ago

37) ### `send_channel`
Christian Fraß [add] doc

Christian Fraß authored 2 years ago

38) 
Christian Fraß [mod] stateless

Christian Fraß authored 2 years ago

39) - description: sends a message to a channel
40) - input type: `record<channel:string,content:string>`
41) - output type: `void`
42) 
43) 
44) ### `send_query`
45) 
46) - description: sends a message to a query
47) - input type: `record<receiver:string,content:string>`