ljoonal/neos_rs
Archived
1
Fork 0
NeosVR API related functionality. Currently very early, only featuring some of the models. https://docs.rs/neos/latest/
This repository has been archived on 2023-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
ljoonal db4f8936ed
All checks were successful
continuous-integration/drone/push Build is passing
Switch to alpine docker images & add licenses to deny conf
2022-10-22 16:42:06 +03:00
.config Add more checks to CI, fix a lot of spelling errors 2022-10-20 22:58:25 +03:00
.vscode Add vscode setting to make analyzy api_client 2022-01-09 22:23:05 +02:00
src Add more checks to CI, fix a lot of spelling errors 2022-10-20 22:58:25 +03:00
tests Bump test message count for broader testing 2022-03-14 08:22:33 +02:00
.drone.yml Switch to alpine docker images & add licenses to deny conf 2022-10-22 16:42:06 +03:00
.gitignore Add directory file to gitignore 2022-01-17 16:20:09 +02:00
Cargo.toml Add more checks to CI, fix a lot of spelling errors 2022-10-20 22:58:25 +03:00
deny.toml Switch to alpine docker images & add licenses to deny conf 2022-10-22 16:42:06 +03:00
LICENSE Basic groundwork 2022-01-06 06:15:51 +02:00
logo.png Add logo 2022-01-06 18:38:01 +02:00
README.md Fix docs being outdated and saying chrono 2022-08-09 21:48:37 +03:00
rustfmt.toml Properly format comments & docs 2022-01-10 13:07:34 +02:00

Neos API in rust

License Crates.io Docs

Rust models of NeosVR's API.

Featuring full serde support, time for datetimes, and strum for better enums.

Any official documentation of Neos' API is lacking, and the API is still changing too. So this crate can't guarantee correctness. Some of the types are based solely on educated guesses even.

This crate provides a blocking API client with the optional api_client feature.

Future plans

  • Better documentation in general
  • Splitting some linked Option<T> fields into their own sub-structs

Testing

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

Some of them also 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.

Creating a user session manually

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

curl --request POST \
  --url https://api.neos.com/api/userSessions \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data '{
  "password": "pa$$word",
  "secretMachineId": "string",
  "rememberMe": true,
  "ownerId": "string",
  "email": "user@example.com",
  "username": "string"
}' > user-session.json

Only use a single identification method (username/email/ownerId). Also be sure to replace the rest of the values with your own. Using a secretMachineId is also recommended to not log out your other sessions. You can generate a random one for example with: openssl rand -hex 32

Running ignored tests

Make sure that you've got:

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

Then just run 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 Neos team wants to use this crate or adopt this crate into a more official one with a different license.