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
67
68
69
70
71
72
//! xurl — fast Rust client for the X (Twitter) API.
//!
//! Ships two consumable surfaces:
//!
//! - The `xr` binary, a high-level CLI for the X API.
//! - The `xurl` library exposed via the modules below. Downstream Rust
//! consumers build requests via [`api::ApiClient`], drive output through
//! [`output::OutputConfig`], pattern-match on [`error::XurlError`], and
//! persist auth state in [`store::TokenStore`].
//!
//! Four authentication paths are supported, selected per request from the
//! token store and environment:
//!
//! - **OAuth2 PKCE** (browser-driven or headless copy-paste) — every v2
//! user-scoped endpoint.
//! - **OAuth1 HMAC-SHA1** — legacy v1.1 endpoints and some v2 write paths.
//! - **Bearer (app-only)** — v2 read-only endpoints and search; set via
//! `XURL_BEARER_TOKEN`.
// `XurlError`'s largest variant (`AuthMethodMismatch`) carries multiple
// `String` and `Vec<String>` fields so agents can pattern-match on the
// envelope structure. Boxing the variant would change the public
// construction surface and break consumer code; allow the lint instead.
// ── Compile-time build and provenance metadata ──────────────────────────
//
// API spec consts are read from a checked-in sidecar at
// `vendor/spec-metadata.json` rather than derived from git context, so
// the values always describe the actual bytes that ship — uncommitted
// local refreshes, crates.io tarball installs, and downstream git-pin
// consumers all see identity that matches the bundled spec.
//
// `CRATE_GIT_SHA` is the only field that depends on git context; it
// resolves to `None` on crates.io tarball builds where `.git` is not
// present and `Some` on local development and CI builds.
/// Version of this crate, from `[package].version` in `Cargo.toml`.
pub const CRATE_VERSION: &str = env!;
/// Git commit SHA the crate was built from. `None` when the build had
/// no git context (e.g., `cargo install` from a crates.io tarball,
/// where `.git` is not present).
pub const CRATE_GIT_SHA: = option_env!;
/// X API OpenAPI spec version (`info.version` field) of the vendored
/// `vendor/x-api-openapi.json` at build time, read from the
/// `vendor/spec-metadata.json` sidecar. X bumps spec content without
/// bumping this field; pair with [`API_SPEC_SHA256`] when drift detection
/// matters.
pub const API_SPEC_VERSION: &str = env!;
/// SHA-256 of `vendor/x-api-openapi.json` at the time of its most recent
/// vendoring, read from `vendor/spec-metadata.json`. Drift-sensitive
/// identifier — changes every time X changes spec content, regardless of
/// [`API_SPEC_VERSION`].
pub const API_SPEC_SHA256: &str = env!;
/// Date (UTC, `YYYY-MM-DD`) the vendored OpenAPI spec was last refreshed
/// by `scripts/refresh-x-openapi.sh`, read from `vendor/spec-metadata.json`.
pub const API_SPEC_DATE: &str = env!;