From 354a7b4ac73386471c10fe8951b3d68c23ca3cf8 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Date: Sun, 16 Jun 2024 13:55:50 -0400 Subject: [PATCH] v0.19.7 --- Cargo.toml | 2 +- src/lemmy_client_internal.rs | 4 ++-- src/lib.rs | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1ece367..c58d1f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lemmy-client" -version = "0.19.6" +version = "0.19.7" edition = "2021" license = "AGPL-3.0" authors = ["SleeplessOne1917"] diff --git a/src/lemmy_client_internal.rs b/src/lemmy_client_internal.rs index 3da6263..e5ab129 100644 --- a/src/lemmy_client_internal.rs +++ b/src/lemmy_client_internal.rs @@ -23,7 +23,7 @@ cfg_if! { if #[cfg(target_arch = "wasm32")] { use gloo_net::http::{Request, RequestBuilder}; use web_sys::wasm_bindgen::UnwrapThrowExt; - pub struct Fetch(ClientOptions); + pub struct Fetch(pub ClientOptions); impl Fetch { pub fn new(options: ClientOptions) -> Self { @@ -105,7 +105,7 @@ cfg_if! { pub struct ClientWrapper { client: reqwest::Client, - options: ClientOptions + pub options: ClientOptions } impl ClientWrapper { diff --git a/src/lib.rs b/src/lib.rs index 7a2c960..551228c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,9 +22,10 @@ //! assert!(res.is_ok()); //! } //! +//! ``` //! ## IMPORTANT NOTICE //! This crate now uses a different versioning scheme than before so as not to be too tied down to Lemmy releases. For Lemmy versions 0.19.4 and up, use versions 1.x.x. For Lemmy versions 0.19.3 and under, use versions 0.19.5 and up. This is confusing, but should become a non issue as Lemmy accumulates versions and fewer servers use Lemmy versions use 0.19.3 and lower -//! ``` + use std::collections::HashMap; use crate::{lemmy_client_trait::LemmyClientInternal, response::LemmyResult}; @@ -58,6 +59,19 @@ pub struct LemmyClient { client: ClientWrapper, } +impl LemmyClient { + /// Get the options the client is using. + pub fn options(&self) -> &ClientOptions { + cfg_if! { + if #[cfg(target_family = "wasm")] { + &self.client.0 + } else { + &self.client.options + } + } + } +} + macro_rules! expose_wrapped_fn { ($name:ident, $form:ty, $response:ty, $doc:expr) => { #[doc = $doc]