# `lainchan` API

[`lainchan`](https://github.com/lainchan/lainchan) engine was originally a fork of [`vichan`](https://github.com/vichan-devel/vichan) engine with some added features.

### Differences from `vichan`

* Supports attaching 3 attachments at a maximum rather than just one.

### Post a comment

Send a `POST` request of type `multipart/form-data` to `/post.php`

Parameters:

* `thread` — Thread ID.
* `board` — Board ID.
* `login` — Unknown. Perhaps a "username" in case of being authenticated. Leave empty.
* `lastname` — Unknown. Leave empty.
* `user` — Unknown. Some numeric value. Example: `72809`. Unknown. Leave empty.
* `name` — Same as in `vichan`.
* `email` — Same as in `vichan`.
* `subject` — Comment title.
* `body` — Comment text.
* `q` — Unknown. Leave empty.
* `password` — Same as in `vichan`.
* `page` — Didn't check if it's present. I'd assume that it's same as in `vichan`.
* `hash` — A hexademical string. Unknown. Example: `"b40d7262baa8f14cb03cbc31f2436e6f8fe9edcb"`. Maybe autogenerated somehow. Dunno if could be omitted or not.
* `json_response` — Set to `1` to receive the HTTP response in `application/json` format.
* `post` —  Unknown. Has value `"Post"`. I'd assume that this parameter could be omitted.
* `file1` — Attachment 1.
* `file2` — Attachment 2.
* `file3` — Attachment 3.
* `file_url1` — Attachment URL 1. Unknown. Perhaps a replacement for `vichan`'s `embed` parameter. Leave empty.
* `file_url2` — Attachment URL 2. Unknown. Perhaps a replacement for `vichan`'s `embed` parameter. Leave empty.
* `file_url3` — Attachment URL 3. Unknown. Perhaps a replacement for `vichan`'s `embed` parameter. Leave empty.
* `spoiler` — Same as in `vichan`.

The response is same as in `vichan`

### Post a thread

Didn't check. I'd assume, analogous to "Post a comment" but without specifying the `thread` parameter and with same features as in `vichan`.

### Report a post

This is a two-in-one "report post" / "delete post or post attachments" API.

`POST` to `/post.php`

Parameters:

* `board` — Board ID.
* `delete_<post-id>` — In `vichan` it has value `1`. Looks like the engine uses the name of this parameter to get the post ID from, which is a very lame API input design, but that's `vichan` legacy. In `lainchan` I've seen this parameter value be empty when reporting a post which is equally, if not more, confusing. Looks like this parameter should be present but at the same time it's supposed to be empty, supposedly when only reporting the post rather than deleting it.
* `password` — Deletion password that was submitted when posting the comment. Leave empty when not deleting anything.
* `reason` — Report text.
* `report` — Unknown. Has value `"Report"`. I'd assume that this parameter could be omitted.