Skip to main content

typesafe_client/
lib.rs

1#![cfg_attr(feature = "http", doc = include_str!("../README.md"))]
2#![cfg_attr(
3    not(feature = "http"),
4    doc = "Typed Rust client for the TypeSafe System One API (unofficial).\n\n\
5           This build has no `http` feature: it provides the request and response types, question \
6           builders, validation and the [`SystemOne`] trait. See the \
7           [README](https://github.com/JedimEmO/typesafe-client) for the full guide."
8)]
9#![cfg_attr(docsrs, feature(doc_cfg))]
10#![warn(missing_docs)]
11
12mod answer;
13mod api_error;
14mod choice_options;
15pub mod constants;
16mod content;
17mod error;
18mod question;
19mod request;
20mod retry;
21mod system_one;
22
23#[cfg(feature = "http")]
24pub mod client;
25#[cfg(feature = "fake")]
26pub mod fake;
27
28pub use answer::{
29    Answer, ChoiceAnswer, ModelList, ModelMetadata, NoulAnswer, ReadAnswer, ScoreAnswer,
30    SystemOneResponse, Usage,
31};
32pub use api_error::{ApiError, ApiErrorKind, FieldError};
33#[doc(hidden)]
34pub use choice_options::__str_eq;
35pub use choice_options::{ChoiceOptions, EnumChoice, TypedChoice, ValueChoice};
36pub use content::Content;
37pub use error::{AnswerError, Error, TransportError, ValidationError};
38pub use question::{
39    ChoiceQuestion, NoulCriteria, NoulQuestion, Question, QuestionKind, ScoreQuestion,
40};
41pub use request::{
42    IntoQuestion, MAX_CHOICE_OPTIONS, MAX_SCORE_LEVELS, MIN_SCORE_LEVELS, QuestionKey, Questions,
43    SystemOneRequest,
44};
45pub use retry::RetryPolicy;
46pub use system_one::{CallOptions, SystemOne, SystemOneCall};
47
48#[cfg(feature = "http")]
49pub use client::{Client, ClientBuilder};
50/// Re-exported so a custom client for [`ClientBuilder::http_client`] uses the same version.
51#[cfg(feature = "http")]
52pub use reqwest;
53
54/// Re-exported for implementing [`SystemOne`] without adding the dependency yourself.
55pub use async_trait::async_trait;
56/// Re-exported because [`ChoiceQuestion::criteria`] and answer maps are [`indexmap::IndexMap`]s.
57pub use indexmap;