[][src]Struct rfesi::Esi

pub struct Esi {
    pub access_token: Option<String>,
    pub access_expiration: Option<u64>,
    pub refresh_token: Option<String>,
    // some fields omitted
}

Struct to interact with ESI.

Construct an instance of this struct using EsiBuilder.

Example

use rfesi::EsiBuilder;
// the struct must be mutable for some functionality
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();

Fields

access_token: Option<String>

The access token from ESI, if set.

access_expiration: Option<u64>

The expiration timestamp of the access token, if set.

refresh_token: Option<String>

The refresh token from ESI, if set.

Implementations

impl Esi[src]

pub async fn update_spec<'_>(&'_ mut self) -> EsiResult<()>[src]

Get the Swagger spec from ESI and store it in this struct.

If you are making use of the try_get_endpoint_for_op_id, then this function will be called there when needed (which should only really be when the struct is constructed unless the struct is kept in memory for a very long time). When using get_endpoint_for_op_id however, you are responsible for calling this function beforehand.

Example

esi.update_spec().await.unwrap();

pub fn get_authorize_url(&self) -> String[src]

Generate and return the URL required for the user to grant you an auth code.

Example

let url = esi.get_authorize_url();
// then send your user to that URL

pub async fn authenticate<'_, '_>(&'_ mut self, code: &'_ str) -> EsiResult<()>[src]

Authenticate with ESI, exchanging a code from the authorize flow for an access token that is used to make authenticated calls to ESI.

Note that this is one of the functions that requires the struct be mutable, as the struct mutates to include the resulting access token.

Example

esi.authenticate("abcdef").await.unwrap();

pub async fn query<'_, '_, '_, '_, '_, '_, '_, T: DeserializeOwned>(
    &'_ self,
    method: &'_ str,
    request_type: RequestType,
    endpoint: &'_ str,
    query: Option<&'_ [(&'_ str, &'_ str)]>,
    body: Option<&'_ str>
) -> EsiResult<T>
[src]

Make a request to ESI.

This is mainly used as the underlying function for this library when making calls to ESI; the other functions that you should primarily be using contain more functionality, including matching endpoint with deserialization struct, evaluating & replacing URL parameters, etc.

In the event that there is not a wrapper function for the endpoint that you want to use, you can use this function to make an API call without waiting for the library to be updated.

Example

#[derive(Deserialize)]
struct ReturnedData {}
let data: ReturnedData = esi.query("GET", RequestType::Public, "abc", None, None).await.unwrap();

pub async fn try_get_endpoint_for_op_id<'_, '_>(
    &'_ mut self,
    op_id: &'_ str
) -> EsiResult<String>
[src]

Resolve an operationId to a URL path utilizing the Swagger spec.

If the spec has not yet been retrieved when calling this function, an API call will be made to ESI to fetch that data (thus the async signature of this function). If you don't need that help (by explicitly making a call to update_spec prior) then you can use the get_endpoint_for_op_id function, which is synchronous.

Note that when making use of this function along with query, you are responsible for resolving any/all URL parameters that the endpoint may contain.

Example

let endpoint = esi
    .try_get_endpoint_for_op_id("get_alliances_alliance_id_contacts_labels")
    .await
    .unwrap();

pub fn get_endpoint_for_op_id(&self, op_id: &str) -> EsiResult<String>[src]

Resolve an operationId to a URL path utilizing the Swagger spec.

If the spec has not yet been retrieved when calling this function, this function will return an error.

Note that when making use of this function along with query, you are responsible for resolving any/all URL parameters that the endpoint may contain.

Example

let endpoint = esi.get_endpoint_for_op_id("get_alliances_alliance_id_contacts_labels").unwrap();

pub async fn get_whoami_info<'_>(&'_ self) -> EsiResult<WhoAmIResponse>[src]

Gets information on the currently-authenticated user.

pub fn group_alliance(&self) -> AllianceGroup[src]

Call endpoints under the "alliance" group in ESI.

pub fn group_assets(&self) -> AssetsGroup[src]

Call endpoints under the "Assets" group in ESI.

pub fn group_bookmarks(&self) -> BookmarksGroup[src]

Call endpoints under the "Bookmarks" group in ESI.

pub fn group_calendar(&self) -> CalendarGroup[src]

Call endpoints under the "Calendar" group in ESI.

pub fn group_character(&self) -> CharacterGroup[src]

Call endpoints under the "Character" group in ESI.

pub fn group_clones(&self) -> ClonesGroup[src]

Call endpoints under the "Clones" group in ESI.

pub fn group_contacts(&self) -> ContactsGroup[src]

Call endpoints under the "Contacts" group in ESI.

pub fn group_contracts(&self) -> ContractsGroup[src]

Call endpoints under the "Contracts" group in ESI.

pub fn group_corporation(&self) -> CorporationGroup[src]

Call endpoints under the "Corporation" group in ESI.

pub fn group_dogma(&self) -> DogmaGroup[src]

Call endpoints under the "Dogma" group in ESI.

pub fn group_faction_warfare(&self) -> FactionWarfareGroup[src]

Call endpoints under the "FactionWarfare" group in ESI.

pub fn group_fittings(&self) -> FittingsGroup[src]

Call endpoints under the "Fittings" group in ESI.

pub fn group_fleets(&self) -> FleetsGroup[src]

Call endpoints under the "Fleets" group in ESI.

pub fn group_incursions(&self) -> IncursionsGroup[src]

Call endpoints under the "Incursions" group in ESI.

pub fn group_industry(&self) -> IndustryGroup[src]

Call endpoints under the "Industry" group in ESI.

pub fn group_insurance(&self) -> InsuranceGroup[src]

Call endpoints under the "Insurance" group in ESI.

pub fn group_killmails(&self) -> KillmailsGroup[src]

Call endpoints under the "Killmails" group in ESI.

pub fn group_location(&self) -> LocationGroup[src]

Call endpoints under the "Location" group in ESI.

pub fn group_loyalty(&self) -> LoyaltyGroup[src]

Call endpoints under the "Loyalty" group in ESI.

pub fn group_mail(&self) -> MailGroup[src]

Call endpoints under the "Mail" group in ESI.

pub fn group_market(&self) -> MarketGroup[src]

Call endpoints under the "Market" group in ESI.

pub fn group_opportunities(&self) -> OpportunitiesGroup[src]

Call endpoints under the "Opportunities" group in ESI.

pub fn group_planetary_interaction(&self) -> PlanetaryInteractionGroup[src]

Call endpoints under the "PlanetaryInteraction" group in ESI.

pub fn group_routes(&self) -> RoutesGroup[src]

Call endpoints under the "Routes" group in ESI.

Call endpoints under the "Search" group in ESI.

pub fn group_skills(&self) -> SkillsGroup[src]

Call endpoints under the "Skills" group in ESI.

pub fn group_sovereignty(&self) -> SovereigntyGroup[src]

Call endpoints under the "Sovereignty" group in ESI.

pub fn group_status(&self) -> StatusGroup[src]

Call endpoints under the "Status" group in ESI.

pub fn group_universe(&self) -> UniverseGroup[src]

Call endpoints under the "Universe" group in ESI.

pub fn group_user_interface(&self) -> UserInterfaceGroup[src]

Call endpoints under the "UserInterface" group in ESI.

pub fn group_wallet(&self) -> WalletGroup[src]

Call endpoints under the "Wallet" group in ESI.

pub fn group_wars(&self) -> WarsGroup[src]

Call endpoints under the "Wars" group in ESI.

Trait Implementations

impl Clone for Esi[src]

impl Debug for Esi[src]

Auto Trait Implementations

impl !RefUnwindSafe for Esi

impl Send for Esi

impl Sync for Esi

impl Unpin for Esi

impl !UnwindSafe for Esi

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.