#websocket #http-request #social-vr #api-bindings #api-request #api #cvr

chilloutvr

Unofficial rust types of ChilloutVR's API

15 releases (4 breaking)

0.4.0 Apr 16, 2023
0.3.1 Apr 13, 2023
0.2.2 Apr 2, 2023
0.2.1 Mar 3, 2023
0.0.0-alpha.0 Aug 17, 2022

#1212 in Game dev

21 downloads per month
Used in 5 crates (4 directly)

MPL-2.0 license

71KB
1.5K SLoC

ChilloutVR API in rust

License Crates.io Docs

A rust crate for ChilloutVR's API.

This is fully unofficial and in no way affiliated, endorsed, supported, or created by Alpha Blend Interactive, the creators of ChilloutVR.

The crate has models of the responses, with proper serde support. It also definitions for the requests, using racal for the HTTP parts and big request/response structs for WebSockets, meaning that there's no lock-in to a single API client. An example API client using reqwest is provided for convenience though.

The API technically isn't public yet, so proceed with your own discretion. That also means there is no official API documentation. Which means it's possible that some things are wrong and/or will change a lot in the future.

Testing

The integration tests contact the live API. While a mock API could be created, it'd defeat the purpose of the tests. Which is to see that the client can actually use the real current API. While the requests & responses could be saved for a mock API, ensuring it stays up to date and behaves exactly like the real one is infeasible.

The integration tests are ignored by default for this reason. A lot of the tests also require actual authentication with an account, which you can read more about below.

Creating a user session manually

You can generate a user-auth.json file with logging in via curl for example:

curl --request POST \
  --url https://api.abinteractive.net/1/users/auth \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data '{
  "username": "email@Address",
  "password": "pa$$word",
  "authType": "LoginCredentials"
}' > user-auth.json

The resulting file should look something like the following:

{
 "message": "Successfully logged in as ljoonal",
 "data": {
  "username": "ljoonal",
  "accessKey": "long-string",
  "userId": "uuid",
  "more fields...": "...and their values"
 }
}

Running live API tests

Make sure that you've got an internet connection & a valid user-auth.json.

# A specific test with output logging
cargo test --all-features friend_requests -- --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. A license change however can be negotiated if the ABI team wants to use this crate or adopt this crate into a more official one with a different license.

Dependencies

~3–19MB
~261K SLoC