git.schokokeks.org
Repositories
Help
Report an Issue
wirc-backend.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
e8f7375
Branches
Tags
master
wirc-backend.git
doc
api.md
[mod] doc:api
Christian Fraß
commited
e8f7375
at 2021-11-20 16:05:32
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: `list<record<timestamp:integer,kind:string,data:any>>` - output details: - kind `user_list`: `data` type: `record<channel:string,users:list<record<name:string,role:string>>>` - kind `user_joined`: `data` type: `record<channel:string,user_name:string>` - kind `user_parted`: `data` type: `record<channel:string,user_name:string>` - kind `user_kicked`: `data` type: `record<channel:string,user_name:string,op_name:string,reason:string>` - kind `user_quit`: `data` type: `record<name:string,channels:list<string>>` - kind `message_channel`: `data` type: `record<channel:string,sender:string,content:string>` - kind `message_query`: `data` type: `record<user_name:string,sender:string,content:string>`