e8f73758d636486854ca5e7fb00c5710beb62502
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>`
Christian Fraß [add] doc

Christian Fraß authored 2 years ago

48) - output type: `void`
49) 
50) 
51) ### `fetch`
52) 
53) - description: gets the current user list and all new (since the last call) events
54) - input type: `void`
Christian Fraß [mod] doc:api

Christian Fraß authored 2 years ago

55) - output type: `list<record<timestamp:integer,kind:string,data:any>>`
56) - output details:
57) 	- kind `user_list`: `data` type: `record<channel:string,users:list<record<name:string,role:string>>>`
58) 	- kind `user_joined`: `data` type: `record<channel:string,user_name:string>`
59) 	- kind `user_parted`: `data` type: `record<channel:string,user_name:string>`
60) 	- kind `user_kicked`: `data` type: `record<channel:string,user_name:string,op_name:string,reason:string>`
61) 	- kind `user_quit`: `data` type: `record<name:string,channels:list<string>>`
62) 	- kind `message_channel`: `data` type: `record<channel:string,sender:string,content:string>`
63) 	- kind `message_query`: `data` type: `record<user_name:string,sender:string,content:string>`