hackerone_api/lib.rs
1//! # hackerone-api
2//!
3//! Unofficial, dependency-light Rust client for the [HackerOne API][api] (v1).
4//!
5//! Built for the boring, reliable half of bug-bounty tooling: list your
6//! programs, pull scopes, read reports, file reports, comment, and change
7//! state — with HTTP Basic auth and no async runtime.
8//!
9//! ```no_run
10//! use hackerone_api::{Client, ReportQuery};
11//!
12//! fn main() -> Result<(), hackerone_api::Error> {
13//! let client = Client::new("api-identifier", "api-token");
14//!
15//! for program in client.programs()?.items() {
16//! println!("{:?}", program.handle);
17//! }
18//!
19//! let reports = client
20//! .reports(&ReportQuery::new().state("new").page(1, 25))?
21//! .into_items();
22//! println!("{} new reports", reports.len());
23//! Ok(())
24//! }
25//! ```
26//!
27//! ## Auth
28//!
29//! The API uses HTTP Basic auth: the *username* is your API token
30//! **identifier** and the *password* is the token **value**. Create one in
31//! your HackerOne account settings.
32//!
33//! ## Design
34//!
35//! - **Blocking, no async runtime.** [`ureq`] under the hood.
36//! - **Injectable transport.** The client is generic over [`Transport`], so
37//! tests use a mock and embedders can swap the HTTP stack.
38//! - **Forward-compatible types.** Domain structs keep the documented fields
39//! and stash unknown ones in a flattened `extra` map.
40//!
41//! ## Disclaimer
42//!
43//! This crate is unofficial and not affiliated with or endorsed by
44//! HackerOne. "HackerOne" is a trademark of its owner; the name is used only
45//! to describe what the library talks to.
46//!
47//! [api]: https://api.hackerone.com/
48
49#![forbid(unsafe_code)]
50#![warn(missing_docs)]
51
52mod client;
53mod error;
54mod transport;
55mod types;
56
57pub use client::{Client, DEFAULT_BASE_URL};
58pub use error::{ApiError, Error, Result};
59pub use transport::{Method, Request, Response, Transport, UreqTransport};
60pub use types::{
61 CollectionDoc, CreateReport, Links, Meta, Page, Program, Report, ReportQuery, ReportState,
62 Resource, Severity, SeverityRating, SingleDoc, StructuredScope, User, Weakness,
63};