mirror of
https://github.com/versia-pub/api.git
synced 2026-03-13 04:09:15 +01:00
docs(federation): 📝 Document RequestParserHandler
This commit is contained in:
parent
7c5c2d9f70
commit
80130a1f22
2 changed files with 28 additions and 0 deletions
|
|
@ -32,13 +32,17 @@ type ParserCallbacks<T> = {
|
|||
/**
|
||||
* A class to parse the body of a request and call the appropriate callback.
|
||||
* @example
|
||||
* const body = { ... };
|
||||
* const validator = new EntityValidator();
|
||||
* const parser = new RequestParserHandler(body, validator);
|
||||
*
|
||||
* await parser.parseBody({
|
||||
* note: (note) => {
|
||||
* // If the object is a Note, this will be called
|
||||
* console.log(note);
|
||||
* },
|
||||
* follow: (follow) => {
|
||||
* // If the object is a Follow, this will be called
|
||||
* console.log(follow);
|
||||
* },
|
||||
* ...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue