ConversionTools Rust
This Conversion Tools API Rust client allows you to use the site API and convert files faster and more conveniently.
Site Conversion Tools allows you to convert files from one format to another.
To use the library, you will need a API-Token, which you can find in your profile.
How to use
You can find examples of using all functions in the ConversionTools-Rust-Examples repository
Get All Tasks
use conversion_tools_api::api::Api;
let object: Api = Api::new(String::from("Your Token"), String::from("Url"));
let tasks: Result<Value, Error> = object.get_tasks();
println!("{}", tasks.unwrap()); //print json response
Upload File
use conversion_tools_api::api::Api;
let object: Api = Api::new(String::from("Your Token"), String::from("Url"));
let result: Result<Value, Error> = object.upload_file(&"path");
println!("{}", result.unwrap()); //print json response
Create task (start converting)
use std::collections::HashMap;
use conversion_tools_api::api::Api;
let mut args: HashMap<&str, &str> = HashMap::new();
args.insert("orientation", "Portrait");
let type_convert: &str = "convert.jpg_to_pdf";
let object: Api = Api::new(String::from("Your Token"), String::from("Url"));
let result: Result<Value, Error> = object.create_task(&type_convert, &"file_id", &args);
println!("{}", result.unwrap()); //print json response
Get Task
use conversion_tools_api::api::Api;
let object: Api = Api::new(String::from("Your Token"), String::from("Url"));
let result: Result<Value, Error> = object.get_task(&"task_id");
println!("{}", result.unwrap()); //print json response
Download File
use conversion_tools_api::api::Api;
let object: Api = Api::new(String::from("Your Token"), String::from("Url"));
let result: Result<(), Error> = object.download_file(&"file_id", "output_path");