Expand description
§Crops API Models
A collection of structures representing the various entities from Harvest API.
This is collection was created to work in conjunction with two other libraries: crops api client and crops api services.
But you can use it directly with reqwest as well:
use reqwest::{
Method,
blocking::{
Client,
Response,
}
};
use crops_api_models::UserMe;
fn main() {
let bearer = "...";
let acc_id = "...";
let url = "https://api.harvestapp.com/v2/users/me";
let method = Method::from_bytes("GET".as_bytes()).unwrap();
let resp: Response = Client::new()
.request(method, url)
.header("Authorization", format!("Bearer {}", bearer))
.header("Harvest-Account-Id", acc_id)
.header("User-Agent", "harvest-api-models rust example")
.send()
.unwrap();
let model: UserMe = resp.json().unwrap();
println!("json: {:?}", model)
}Re-exports§
pub use partials::PartialUser;pub use partials::PartialProject;pub use partials::PartialClient;pub use partials::PartialTask;pub use pagination::Page;pub use pagination::Links;pub use client::Client;pub use creator::Creator;pub use estimate::Estimate;pub use invoice::Invoice;pub use line_item::LineItem;pub use project::Project;pub use project_assignment::ProjectAssignment;pub use retainer::Retainer;pub use task::Task;pub use task_assignment::TaskAssignment;pub use time_entry::TimeEntry;pub use time_entry::NewTimeEntry;pub use user::User;pub use user_assignment::UserAssignment;pub use user_me::UserMe;