pub struct EsiBuilder { /* private fields */ }Expand description
Builder for the Esi struct.
§Example
let mut esi = EsiBuilder::new()
.user_agent("some user agent")
.client_id("your_client_id")
.client_secret("your_client_secret")
.callback_url("your_callback_url")
.build()
.unwrap();§Overriding the API specification
If you will be creating multiple struct instances, you will probably run into the issue of needing to retrieve the API spec on each. Given that this operation is fairly expensive (certainly as far as the rest of the API endpoints that EVE makes available), this builder supports setting that struct:
let mut esi = EsiBuilder::new()
.user_agent("some user agent")
.spec(Some(your_spec))
.build()
.unwrap();Note that this “spec” function is just another builder function; you can make use it alongside all of the others. Note also that this is entirely optional: if you don’t mind retrieving the spec from ESI on each of your struct instances, you can safely ignore this.
§Not including client info
If you are only making calls to non-authenticated endpoints, then you don’t need to make use of the authentication flow, which means you don’t need a client ID, client secret, and callback URL. In this case, you can construct your client without those parameters:
let mut esi = EsiBuilder::new()
.user_agent("some user agent")
.build()
.unwrap();Note that you still need to set the user agent, as this is good API usage behavior.
Implementations§
Source§impl EsiBuilder
impl EsiBuilder
Sourcepub fn compatibility_date(self, val: &str) -> Self
pub fn compatibility_date(self, val: &str) -> Self
Set the compatibility header to use.
Will default to a hardcoded value if not set.
Sourcepub fn client_secret(self, val: &str) -> Self
pub fn client_secret(self, val: &str) -> Self
Set the client_secret (https://docs.esi.evetech.net/docs/sso/web_based_sso_flow.html).
Sourcepub fn enable_application_authentication(self, val: bool) -> Self
pub fn enable_application_authentication(self, val: bool) -> Self
Enable PKCE Authentication flow for Applications (https://docs.esi.evetech.net/docs/sso/native_sso_flow.html)
Sourcepub fn callback_url(self, val: &str) -> Self
pub fn callback_url(self, val: &str) -> Self
Set the callback_url.
Sourcepub fn base_api_url(self, val: &str) -> Self
pub fn base_api_url(self, val: &str) -> Self
Set the base_api_url.
Set the authorize_url.
Sourcepub fn access_token(self, val: Option<&str>) -> Self
pub fn access_token(self, val: Option<&str>) -> Self
Set the access_token.
Sourcepub fn access_expiration(self, val: Option<i64>) -> Self
pub fn access_expiration(self, val: Option<i64>) -> Self
Set the access_expiration.
Sourcepub fn refresh_token(self, val: Option<&str>) -> Self
pub fn refresh_token(self, val: Option<&str>) -> Self
Set the refresh_token.
Sourcepub fn user_agent(self, val: &str) -> Self
pub fn user_agent(self, val: &str) -> Self
Set the user_agent.
Sourcepub fn http_timeout(self, val: Option<u64>) -> Self
pub fn http_timeout(self, val: Option<u64>) -> Self
Set the timeout to use in millis when sending HTTP requests.
Will default to 60,000 (1 minute) if not set.
Sourcepub fn spec(self, spec: Option<Spec>) -> Self
pub fn spec(self, spec: Option<Spec>) -> Self
Explicitly set the OpenAPI specification.
Allows copying the spec from another Esi struct
or other source, avoiding fetching the spec from
ESI again. May be useful given the runtime cost
of retrieving the spec.
Be aware of the potential for out-of-date data.
Trait Implementations§
Source§impl Clone for EsiBuilder
impl Clone for EsiBuilder
Source§impl Debug for EsiBuilder
impl Debug for EsiBuilder
Source§impl Default for EsiBuilder
impl Default for EsiBuilder
Source§impl<'de> Deserialize<'de> for EsiBuilder
impl<'de> Deserialize<'de> for EsiBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EsiBuilder
Source§impl PartialEq for EsiBuilder
impl PartialEq for EsiBuilder
Source§impl Serialize for EsiBuilder
impl Serialize for EsiBuilder
impl StructuralPartialEq for EsiBuilder
Auto Trait Implementations§
impl Freeze for EsiBuilder
impl RefUnwindSafe for EsiBuilder
impl Send for EsiBuilder
impl Sync for EsiBuilder
impl Unpin for EsiBuilder
impl UnsafeUnpin for EsiBuilder
impl UnwindSafe for EsiBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.