diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-16 01:39:48 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-16 01:39:48 +0100 |
commit | 29a10b6fede6828e3da49272aefa5c8fe2c08078 (patch) | |
tree | 97f9596011cf09cbf0a8935e293db2cf7a8a30ce /client | |
parent | af99c406af8ee47bee38708cf23e86af826e41ba (diff) | |
download | jellything-29a10b6fede6828e3da49272aefa5c8fe2c08078.tar jellything-29a10b6fede6828e3da49272aefa5c8fe2c08078.tar.bz2 jellything-29a10b6fede6828e3da49272aefa5c8fe2c08078.tar.zst |
tool: reimport client
Diffstat (limited to 'client')
-rw-r--r-- | client/src/lib.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/client/src/lib.rs b/client/src/lib.rs index 61365a3..b80f705 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -5,7 +5,7 @@ */ use anyhow::Result; use jellycommon::user::UserPermission; -use log::debug; +use log::{debug, info}; use reqwest::{ header::{HeaderMap, HeaderValue}, Client, @@ -100,7 +100,10 @@ impl Session { debug!("downloading asset {role:?} for {id:?}"); let mut r = self .client - .get(format!("{}/n/{id}/asset?role={role}&width={width}", self.instance.base())) + .get(format!( + "{}/n/{id}/asset?role={role}&width={width}", + self.instance.base() + )) .send() .await?; while let Some(chunk) = r.chunk().await? { @@ -109,6 +112,17 @@ impl Session { Ok(()) } + pub async fn reimport(&self) -> Result<()> { + // TODO error handling + info!("reimport"); + self.client + .post(format!("{}/admin/import", self.instance.base())) + .send() + .await?; + info!("done"); + Ok(()) + } + pub fn stream(&self, id: &str, stream_spec: &StreamSpec) -> String { format!( "{}/n/{}/stream?{}&{}", |