onlivfe / vrc_rs

VRChat's API in a rust idiomatic way (unofficial)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VRChat API in rust

License Crates.io Docs

WIP rust models of VRChat's API.

This is fully unofficial and in no way affiliated, endorsed, supported, or created by VRChat.

Huge shoutout to the MIT licensed vrchatapi, which this crate borrows a lot from. If you're looking for a more mature project, please consider looking at their generated rust crate instead.

I disliked the generated nature of it though, and wanted more strong Rust-like things for some things, which is why this crate exists.

There's quite a bit missing, if you want to help with that, see contributing.

Status Category Planned
Implemented Authentication More testing
None Avatars Getting a specific avatar only
None Economy None
None Favorites Eventual implementation
None Files None
Partial Friends Implementation soon
Partial Groups More testing (requires VRC+ :/ )
None Invites Listing invites only
Partial Instances Implementation soon
None Notifications Eventual implementation
None Permissions None
None System Eventual implementation of system statistics
Partial Users Planned to be implemented soon
Partial Worlds None, at least in the near term

The categories are from the awesome VRChat API Docs project.

Testing

The integration tests contact the live API. That's why they are ignored by default.

Pretty much all of them require authentication.

Sadly not all the things can even be reliably tested without creating a mock API. Which in turn defeats the purpose of the tests in the first place. So only some of the behavior is actually tested, though improvements to it are welcome.

Creating a user session manually

Getting the authentication for VRC takes a few steps due to it's usage of cookies, and 2fa requiring another request.

You can use the get_auth.py script for convenience. It's in python since it was created before the proper typed rust API client was ready. Note that you should've have logged in from the same IP address previously, as VRChat handles logins from new IPs differently which just breaks everything.

Running ignored tests

Make sure that you've got:

  • an internet connection
  • a valid user-sesion.json

Then just run the tests;

# A specific test with output logging
cargo test --all-features current_user -- --exact --ignored --nocapture
# All tests
cargo test --all-features -- --ignored

Contributing

Coding

This crate aims to be of higher quality vs quantity. This means that the bar for what gets merged is maybe higher than some want to bother with. Please run the clippy checks along with nightly cargo formatting, and check that the CI checks pass.

Any contributions are welcome though, just mark the PR as editable by maintainers. That way even if you don't feel like acting out on the feedback, the improvements will most likely eventually find their way back to here.

Other

Alternatively if you don't feel like coding, creating GitHub issues for wrong behavior would be very welcome. Additionally, figuring out the actual data types and inheritance models, and improving the docs would really help with development! Also just starring this GitHub repository helps with motivation for more work on this crate that serves other projects as well.

License

Note that the license is MPL-2.0 instead of the more common MIT OR Apache-2.0.

About

VRChat's API in a rust idiomatic way (unofficial)

License:Mozilla Public License 2.0


Languages

Language:Rust 96.2%Language:Python 3.8%