A javascript / typescript http and websocket client and type system for Lemmy.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Nutomic dd615bf484
Merge pull request #55 from LemmyNet/use_enum_types
5 days ago
.husky Upgrade deps (#23) 10 months ago
src Use enum types in API. Fixes #51 5 days ago
.drone.yml Trying to publish with npm token 24 4 months ago
.eslintrc.json Upgrade deps 2 (#39) 6 months ago
.gitignore Adding typedoc, and code comments. Fixes #29 (#30) 9 months ago
.prettierrc.js Upgrade deps 2 (#39) 6 months ago
LICENSE Initial commit. 2 years ago
README.md Remove support / donate section. 9 months ago
deploy.sh Adding new version to deploy. 1 year ago
package.json v0.17.0-rc.9 5 days ago
tsconfig.json Initial commit. 2 years ago
yarn.lock Upgrading deps. (#43) 4 months ago

README.md

GitHub tag (latest SemVer) GitHub issues License GitHub stars

lemmy-js-client

A javascript / typescript http and websocket client and type system for Lemmy.

Installation

yarn add lemmy-js-client

Usage

Websocket Client

LemmyWebsocket docs

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

LemmyHttp docs

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;