pub struct RommClient { /* private fields */ }Expand description
High-level HTTP client for the ROMM API.
This type hides the details of reqwest and authentication headers
behind a small interface that all frontends can share.
Implementations§
Source§impl RommClient
impl RommClient
Sourcepub async fn download_rom<F>(
&self,
rom_id: u64,
save_path: &Path,
on_progress: F,
) -> Result<(), DownloadError>
pub async fn download_rom<F>( &self, rom_id: u64, save_path: &Path, on_progress: F, ) -> Result<(), DownloadError>
Downloads a ROM (or multiple ROMs as a zip) to the specified path.
pub async fn download_rom_with_cancel<F, C>( &self, rom_id: u64, save_path: &Path, is_cancelled: C, on_progress: &mut F, ) -> Result<(), DownloadError>
Sourcepub async fn download_url_with_cancel<F, C>(
&self,
url: &str,
save_path: &Path,
is_cancelled: C,
on_progress: &mut F,
) -> Result<(), DownloadError>
pub async fn download_url_with_cancel<F, C>( &self, url: &str, save_path: &Path, is_cancelled: C, on_progress: &mut F, ) -> Result<(), DownloadError>
Downloads an arbitrary URL to save_path, supporting auth headers and resume.
Sourcepub async fn download_url_with_query_with_cancel<F, C>(
&self,
url: &str,
query: &[(String, String)],
save_path: &Path,
is_cancelled: C,
on_progress: &mut F,
) -> Result<(), DownloadError>
pub async fn download_url_with_query_with_cancel<F, C>( &self, url: &str, query: &[(String, String)], save_path: &Path, is_cancelled: C, on_progress: &mut F, ) -> Result<(), DownloadError>
Downloads an arbitrary URL and query to save_path, supporting auth headers and resume.
Source§impl RommClient
impl RommClient
Sourcepub async fn rom_server_version_from_heartbeat(&self) -> Option<String>
pub async fn rom_server_version_from_heartbeat(&self) -> Option<String>
RomM application version from GET /api/heartbeat (SYSTEM.VERSION), if the endpoint succeeds.
Sourcepub async fn fetch_openapi_json(&self) -> Result<String, ApiError>
pub async fn fetch_openapi_json(&self) -> Result<String, ApiError>
GET the OpenAPI spec from the server.
Source§impl RommClient
impl RommClient
Sourcepub async fn call<E>(&self, ep: &E) -> Result<E::Output, ApiError>
pub async fn call<E>(&self, ep: &E) -> Result<E::Output, ApiError>
Executes a typed Endpoint and returns its deserialized output.
Sourcepub async fn request_json(
&self,
method: &str,
path: &str,
query: &[(String, String)],
body: Option<Value>,
) -> Result<Value, ApiError>
pub async fn request_json( &self, method: &str, path: &str, query: &[(String, String)], body: Option<Value>, ) -> Result<Value, ApiError>
Low-level helper that issues an HTTP request and returns a raw JSON Value.
pub async fn request_json_unauthenticated( &self, method: &str, path: &str, query: &[(String, String)], body: Option<Value>, ) -> Result<Value, ApiError>
Source§impl RommClient
impl RommClient
Sourcepub async fn run_task(
&self,
task_name: &str,
kwargs: Option<Value>,
) -> Result<Value, ApiError>
pub async fn run_task( &self, task_name: &str, kwargs: Option<Value>, ) -> Result<Value, ApiError>
Triggers a server-side task by name (e.g., "scan_library").
Sourcepub async fn get_task_status(&self, task_id: &str) -> Result<Value, ApiError>
pub async fn get_task_status(&self, task_id: &str) -> Result<Value, ApiError>
Polls the status of a running task by its ID.
Sourcepub async fn run_all_tasks(&self) -> Result<Value, ApiError>
pub async fn run_all_tasks(&self) -> Result<Value, ApiError>
Enqueues all runnable tasks on the server.
Sourcepub async fn list_tasks(&self) -> Result<Value, ApiError>
pub async fn list_tasks(&self) -> Result<Value, ApiError>
Lists all recent and active tasks.
Sourcepub async fn get_tasks_queue_status(&self) -> Result<Value, ApiError>
pub async fn get_tasks_queue_status(&self) -> Result<Value, ApiError>
Returns the current status of the task queue.
Source§impl RommClient
impl RommClient
Sourcepub async fn upload_rom<F>(
&self,
platform_id: u64,
file_path: &Path,
on_progress: F,
) -> Result<(), ApiError>
pub async fn upload_rom<F>( &self, platform_id: u64, file_path: &Path, on_progress: F, ) -> Result<(), ApiError>
Uploads a ROM file to the server using the RomM chunked upload API.
Sourcepub async fn upload_save_file(
&self,
rom_id: u64,
emulator: Option<&str>,
file_path: &Path,
) -> Result<Value, ApiError>
pub async fn upload_save_file( &self, rom_id: u64, emulator: Option<&str>, file_path: &Path, ) -> Result<Value, ApiError>
Uploads a game save file to the server.
Sourcepub async fn upload_save_file_with_options(
&self,
rom_id: u64,
file_path: &Path,
options: &SaveUploadOptions<'_>,
) -> Result<Value, ApiError>
pub async fn upload_save_file_with_options( &self, rom_id: u64, file_path: &Path, options: &SaveUploadOptions<'_>, ) -> Result<Value, ApiError>
Uploads a game save file with sync-specific options.
Sourcepub async fn download_save_content(
&self,
save_id: u64,
device_id: Option<&str>,
session_id: Option<u64>,
) -> Result<Vec<u8>, ApiError>
pub async fn download_save_content( &self, save_id: u64, device_id: Option<&str>, session_id: Option<u64>, ) -> Result<Vec<u8>, ApiError>
Downloads save content from GET /api/saves/{id}/content.
Sourcepub async fn upload_state_file(
&self,
rom_id: u64,
emulator: Option<&str>,
file_path: &Path,
) -> Result<Value, ApiError>
pub async fn upload_state_file( &self, rom_id: u64, emulator: Option<&str>, file_path: &Path, ) -> Result<Value, ApiError>
POST /api/states with multipart field stateFile.
Sourcepub async fn upload_screenshot_file(
&self,
rom_id: u64,
file_path: &Path,
) -> Result<Value, ApiError>
pub async fn upload_screenshot_file( &self, rom_id: u64, file_path: &Path, ) -> Result<Value, ApiError>
POST /api/screenshots with multipart field screenshotFile.
Trait Implementations§
Source§impl Clone for RommClient
impl Clone for RommClient
Source§fn clone(&self) -> RommClient
fn clone(&self) -> RommClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RommClient
impl !UnwindSafe for RommClient
impl Freeze for RommClient
impl Send for RommClient
impl Sync for RommClient
impl Unpin for RommClient
impl UnsafeUnpin for RommClient
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more