vrc 0.3.0

Unofficial rust types of VRChat's API
Documentation

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, PRs are welcome to improve the situation, even beyond the plans:

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
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

License

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