1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Official Rust SDK for the [API2Convert](https://www.api2convert.com) file-conversion API.
//!
//! One call uploads (or references a URL), starts the job, polls it to
//! completion and hands you the result:
//!
//! ```no_run
//! use api2convert::{Api2Convert, ConvertOptions};
//!
//! # fn main() -> Result<(), api2convert::Api2ConvertError> {
//! let client = Api2Convert::new("YOUR_API_KEY")?;
//!
//! // Convert a local file and save the result into a directory.
//! let result = client.convert("photo.heic", "jpg")?;
//! let path = result.save("out/", None)?;
//! println!("saved {}", path.display());
//!
//! // Convert a remote URL with target-specific options.
//! let result = client.convert_with(
//! "https://example.com/input.png",
//! "jpg",
//! ConvertOptions::new().option("quality", 85),
//! )?;
//! let bytes = result.contents(None)?;
//! # let _ = bytes;
//! # Ok(())
//! # }
//! ```
//!
//! This crate is one of the official API2Convert SDKs (PHP, Python, Java,
//! Node.js, Go, Ruby, Rust) that implement the same language-agnostic contract
//! (`docs/SDK_CONTRACT.md`) and version together.
//!
//! ## Errors
//!
//! Every fallible call returns [`Result`], whose error is [`Api2ConvertError`].
//! Match it to react to specific conditions:
//!
//! ```no_run
//! # use api2convert::{Api2Convert, Api2ConvertError};
//! # fn f(client: &Api2Convert) {
//! match client.convert("in.png", "not-a-format") {
//! Ok(result) => { let _ = result; }
//! Err(Api2ConvertError::Validation(e)) => eprintln!("bad request: {}", e.message),
//! Err(Api2ConvertError::RateLimit { retry_after, .. }) => {
//! eprintln!("rate limited; retry after {:?}s", retry_after)
//! }
//! Err(e) => eprintln!("failed: {e}"),
//! }
//! # }
//! ```
//!
//! ## Security
//!
//! Account key, per-job upload token and download password ride in custom
//! `X-Api2convert-*` headers. Secret-bearing requests never follow redirects (only the
//! self-contained, no-secret download path does), uploads use the per-job token
//! (never the account key), and no secret ever appears in an error message. See
//! `SECURITY.md`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use VERSION;
pub use ;
// The pluggable transport seam — implement [`HttpSender`] to bring your own
// client or a test fake; [`Sleeper`] / [`Rng`] make backoff injectable.
pub use ;