A javascript / typescript http and websocket client and type system for Lemmy.
yarn add lemmy-js-client
import { Login, LemmyWebsocket } from 'lemmy-js-client';
let client: LemmyWebsocket = new LemmyWebsocket();
let form: Login = {
username_or_email: "[email protected]",
password: "my_pass",
};
this.ws.send(client.login(form));
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;