Crates.io | zuora_rest_client |
lib.rs | zuora_rest_client |
version | 0.1.5 |
source | src |
created_at | 2021-10-28 20:55:36.015774 |
updated_at | 2021-11-06 05:56:39.793631 |
description | A HTTP Client built on top of the reqwest package for accessing the Zuora Billing REST API. |
homepage | |
repository | https://github.com/peteyb/zuora_rest_client |
max_upload_size | |
id | 473692 |
size | 47,875 |
A HTTP Client built on top of the reqwest package for accessing the Zuora Billing REST API
This package currently only provides an interface for performing OAuth authenticated GET requests
This example uses serde_json to prepare the data for a GET request. Your Cargo.toml
could look like this:
[dependencies]
zuora_rest_client = "0.1"
serde_json = "1"
And then the code:
use std::env;
use zuora_rest_client::Zuora;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = Zuora::new(
env::var("ZUORA_CLIENT_ID").unwrap_or_default(),
env::var("ZUORA_CLIENT_SECRET").unwrap_or_default(),
String::from("https://rest.sandbox.eu.zuora.com"),
String::from("/v1"),
3,
);
let result = client.generate_token();
println!("{:?}", result);
let get = client.get("/catalog/products", serde_json::from_str("{}").unwrap());
println!("{:?}", get);
Ok(())
}
Licensed under