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<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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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 more