tripactions 0.2.3

A fully generated & opinionated API client for the TripActions API.
Documentation

tripactions

A fully generated, opinionated API client library for TripActions.

docs.rs

API Details

Client Details

This client is generated from the TripActions OpenAPI specs based on API spec version 1. This way it will remain up to date as features are added. The documentation for the crate is generated along with the code to make this library easy to use.

To install the library, add the following to your Cargo.toml file.

[dependencies]
tripactions = "0.2.3"

Basic example

Typical use will require intializing a Client. This requires a user agent string and set of credentials.

use tripactions::Client;

let tripactions = Client::new(
    String::from("client-id"),
    String::from("client-secret"),
    String::from("token"),
);

Alternatively, the library can search for most of the variables required for the client in the environment:

  • TRIPACTIONS_CLIENT_ID
  • TRIPACTIONS_CLIENT_SECRET

And then you can create a client from the environment.

use tripactions::Client;

let tripactions = Client::new_from_env(
    String::from("token"),
);

It is okay to pass an empty value for token. In the initial state of the client, you will not know this value.

To start off a fresh client and get a token, use the following.

use tripactions::Client;

async fn do_call() {
    let mut tripactions = Client::new_from_env("");

    let mut access_token = tripactions.get_access_token().await.unwrap();
}