Skip to main content

concur_api/
lib.rs

1//! # SAP Concur API Client for Rust
2//!
3//! A typed, async client for SAP Concur REST APIs. This crate targets the
4//! latest generally available v4 / v4.1 endpoints and avoids deprecated v3
5//! APIs where a v4 successor exists.
6//!
7//! ## Supported APIs
8//!
9//! * Authentication / OAuth2 (`oauth2/v0/token`)
10//! * Identity v4.1 (`profile/identity/v4.1`)
11//! * Expense Reports v4
12//! * Expenses (entries) v4
13//! * Expense Workflow v4
14//! * Lists v4 and List Items v4
15//! * Receipts v4
16//! * Travel Request v4, Request Workflow v4, Expected Expenses v4, Allocations v4
17//! * Cards v4 and Card Transactions v4
18//! * Purchase Request v4
19//! * Invoice Pay v4
20//! * Event Subscription Service (ESS) v4
21//!
22//! ## Example
23//!
24//! ```no_run
25//! use concur_api::{ClientConfig, ConcurClient};
26//! use concur_api::auth::{OAuth2TokenManager, Grant};
27//!
28//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
29//! let config = ClientConfig::default();
30//! let client = ConcurClient::new(config)?;
31//! let manager = OAuth2TokenManager::new(
32//!     "https://us.api.concursolutions.com/oauth2/v0/token",
33//!     "client-id",
34//!     "client-secret",
35//!     Grant::ClientCredentials { scope: Some("expense.report.read".to_string()) },
36//! );
37//! let client = client.with_token_manager(manager);
38//! let reports = concur_api::api::expense::ReportsApi::new(&client);
39//! # Ok(())
40//! # }
41//! ```
42
43pub mod api;
44pub mod auth;
45pub mod client;
46pub mod error;
47pub mod models;
48
49pub use client::{ClientConfig, ConcurClient};
50pub use error::{ConcurError, Result};
51
52/// Convenience re-exports for the most common types.
53pub mod prelude {
54    pub use crate::api::expense::{
55        CreateExpense, CreateReport, ExpensesApi, ReportsApi, WorkflowApi,
56    };
57    pub use crate::api::identity::IdentityApi;
58    pub use crate::api::lists::{ListItemsApi, ListsApi};
59    pub use crate::api::receipts::ReceiptsApi;
60    pub use crate::api::request::RequestApi;
61    pub use crate::auth::{Grant, OAuth2TokenManager, StaticToken, TokenManager};
62    pub use crate::client::{ClientConfig, ConcurClient};
63    pub use crate::error::{ConcurError, Result};
64}