Skip to main content

esi_openapi/
lib.rs

1//! esi-openapi - Rust for ESI, based on the OpenAPI spec (fork of rfesi)
2//!
3//! [ESI] bindings in Rust for [EVE Online].
4//!
5//! This crate provides helpful utilities and bindings for interacting
6//! with ESI, including the SSO auth flow and making public and
7//! authenticated calls to ESI without having to deal with JSON yourself.
8//!
9//! To make an EVE third-party application, visit the [developers site].
10//!
11//! # Example of the authorization flow (https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html)
12//!
13//! ```rust,no_run
14//! use esi_openapi::prelude::*;
15//!
16//! fn create_esi() -> EsiResult<Esi> {
17//!     // Create a new struct from the builder. These parameters
18//!     // all come from your third-party app on the developers site.
19//!     EsiBuilder::new()
20//!         .user_agent("some user agent")
21//!         .client_id("your_client_id")
22//!         .client_secret("your_client_secret")
23//!         .callback_url("your_callback_url")
24//!         .build()
25//! }
26//!
27//! fn get_authorize_url(esi: &Esi) -> AuthenticationInformation {
28//!     // Direct your user to the tuple's first item, a URL, and have a web service listening
29//!     // at the callback URL that you specified in the EVE application. The second item is
30//!     // the random state variable, which is up to you to check.
31//!     esi.get_authorize_url().unwrap()
32//! }
33//!
34//! async fn authenticate_user(esi: &mut Esi, code: &str) -> EsiResult<()> {
35//!     // The `code` value here comes from the URL parameters your service
36//!     // is sent following a user's successful SSO.
37//!     //
38//!     // Note that most functions in this crate are async, so you'll need
39//!     // to handle those appropriately.
40//!     //
41//!     // Additionally, this function requires a mutable reference to the
42//!     // struct, as the instance will self-mutate with the additional information
43//!     // from ESI (assuming a successful authorization).
44//!     //
45//!     // Once the instance has the auth information, you can use it to make
46//!     // authenticated requests to ESI for the user.
47//!     esi.authenticate(code, None).await?;
48//!     Ok(())
49//! }
50//! ```
51//! # Example of the authorization flow (Using PKCE/Application flow - See https://docs.esi.evetech.net/docs/sso/native_sso_flow.html)
52//!
53//! ```rust,no_run
54//! use esi_openapi::prelude::*;
55//!
56//! fn create_esi() -> EsiResult<Esi> {
57//!     // Create a new struct from the builder. These parameters
58//!     // all come from your third-party app on the developers site.
59//!     EsiBuilder::new()
60//!         .user_agent("some user agent")
61//!         .client_id("your_client_id")
62//!         .callback_url("your_callback_url")
63//!         .enable_application_authentication(true)
64//!         .build()
65//! }
66//!
67//! fn get_authorize_url(esi: &Esi) -> AuthenticationInformation {
68//!     // Direct your user to the tuple's first item, a URL, and have a web service listening
69//!     // at the callback URL that you specified in the EVE application. The second item is
70//!     // the random state variable, which is up to you to check.
71//!     esi.get_authorize_url().unwrap()
72//! }
73//!
74//! async fn authenticate_user(esi: &mut Esi, code: &str, pkce_verifier: PkceVerifier) -> EsiResult<()> {
75//!     // The `code` value here comes from the URL parameters your service
76//!     // is sent following a user's successful SSO.
77//!     // The 'pkce_verifier' is randomly generated and returned by the previously called
78//!     // 'get_authorize_url()' method, in the AuthenticationInformation struct.
79//!     //
80//!     // Note that most functions in this crate are async, so you'll need
81//!     // to handle those appropriately.
82//!     //
83//!     // Additionally, this function requires a mutable reference to the
84//!     // struct, as the instance will self-mutate with the additional information
85//!     // from ESI (assuming a successful authorization).
86//!     //
87//!     // Once the instance has the auth information, you can use it to make
88//!     // authenticated requests to ESI for the user.
89//!     esi.authenticate(code, Some(pkce_verifier)).await?;
90//!     Ok(())
91//! }
92//! ```
93//!
94//! [ESI]: http://esi.evetech.net
95//! [EVE Online]: https://www.eveonline.com
96//! [developers site]: https://developers.eveonline.com
97
98#![deny(clippy::all)]
99#![deny(missing_docs)]
100
101#[macro_use]
102mod macros;
103
104mod builders;
105mod client;
106mod errors;
107pub mod groups;
108#[cfg(feature = "validate_jwt")]
109mod jwt_util;
110mod legacy;
111mod pkce;
112pub mod prelude;
113pub mod spec;