remoteit-api 0.2.0

A wrapper around the Remote.it GraphQL API, also implementing the custom request signing.
Documentation
remoteit-api-0.2.0 has been yanked.

remoteit-api

Crates.io License Docs.rs

This is a Rust wrapper for the Remote.it API.

Remote.it is a service that allows you to connect to devices remotely. It provides a way to connect to devices behind NATs and firewalls without having to configure port forwarding.

Blocking or Async

This library provides both blocking and async versions of the API. Neither is enabled by default though, so you need to choose one of them by enabling the corresponding feature.

cargo add remoteit-api -F blocking
cargo add remoteit-api -F async

Which one you want to use depends on your use case. If you are writing a CLI tool or a small script, you might want to use the blocking version. If you are writing a server or a GUI application, you might want to use the async version.

The developer API is pretty much the same for both versions, so you can switch between them easily.

Providing Credentials

You can get your credentials here: https://app.remote.it/#/account/accessKey.
Note: You need to have a Remote.it account to get the credentials.

Once you have the credentials, you have several options to use them with this crate:

Providing credentials using the credentials file as per remote.it spec

:information_source: You need to enable the credentials_loader feature to use this method. You can do this by running $ cargo add -F credentials_loader, or editing your Cargo.toml to look like this:

...
[dependencies]
remoteit-api = { version = "...", features = ["credentials_loader"] }
...

Save your remote.it credentials to ~/.remoteit/credentials.
The file should look like this:

[default]
R3_ACCESS_KEY_ID=
R3_SECRET_ACCESS_KEY=

Load the credentials using the Credentials::load_from_disk fn:

fn main() {
    let credentials = remoteit_api::Credentials::load_from_disk().unwrap();
}

Providing credentials directly

If you want to store the credentials in a different way, you can also provide them directly. You do not need to enable any features for this method.

fn main() {
    let credentials = remoteit_api::Credentials
}