Open Builditluc opened 1 year ago
The ModPortalClient
would then cache these Mod
structs. With this refactor, I imagine the use would be like this
let client = ModPortalClient::new()?;
let mod = client.get_mod_spec("Krastorio 2").await?;
// this mod data can now be used in other libraries
Sounds good to me. Do you want to send a pull request?
Currently, the
factorio-mod-api
returns its data in the same format the API returns it. I think it would be better to create some basic, more abstract data models. These are returned by the library and when some other library needs to access some of the features it'll implement the conversion to the correct format itself.For example, the whole mod api revolves around mods. So we need to implement a basic struct
Mod
that has all of the information of a mod (including dependencies, etc.). This would mean that we remove the whole "short" and "full" mod thing but I personally think that's okay because it just adds a lot of unnecessary logic.EDIT:
Mod
would contain sub structs that contain certain information for exampleMetadata
containing things like the owner or the homepage and source. It would be used like this