1use anyhow::Result;
8
9use crate::client::RommClient;
10use crate::endpoints::{platforms::ListPlatforms, roms::GetRoms};
11use crate::types::{Platform, RomList};
12
13pub struct PlatformService<'a> {
15 client: &'a RommClient,
16}
17
18impl<'a> PlatformService<'a> {
19 pub fn new(client: &'a RommClient) -> Self {
20 Self { client }
21 }
22
23 pub async fn list_platforms(&self) -> Result<Vec<Platform>> {
25 let platforms = self.client.call(&ListPlatforms).await?;
26 Ok(platforms)
27 }
28}
29
30pub struct RomService<'a> {
32 client: &'a RommClient,
33}
34
35impl<'a> RomService<'a> {
36 pub fn new(client: &'a RommClient) -> Self {
37 Self { client }
38 }
39
40 pub async fn search_roms(&self, ep: &GetRoms) -> Result<RomList> {
42 let results = self.client.call(ep).await?;
43 Ok(results)
44 }
45}