No description
  • Rust 96.5%
  • Shell 3.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-03 09:21:10 -04:00
.github Adding a codeowners file for PRs. (#66) 2026-05-30 11:29:22 -04:00
scripts Adding release script (#78) 2026-06-01 14:39:47 -04:00
src Update readme with usage. (#75) 2026-05-30 14:55:45 -04:00
.gitignore Use 1.0 IE v1-alpha as main branch (#69) 2026-05-30 11:27:53 -04:00
.rustfmt.toml Use 1.0 IE v1-alpha as main branch (#69) 2026-05-30 11:27:53 -04:00
.woodpecker.yml Swap out cargo machete in favor of cargo shear (#76) 2026-06-01 15:35:23 +02:00
Cargo.lock chore(deps): update rust crate http to v1.4.2 (#81) 2026-06-12 20:50:47 -04:00
Cargo.toml Adding release script (#78) 2026-06-01 14:39:47 -04:00
cliff.toml Adding git cliff for releases. 2025-07-31 15:55:20 -04:00
LICENSE Add license 2024-01-27 15:23:32 -05:00
README.md Adding release script (#78) 2026-06-01 14:39:47 -04:00
release.bash Adding release script (#78) 2026-06-01 14:39:47 -04:00
renovate.json Fix renovate again (#85) 2026-07-03 09:21:10 -04:00

Crates.io Version GitHub tag (latest SemVer) Build Status GitHub issues License GitHub stars

Lemmy logo

lemmy-client

A Rust HTTP client for Lemmy. Uses the browser's built-in fetch API when targeting WASM to keep the binary size small.

Usage

In your Cargo.toml:

[dependencies]
lemmy_client = "X.X.X"

An example:

use lemmy_client::{LemmyClient, ClientOptions};
use lemmy_api_common::account::auth::Login;

async fn get_site_test() {
  let mut client = LemmyClient::new(ClientOptions {
    domain: "lemmy.ml",
    secure: true
  });

  let res = client.get_site().await;
  assert!(res.is_ok());

  // Login
  let login = Login {
    username_or_email: "user".to_string().into(),
    password: "password".to_string().into(),
    stay_logged_in: None,
    totp_2fa_token: None,
  };
  let jwt = client.login(login).await?.jwt;
  if let Some(jwt) = jwt {
    client.set_jwt(&jwt.into_inner());
  };
}