-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add crate for API use #215
Comments
Hi, thanks for your suggestion! I've put work on an API on hold indefinitely because I'm not sure how it should be designed or implemented. Like Minecraft, PackSquash relies on packs residing on some kind of directory abstraction, so any API would require inputs that are not written to disk to implement a filesystem-like interface, which limits its scalability and flexibility more than I'd like. A REST API sounds cool, but it would have to build a filesystem and run PackSquash with the specified options afterwards, which I also find somewhat lame: the server needs to store the entire pack somewhere anyway. The way I see it, the main benefit from an API would be dropping the need for other applications to run external binaries or set up filesystem directories to optimize packs. This is indeed easier and more portable, but it does not enable fundamentally new usage modes for PackSquash. Internally, the CLI project already uses a private library crate that exposes an API, but this API is not stable at all, so using the API won't make upgrades for app developers easier, and stabilizing it would have a significant cost. However, I'm open to reconsider this at some point! Any feedback and ideas on how to design this API are welcome. Code contributions are also welcome, but I'd recommend getting in touch first over Discord to coordinate efforts. What would you expect from a PackSquash API? 😄 |
I was just thinking to automate packsquashing. I tried the GitHub Actions thingy, but it didn't work as well as I had hoped. So I thought I could write my own Rust program that interfaces with PackSquash and offers a Rest HTTP endpoint, so I could implement PackSquash into Oraxen (as an optional feature). I haven't looked at the internals yet, but there should be somehow a way to pass a file and some options and get the squashed pack back. I'd be happy to contribute if I know what I should do, although my Rust knowledge is not very advanced. |
I see! Sorry for taking a while to reply, I was busy with other stuff ❤️ The new GUI frontend I'm working on for v0.4.0 also depends on the library crate I mentioned, as does the classic CLI frontend. The already existing library crate does indeed receive some options, among which is If the end goal is to integrate PackSquash with Oraxen via a new frontend, I could incorporate it into this repository. A more generic REST API frontend may also be appropriate. Or we could even try to expose the library crate directly, after somehow removing its coupling with filesystem paths, without altering the functionality of the existing frontends. Your goals and help could be very valuable in shaping a proper API. If you have the time, you can start by reading the internal library crate API docs by running |
No worries! Take your time. |
Related problem or need
As far as I know, there is no crate to interact with packsquash in Rust or any other language, so the only solution would be either to just copy the code or run CLI commands, which is unpractical too.
Proposed solution
Publish a crate to the Rust Crate Repository for easy use of the program.
Alternative solutions
Maybe host an online Rest API, which can be used from any language.
Additional context
None :D
The text was updated successfully, but these errors were encountered: