ATLAS Freedom API
This library is a Rust library which focuses on wrapping the ATLAS Freedom REST API in an easy to use and idiomatic way. The API is entirely asynchronous, support for a blocking client may be added sometime in the future, but for now an executor is required for usage. We recommend tokio, as it is already a dependency of the asynchronous http client used.
Installation
To incorporate the Freedom API into an existing cargo project simply invoke the following from the project's root directory:
$ cargo add freedom-api
Documentation
The freedom API has a significant amount of documentation to get users up and running quickly.
The latest docs are available here, via docs.rs. If you would like to build them locally, you may also clone the repo and run the following from the top-level:
$ cargo doc --no-deps --open
Usage
Once added, simply import the crate's prelude, build a client and make a query:
use *;
use StreamExt;
async
Creating Resources
In addition to fetching resources, the API can also be used to create resources for example a task request can be constructed with the following:
use Duration;
use *;
use OffsetDateTime;
async
Chaining API Returns
Many of the data types exposed in this library can be navigated to through other resources. For instance, a task request object holds links to the site object the task was scheduled at.
Rather than making a call to fetch the request, then parse the site ID, then request the site from the ID, you can instead fetch the site directly from the return of the task request call:
// The prelude includes extensions traits to make expose this functionality
use *;
async
API Return Type
Container
You will note that what is returned by the get_
methods of the API is of type
Self::Container<T>
rather than simply type T
. More information on why it
exists is available with the documentation for the
Container
trait.
However, since Container<T>
must implement Deref<T>
, the return types can be
used in most cases just like a T
.