rovenue/
lib.rs

1// UniFFI-generated scaffolding triggers this lint; suppress it crate-wide.
2#![allow(clippy::empty_line_after_doc_comments)]
3// Doc coverage (ROADMAP §11) is gated by the ratchet, not by rustc:
4// scripts/sdk-doc-coverage.mjs fails CI when core-rs drops below the floor
5// in scripts/sdk-doc-coverage.json, so coverage can only go up.
6//
7// This crate used to carry `#![warn(missing_docs)]` as well. With ~520 public
8// items undocumented, that made `cargo clippy -- -D warnings` (the release
9// gate in release-sdk.yml, and the plain local invocation) fail on every
10// commit — a gate that can never pass gates nothing. The rustdoc-visible gap
11// is still one command away, since nothing here overrides a command-line
12// lint level:
13//
14//     cargo clippy -p librovenue -- -W missing_docs
15
16pub mod api;
17pub mod attributes;
18pub mod cache;
19pub mod config;
20pub mod entitlements;
21pub mod error;
22pub mod events;
23pub mod exposure;
24pub mod funnel;
25pub mod identify;
26pub mod identity;
27pub mod logging;
28pub mod observer;
29pub mod offerings;
30pub mod placements;
31pub mod polling;
32pub mod purchases;
33pub mod receipts;
34pub mod remote_config;
35pub mod sessions;
36pub mod time;
37pub mod transport;
38pub mod version;
39pub mod virtual_currencies;
40
41pub use api::RovenueCore;
42pub use config::Config;
43pub use entitlements::Entitlement;
44pub use error::{ErrorKind, RovenueError, RovenueErrorFfi, RovenueResult};
45pub use events::{EventEnvelope, FunnelContext, IdentityContext, EVENT_WIRE_VERSION};
46pub use funnel::{
47    ClaimInstallParams, FunnelClaimBus, FunnelClaimListener, FunnelClaimResult, FunnelClient,
48    FunnelEffect, FunnelOfferKind, FunnelPackageOffer, FunnelPackagePrice, FunnelPeriodUnit,
49    FunnelSession, FunnelStep,
50};
51pub use identify::{IdentifyClient, IdentifyResult};
52pub use identity::User;
53pub use logging::{LogLevel, LogRecord, LogSink};
54pub use observer::{ChangeEvent, Observer};
55pub use offerings::{CoreOffering, CoreOfferingProduct, CoreOfferings};
56pub use placements::{CoreFunnel, CorePresentedContext, FunnelProjectLinks};
57pub use purchases::AppleOfferSignature;
58pub use receipts::ReceiptResult;
59pub use remote_config::{ExperimentAssignment, RemoteConfigReader};
60pub use sessions::SessionEventKind;
61pub use version::SDK_VERSION;
62
63pub fn sdk_version() -> String {
64    SDK_VERSION.to_string()
65}
66
67/// Open a NON-EMITTING funnel preview session — for preview tools only
68/// (the operator apps' "Test on device"). Needs no `RovenueCore`, no API
69/// key and no event queue; see [`FunnelSession::open_preview`].
70pub fn open_preview_funnel(
71    payload_json: String,
72    locale: String,
73    today: Option<String>,
74) -> RovenueResult<std::sync::Arc<FunnelSession>> {
75    FunnelSession::open_preview(payload_json, locale, today).map(std::sync::Arc::new)
76}
77
78/// The core's retryable verdict for `kind`, exported so the façades read the
79/// one table instead of keeping their own copy.
80pub fn error_kind_is_retryable(kind: ErrorKind) -> bool {
81    kind.is_retryable()
82}
83
84uniffi::include_scaffolding!("librovenue");