56 releases (14 stable)

2.2.0 Apr 7, 2024
2.1.2 Nov 14, 2023
2.1.1 Mar 14, 2023
2.0.1 May 18, 2022
0.0.5 May 29, 2019

#59 in HTTP client

Download history 9/week @ 2024-02-16 117/week @ 2024-02-23 22/week @ 2024-03-01 15/week @ 2024-03-08 18/week @ 2024-03-15 12/week @ 2024-03-22 39/week @ 2024-03-29 142/week @ 2024-04-05

213 downloads per month
Used in 2 crates

MIT/Apache

235KB
5K SLoC

bodhi REST API client

crates.io crates.io crates.io docs.rs

This crate contains rust bindings for the bodhi REST API as documented by the official API docs.

The crate is based on the fedora crate for authenticated session support, which uses the reqwest crate under the hood for making network calls, and serde for (de)serializing JSON and x-www-urlencoded data.

Reporting bugs

The code makes some assumptions around the behaviour of bodhi servers. If those assumptions turn out to be wrong (either because the implementation is wrong, or because the server behaviour has changed), then that is considered a bug. Also, there have been instances where the schemas of responses and accepted requests has changed. If that's the case, then that's also a bug. If you encounter (de)serialization issues, please open a bug noting the bodhi server version, and paste the failure message (which should contain the reason for the (de)serialization failure, e.g. missing / renamed fields).

Library design

This library tries to do error handling where reasonable, but passes server- or network-related errors through to the caller. For example, when a bodhi server is under heavy load, it sometimes returns garbage responses with empty bodies. On the other hand, there might just be a persistent network issue that makes a server request fail or time out. These are not handled by the library, but are transparently wrapped and returned. If necessary, the request can be retried by the caller. This library only implements a simple retry logic for transient failures, not for persistent client or server issues.

However, the BodhiClient only takes queries by reference, so retrying a query does not even involve copying data, so this is very cheap.

Current status

  • All GET requests are implemented, and all actual API responses should successfully deserialize.
  • All POST requests are implemented for creating and editing items, except for creating and editing releases.

Test coverage

Tests should pass for every commit that gets pushed to git. However, currently some tests either require internet access to check some assumptions for server behaviour, or require test data which is too big to be committed into git.

For this reason, the following feature flags determine which tests are compiled and run:

  • offline-tests: tests able to run offline, without prerequisites (enabled by default)
  • online-tests: tests that require internet access (for checking bodhi server behavior)
  • data-tests: tests that require data files (data is not part of the git repository or published crates and needs to be downloaded separately, but the tests themselves can run offline)

Examples

The examples directory contains a few example applications to test and showcase some of the crate's functionality.

Dependencies

~10–26MB
~381K SLoC