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.
 
 
 
Dessalines b2edfeeaff v0.19.0-rc.19 1 week ago
.github Adding sleeplessone1917 to codeowners 7 months ago
.husky Add totp token (#192) 2 months ago
src Revert "Upgrading deps, removing cross_fetch." (#217) 1 week ago
.eslintrc.json #186 wrap bare strings to Error object (#207) 1 month ago
.gitignore Adding typedoc, and code comments. Fixes #29 (#30) 2 years ago
.prettierrc.json Add community language (#85) 12 months ago
.woodpecker.yml Upgrading deps (#117) 7 months ago
LICENSE Initial commit. 3 years ago
README.md Removing websocket. (#145) 6 months ago
copy_generated_types_from_lemmy.sh Updating types from lemmy. (#209) 1 month ago
deploy.sh Fixing deploy perms. 2 months ago
package.json v0.19.0-rc.19 1 week ago
putTypesInIndex.js Updating moderator_view. 3 months ago
tsconfig.json Make private class properties actually private (#128) 6 months ago
yarn.lock Fixing cross-fetch again. 1 week ago

README.md

GitHub tag (latest SemVer) GitHub issues License GitHub stars

lemmy-js-client

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

Installation

yarn add lemmy-js-client

Usage

HTTP Client

LemmyHttp docs

import { LemmyHttp, Login } from 'lemmy-js-client';

let baseUrl = 'https://lemmy.ml';
let client: LemmyHttp = new LemmyHttp(baseUrl, headers?);
let loginForm: Login = {
  username_or_email: "my_name",
  password: "my_pass",
};
let jwt = await client.login(loginForm).jwt;

Development

You can use yalc to develop and test changes locally:

yarn global add yalc

# Go to lemmy-js-client dir
yalc publish --push

# Go to your client dir
yalc add lemmy-js-client

# To do updates, go back to the lemmy-js-client dir
# This also updates it, in every dir you've added it.
yalc publish --push