A client library for Feliday
36103fbca0
* Testing some option types over the API. * v0.17.0-rc.6 * Removing a few to better test. * v0.17.0-rc.7 * Simpler again. * v0.17.0-rc.8 * Trying swan.io boxed * v0.17.0-rc.13 * Trying option-t * v0.17.0-rc.14 * Adding rust-style Options using @sniptt/monads - Also added serialization with class-transformer * v0.17.0-rc.15 * Trying to fix encodeGetParams. * v0.17.0-rc.16 * Trying to fix encodeGetParams 2. * v0.17.0-rc.17 * Using init constructors. * v0.17.0-rc.18 * v0.17.0-rc.19 * Add more type info. * v0.17.0-rc.20 * Adding reflect-metadata * v0.17.0-rc.21 * Adding type to siteview.site * v0.17.0-rc.22 * Adding rest of nested types. * v0.17.0-rc.23 * Adding toOption function. * v0.17.0-rc.24 * Trying to fix send. * v0.17.0-rc.25 * Try to stringify jsonres. * v0.17.0-rc.26 * Try to stringify jsonres 2. * v0.17.0-rc.27 * Adding toOption function. * v0.17.0-rc.28 * Forgot to type a communityview. * v0.17.0-rc.29 * Forgot to type a registrationapplicationview. * v0.17.0-rc.30 |
||
---|---|---|
.husky | ||
src | ||
.drone.yml | ||
.eslintrc.json | ||
.gitignore | ||
.prettierrc.js | ||
deploy.sh | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json | ||
yarn.lock |
lemmy-js-client
A javascript / typescript http and websocket client and type system for Lemmy.
Installation
yarn add lemmy-js-client
Usage
Websocket Client
import { Login, LemmyWebsocket } from 'lemmy-js-client';
let client: LemmyWebsocket = new LemmyWebsocket();
let form: Login {
username_or_email: "my_email@email.tld",
password: "my_pass",
};
this.ws.send(client.login(form));
HTTP Client
import { LemmyHttp } from 'lemmy-js-client';
let baseUrl = 'https://lemmy.ml';
let client: LemmyHttp = new LemmyHttp(baseUrl, headers?);
let jwt = await client.httpLogin(loginForm).jwt;