ironthree / pagure-rs

Created 9 months ago
Maintained by decathorpe
pagure REST API bindings for Rust
Members 2
Fabio Valentini committed 17 days ago

rust bindings for the pagure API

This project contains work-in-progress rust bindings for the pagure API as documented at https://pagure.io/api/0/.

library design

Every query implements the common Query trait, which can be treated like a generic template. Add the missing return type definitions for serde and implement the trait methods, and you're done - everything else is handled by the default method implementations in the Query trait or in the PagureClient that wraps a reqwest::blocking::Client with the necessary settings.

API query URLs contain both a "path" element and optional query strings - the path element is simply filled in as a string, and the query string is deserialized to x-www-form-urlencoded format from the query struct with serde_url_params.

The returned JSON responses are deserialized into native data types with serde_json (if necessary, with internal wrapper types if the API returns extra information alongside the result, i.e. pagination or request metadata).

tests

For now, there are only some basic tests for the implemented queries, which all require an internet connection. Once there are both "offline" and "online" tests, they will be split into two groups with features, and only offline tests will be enabled by default (similar to how this is handled in the bodhi-rs project).