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
//! This library provides a Rust-y wrapper around the bodhi REST API.
//!
//! [bodhi] is the web service for managing updates for fedora-based linux
//! distributions. It provides a REST API for querying its database, and
//! for creating new updates, comments, etc.
//!
//! [bodhi]: https://github.com/fedora-infra/bodhi
//!
//! The library is structured like this:
//!
//! - `BodhiService`, which contains all information related to connecting
//!   to a remote bodhi instance
//! - a set of `*Query` structs and implementations, which wrap the REST API
//!   with a Rust-y API
//! - data type definitions, used for deserializing JSON responses with [serde]
//!
//! [serde]: https://docs.rs/serde
//!
//! ## Data type definitions
//!
//! The data type definitions used for deserializing the server JSON responses
//! are contained in the `data` module. Some definitions are used only
//! internally (for example, for deserializing paginated results), and are not
//! publicly exported. They are located next to the `Query` they are used for.
//!
//! ## Rust API Convenience
//!
//! For convenience, some enumerated types that are just strings in the actual
//! REST API are wrapped as proper `enum` types, and queries that return
//! paginated results are not exposed to users of this library, but handled
//! completely internally to return a union of all result pages.
//!
//! **NOTE**: Some `Query` modifiers can be called multiple times (methods
//! marked with plural names), and other filters are mutually exclusive and
//! should only be called *once* on a query (methods marked with singular name).
//! If a filter that only allows one argument is called more than once, the last
//! supplied argument will override arguments that were supplied to previous
//! method calls.
//!
//! ## Usage
//!
//! To query a remote bodhi instance, first construct a `BodhiService` instance
//! with the desired properties (server URL, request timeout, retry limit).
//!
//! Then, construct the required queries, and run the query against the
//! `BodhiService` instance. In theory, this would let you run the same query
//! multiple times, possibly against different server instances or with
//! different connection settings:
//!
//! ```
//! let bodhi = bodhi::BodhiService::new(bodhi::FEDORA_BODHI_URL.to_string());
//!
//! let package_query = bodhi::PackageQuery::new().name("rust".to_string());
//! let packages = package_query.query(&bodhi).unwrap();
//! ```

pub mod data;
pub mod query;
pub mod service;

pub use data::*;
pub use query::*;
pub use service::*;

#[cfg(test)]
mod tests;