coder.rs
is a pure Rust wrapper around the Coder On-Prem
API.
Coder.rs has been tested to work on Rust 1.40+
Add this to your Cargo.toml
's [dependencies]
section:
toml
coder = { version = "0.2", features = ["rustls"] }
Coder provides the coder::Coder
struct for creating requests.
```rust use std::env; use std::error::Error;
use coder::client::{Coder, Executor};
async fn main() -> Result<(), Box
let res = c.get().me().execute().await?;
dbg!(res);
Ok(())
}
// [src/bin/main.rs:19] res = ApiResponse { // headers: Headers( // { // "server": "openresty/1.15.8.2", // "date": "Wed, 05 Aug 2020 05:05:11 GMT", // "content-type": "application/json", // "content-length": "653", // "vary": "Accept-Encoding", // "vary": "Origin", // "strict-transport-security": "max-age=15724800; includeSubDomains", // "coder-version": "1.9.0-rc1-220-gd2a04f83a", // "x-envoy-upstream-service-time": "20", // }, // ), // statuscode: 200, // response: Ok( // User { // id: "5e876cf4-10abe9b2e54eb609c5ec1870", // name: "Colin Adler", // username: "colin", // email: "colin@coder.com", // dotfilesgituri: "", // roles: [ // "site-manager", // "site-auditor", // ], // avatarhash: "28707dc83fdcba2cacaa3ad5e381b34b7cb37b74", // keyregeneratedat: 2020-04-03T17:05:56.964782Z, // createdat: 2020-04-03T17:05:56.964782Z, // updatedat: 2020-05-29T18:10:33.532351Z, // }, // ), // } ```
rustls
- Uses the rustls
pure Rust TLS implementation. (default)rust-native-tls
- Uses native-tls
for TLS which links against the OS default.