Skip to content
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

Support for Rust client #312

Open
banool opened this issue Nov 7, 2024 · 2 comments
Open

Support for Rust client #312

banool opened this issue Nov 7, 2024 · 2 comments

Comments

@banool
Copy link

banool commented Nov 7, 2024

Hey hey, I'm wondering if there is a recommended way to call an RSPC API from Rust? As far as I can tell there is no way to generate a client automatically. I saw some issues about OpenAPI but it doesn't seem to be released yet. I don't think using something like utoipa would work, there is no way to derive the necessary traits.

I suppose the best thing we could manage is to put the Rust types for the requests and responses (which derived specta::Type) into their own crate and then write our own client based on those. Or idk, something insane where we run compile the client into JS and then run it via Deno or something 😅

Any ideas would be appreciated!

@oscartbeaumont
Copy link
Member

oscartbeaumont commented Dec 6, 2024

Sorry, completely missed this issue.

Right now we don't have an offcial way but I have started work on a prototype client for Rust previewed here (Note it's part of #326). I would be very open to contributions on it if you wanted to take it for a spin but be aware it's more a proof of concept at the moment as I wanted to iron out how the type exporter would work before we stablise the new API.

OpenAPI support is definitely a bit furthur away as it's much harder to integrate with.

(going to keep this issue open until it's stable so we have a place to track it's progress)

  • How are content types and binario going to work?

@banool
Copy link
Author

banool commented Feb 21, 2025

Awesome, I'll check out the prototype. The time has finally come, I need to hit an rspc server from another Rust service, so I'll let you know how I go with it.

One question, I see that router v2 has been merged to main (#326) but the TS client hasn't (#332). Does this mean we shouldn't use main at the moment? It seems like this Rust client is based on router v2, so it wouldn't be usable with an old rpsc server? We're currently using this commit: 56d0230.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants