Skip to content

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

License

Notifications You must be signed in to change notification settings

ExperiBass/lemmy-js-client

 
 

Repository files navigation

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: "[email protected]",
  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.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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.9%
  • Other 1.1%