taskfast_client/lib.rs
1// SPDX-License-Identifier: MIT
2//! TaskFast typed HTTP client.
3//!
4//! The `api` module is generated from `spec/openapi.yaml` at build time by
5//! `build.rs`. The rewritten spec (error-alias folding) is produced in-memory
6//! via `xtask::normalize_spec` so the on-disk spec stays authoritative.
7//!
8//! Use [`api::Client`] to issue requests; cross-cutting concerns
9//! ([`errors::Error`], [`retry::with_backoff`]) live in sibling modules and
10//! will be composed over the generated client in a follow-up.
11
12pub mod client;
13pub mod corr;
14pub mod errors;
15pub mod retry;
16
17pub use client::{
18 map_api_error, put_presigned_upload, ArtifactUpload, NetworkConfigEntry, NetworkConfigResponse,
19 TaskFastClient, UserProfile,
20};
21// `record_corr` is referenced by the generated client as `crate::record_corr`
22// (wired as progenitor's post-hook in build.rs), so it must live at the root.
23pub use corr::{record_corr, record_corr_response, take_last_corr};
24pub use errors::{Error, Result};
25pub use retry::{with_backoff, RetryPolicy};
26
27/// Re-exported so downstream crates can call the generated client's
28/// `baseurl()` / `client()` accessors — progenitor 0.11+ moved them off the
29/// inherent impl into this trait, which must be in scope at the call site.
30pub use progenitor_client::ClientInfo;
31
32/// Convert an `i64` page limit (as parsed from the CLI) into the
33/// `Option<NonZeroU64>` the generated client now requires: progenitor 0.14 /
34/// typify encodes the spec's `minimum: 1` in the type. Non-positive limits
35/// map to `None`, letting the server apply its default page size.
36pub fn page_limit(n: i64) -> Option<std::num::NonZeroU64> {
37 u64::try_from(n).ok().and_then(std::num::NonZeroU64::new)
38}
39
40/// Generated typed client + DTOs for the TaskFast OpenAPI spec.
41///
42/// Produced by `progenitor` from `spec/openapi.yaml` at build time; see
43/// `build.rs` and `xtask::normalize_spec`. Do not edit by hand — regenerate
44/// by changing the spec.
45#[allow(
46 clippy::all,
47 clippy::pedantic,
48 dead_code,
49 irrefutable_let_patterns,
50 missing_docs,
51 non_camel_case_types,
52 non_snake_case,
53 renamed_and_removed_lints,
54 unknown_lints,
55 rustdoc::broken_intra_doc_links,
56 rustdoc::invalid_html_tags
57)]
58pub mod api {
59 include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
60}