EveESI.Connection (EveESI v1.0.0)

View Source

Handle Tesla connections for EveESI.

Additional middleware can be set in the compile-time or runtime configuration:

config :tesla, EveESI.Connection,
  base_url: "https://esi.evetech.net/latest",
  adapter: Tesla.Adapter.Hackney

The default base URL can also be set as:

config :eve_esi,
  :base_url, "https://esi.evetech.net/latest"

Summary

Types

The list of options that can be passed to new/1.

An arity-1 function or module/function tuple specification which, given a list of scopes, obtains an OAuth2 token.

Functions

Returns the default adapter for this API.

authorization(token, scopes \\ ["esi-alliances.read_contacts.v1", "esi-assets.read_assets.v1", "esi-assets.read_corporation_assets.v1", "esi-bookmarks.read_character_bookmarks.v1", "esi-bookmarks.read_corporation_bookmarks.v1", "esi-calendar.read_calendar_events.v1", "esi-calendar.respond_calendar_events.v1", "esi-characters.read_agents_research.v1", "esi-characters.read_blueprints.v1", "esi-characters.read_contacts.v1", "esi-characters.read_corporation_roles.v1", "esi-characters.read_fatigue.v1", "esi-characters.read_fw_stats.v1", "esi-characters.read_loyalty.v1", "esi-characters.read_medals.v1", "esi-characters.read_notifications.v1", "esi-characters.read_opportunities.v1", "esi-characters.read_standings.v1", "esi-characters.read_titles.v1", "esi-characters.write_contacts.v1", "esi-clones.read_clones.v1", "esi-clones.read_implants.v1", "esi-contracts.read_character_contracts.v1", "esi-contracts.read_corporation_contracts.v1", "esi-corporations.read_blueprints.v1", "esi-corporations.read_contacts.v1", "esi-corporations.read_container_logs.v1", "esi-corporations.read_corporation_membership.v1", "esi-corporations.read_divisions.v1", "esi-corporations.read_facilities.v1", "esi-corporations.read_fw_stats.v1", "esi-corporations.read_medals.v1", "esi-corporations.read_standings.v1", "esi-corporations.read_starbases.v1", "esi-corporations.read_structures.v1", "esi-corporations.read_titles.v1", "esi-corporations.track_members.v1", "esi-fittings.read_fittings.v1", "esi-fittings.write_fittings.v1", "esi-fleets.read_fleet.v1", "esi-fleets.write_fleet.v1", "esi-industry.read_character_jobs.v1", "esi-industry.read_character_mining.v1", "esi-industry.read_corporation_jobs.v1", "esi-industry.read_corporation_mining.v1", "esi-killmails.read_corporation_killmails.v1", "esi-killmails.read_killmails.v1", "esi-location.read_location.v1", "esi-location.read_online.v1", "esi-location.read_ship_type.v1", "esi-mail.organize_mail.v1", "esi-mail.read_mail.v1", "esi-mail.send_mail.v1", "esi-markets.read_character_orders.v1", "esi-markets.read_corporation_orders.v1", "esi-markets.structure_markets.v1", "esi-planets.manage_planets.v1", "esi-planets.read_customs_offices.v1", "esi-search.search_structures.v1", "esi-skills.read_skillqueue.v1", "esi-skills.read_skills.v1", "esi-ui.open_window.v1", "esi-ui.write_waypoint.v1", "esi-universe.read_structures.v1", "esi-wallet.read_character_wallet.v1", "esi-wallet.read_corporation_wallets.v1"])

Returns an authentication middleware tuple for a Tesla client that sets the authorization header to the value of the provided bearer token. If the token is provided as a function of arity one, it will be called with a list of requested scopes that will obtain an OAuth2 token.

Returns fully configured middleware for passing to Tesla.client/2.

Configure a client with no authentication.

Configure a client that may have authentication.

Configure a client using bearer authentication with scopes.

Forward requests to Tesla.

Types

options()

@type options() :: [
  base_url: String.t(),
  user_agent: String.t(),
  token: String.t() | token_fetcher(),
  token_scopes: [String.t()]
]

The list of options that can be passed to new/1.

  • base_url: Overrides the base URL on a per-client basis.
  • user_agent: Overrides the User-Agent header.
  • token: An OAuth2 token or a token fetcher function.
  • token_scopes: A list of OAuth2 scope strings for use with a token fetcher function.

token_fetcher()

@type token_fetcher() :: (scopes :: [String.t()] -> String.t()) | {module(), atom()}

An arity-1 function or module/function tuple specification which, given a list of scopes, obtains an OAuth2 token.

Functions

adapter()

Returns the default adapter for this API.

authorization(token, scopes \\ ["esi-alliances.read_contacts.v1", "esi-assets.read_assets.v1", "esi-assets.read_corporation_assets.v1", "esi-bookmarks.read_character_bookmarks.v1", "esi-bookmarks.read_corporation_bookmarks.v1", "esi-calendar.read_calendar_events.v1", "esi-calendar.respond_calendar_events.v1", "esi-characters.read_agents_research.v1", "esi-characters.read_blueprints.v1", "esi-characters.read_contacts.v1", "esi-characters.read_corporation_roles.v1", "esi-characters.read_fatigue.v1", "esi-characters.read_fw_stats.v1", "esi-characters.read_loyalty.v1", "esi-characters.read_medals.v1", "esi-characters.read_notifications.v1", "esi-characters.read_opportunities.v1", "esi-characters.read_standings.v1", "esi-characters.read_titles.v1", "esi-characters.write_contacts.v1", "esi-clones.read_clones.v1", "esi-clones.read_implants.v1", "esi-contracts.read_character_contracts.v1", "esi-contracts.read_corporation_contracts.v1", "esi-corporations.read_blueprints.v1", "esi-corporations.read_contacts.v1", "esi-corporations.read_container_logs.v1", "esi-corporations.read_corporation_membership.v1", "esi-corporations.read_divisions.v1", "esi-corporations.read_facilities.v1", "esi-corporations.read_fw_stats.v1", "esi-corporations.read_medals.v1", "esi-corporations.read_standings.v1", "esi-corporations.read_starbases.v1", "esi-corporations.read_structures.v1", "esi-corporations.read_titles.v1", "esi-corporations.track_members.v1", "esi-fittings.read_fittings.v1", "esi-fittings.write_fittings.v1", "esi-fleets.read_fleet.v1", "esi-fleets.write_fleet.v1", "esi-industry.read_character_jobs.v1", "esi-industry.read_character_mining.v1", "esi-industry.read_corporation_jobs.v1", "esi-industry.read_corporation_mining.v1", "esi-killmails.read_corporation_killmails.v1", "esi-killmails.read_killmails.v1", "esi-location.read_location.v1", "esi-location.read_online.v1", "esi-location.read_ship_type.v1", "esi-mail.organize_mail.v1", "esi-mail.read_mail.v1", "esi-mail.send_mail.v1", "esi-markets.read_character_orders.v1", "esi-markets.read_corporation_orders.v1", "esi-markets.structure_markets.v1", "esi-planets.manage_planets.v1", "esi-planets.read_customs_offices.v1", "esi-search.search_structures.v1", "esi-skills.read_skillqueue.v1", "esi-skills.read_skills.v1", "esi-ui.open_window.v1", "esi-ui.write_waypoint.v1", "esi-universe.read_structures.v1", "esi-wallet.read_character_wallet.v1", "esi-wallet.read_corporation_wallets.v1"])

@spec authorization(String.t() | token_fetcher(), [String.t()]) ::
  Tesla.Client.middleware()

Returns an authentication middleware tuple for a Tesla client that sets the authorization header to the value of the provided bearer token. If the token is provided as a function of arity one, it will be called with a list of requested scopes that will obtain an OAuth2 token.

Parameters

  • token: a String or a function of arity one. This value, or the result of the function call, will be set as a bearer token in the authorization header.

  • scopes: an optional list of scopes for use with the token fetcher function. Ignored when token is provided as a String. Defaults to ["esi-alliances.read_contacts.v1", "esi-assets.read_assets.v1", "esi-assets.read_corporation_assets.v1", "esi-bookmarks.read_character_bookmarks.v1", "esi-bookmarks.read_corporation_bookmarks.v1", "esi-calendar.read_calendar_events.v1", "esi-calendar.respond_calendar_events.v1", "esi-characters.read_agents_research.v1", "esi-characters.read_blueprints.v1", "esi-characters.read_contacts.v1", "esi-characters.read_corporation_roles.v1", "esi-characters.read_fatigue.v1", "esi-characters.read_fw_stats.v1", "esi-characters.read_loyalty.v1", "esi-characters.read_medals.v1", "esi-characters.read_notifications.v1", "esi-characters.read_opportunities.v1", "esi-characters.read_standings.v1", "esi-characters.read_titles.v1", "esi-characters.write_contacts.v1", "esi-clones.read_clones.v1", "esi-clones.read_implants.v1", "esi-contracts.read_character_contracts.v1", "esi-contracts.read_corporation_contracts.v1", "esi-corporations.read_blueprints.v1", "esi-corporations.read_contacts.v1", "esi-corporations.read_container_logs.v1", "esi-corporations.read_corporation_membership.v1", "esi-corporations.read_divisions.v1", "esi-corporations.read_facilities.v1", "esi-corporations.read_fw_stats.v1", "esi-corporations.read_medals.v1", "esi-corporations.read_standings.v1", "esi-corporations.read_starbases.v1", "esi-corporations.read_structures.v1", "esi-corporations.read_titles.v1", "esi-corporations.track_members.v1", "esi-fittings.read_fittings.v1", "esi-fittings.write_fittings.v1", "esi-fleets.read_fleet.v1", "esi-fleets.write_fleet.v1", "esi-industry.read_character_jobs.v1", "esi-industry.read_character_mining.v1", "esi-industry.read_corporation_jobs.v1", "esi-industry.read_corporation_mining.v1", "esi-killmails.read_corporation_killmails.v1", "esi-killmails.read_killmails.v1", "esi-location.read_location.v1", "esi-location.read_online.v1", "esi-location.read_ship_type.v1", ...].

Returns

{Tesla.Middleware.Headers, [{"authorization", TOKEN}]}

middleware(options \\ [])

@spec middleware(options()) :: [Tesla.Client.middleware()]

Returns fully configured middleware for passing to Tesla.client/2.

new()

@spec new() :: Tesla.Env.client()

Configure a client with no authentication.

Returns

Tesla.Env.client

new(token)

@spec new(String.t() | token_fetcher() | options()) :: Tesla.Env.client()

Configure a client that may have authentication.

Parameters

The first parameter may be a token (a string, a token fetcher class, or a module/function tuple) or a keyword list of options. They are documented separately, but only one of them will be passed.

  • token: a String or a function of arity one. This value, or the result of the function call, will be set as a bearer token in the authorization header.
  • options: a keyword list of OpenAPIPetstore.Connection.options.

Returns

Tesla.Env.client

new(token_or_username, scopes_or_password, options \\ [])

@spec new(String.t() | token_fetcher(), [String.t()], options()) :: Tesla.Env.client()

Configure a client using bearer authentication with scopes.

Parameters

  • token: a String or a function of arity one. This value, or the result of the function call, will be set as a bearer token in the authorization header.
  • scopes: a list of Strings represenging OAuth2 scopes.
  • options: a keyword list of OpenAPIPetstore.Connection.options.

Returns

Tesla.Env.client

request(client, options)

@spec request(Tesla.Client.t(), [Tesla.option()]) :: Tesla.Env.result()

Forward requests to Tesla.