Giter VIP home page Giter VIP logo

esi's Introduction

ESI

An Elixir client for Eve Online's Swagger Interface (ESI).

Installation

Install from Hex.pm:

def deps do
  [{:esi, "~> 0.1"}]
end

Documentation

Documentation is available at https://hexdocs.pm/esi.

Synopsis

This package uses the ESI Swagger Specification as published by CCP Games---plus some custom rules---to generate an Elixir API that (hopefully) feels more hand-written than code-generated.

You can see what version of the ESI Swagger Specification was used by running:

ESI.API.version()
# => "0.7.5"

API functions are available in modules under ESI.API. The module grouping is close to, but not the same as, the ESI site, staying more in-line with the URL used for the specific function.

Note: Module organization may change for the v1.0 release.

Basic Usage

API functions return an ESI.Request.t which can then be processed by passing to ESI.request or ESI.request!:

ESI.API.Insurance.prices()
|> ESI.request
# => {:ok, result}
ESI.API.Insurance.prices()
|> ESI.request!
# => result

Automatic pagination is also supported if you use ESI.stream! instead:

ESI.API.Universe.bloodlines()
|> ESI.stream!
|> Enum.take(3)

Authorization

Currently, pass the :token option for those API functions that use it.

In the future, ESI.request, ESI.request!, and ESI.stream! will support headers passed as arguments and/or loaded from application configuration.

Development

Download ESI's swagger.json to priv/

Then run:

$ rm lib/esi/api.ex lib/esi/api/*.ex
$ mix esi.generate

If you are using Elixir version 1.6.0 or above, format the code that was generated with:

$ mix format

Then:

  • Make sure any new modules/functions look like they're named correctly. If they're not, see the renaming functions in ESI.Generator.Function.
  • Update the README.md with the current ESI Swagger Specification version number in the code example.

Contributing

Issues and PRs welcome via the project repository at https://github.com/bruce/esi.

License

See LICENSE.

Please note this package is not supported or endorsed by Eve Online/CCP Games. It's merely a utility created by an enthusiastic fan.

esi's People

Contributors

bruce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esi's Issues

Fix some generated function names

Character

  • lib/esi/api/character.ex: def get_characters_character_id_planets_planet_id(character_id, planet_id, opts \ []) do
  • lib/esi/api/character.ex: def delete_delete_characters_character_id_fittings_fitting_id(character_id, fitting_id, opts \ []) do
  • lib/esi/api/character.ex: def get_characters_character_id_calendar_event_id(character_id, event_id, opts \ []) do
  • lib/esi/api/character.ex: def update_put_characters_character_id_calendar_event_id(character_id, event_id, opts \ []) do
  • lib/esi/api/character.ex: def delete_delete_characters_character_id_mail_mail_id(character_id, mail_id, opts \ []) do
  • lib/esi/api/character.ex: def get_characters_character_id_mail_mail_id(character_id, mail_id, opts \ []) do
  • lib/esi/api/character.ex: def update_put_characters_character_id_mail_mail_id(character_id, mail_id, opts \ []) do

Fleet

  • lib/esi/api/fleet.ex: def delete_delete_fleets_fleet_id_squads_squad_id(fleet_id, squad_id, opts \ []) do
  • lib/esi/api/fleet.ex: def update_put_fleets_fleet_id_squads_squad_id(fleet_id, squad_id, opts \ []) do
  • lib/esi/api/fleet.ex: def create_post_fleets_fleet_id_wings_wing_id_squad(fleet_id, wing_id, opts \ []) do
  • lib/esi/api/fleet.ex: def delete_delete_fleets_fleet_id_members_member_id(fleet_id, member_id, opts \ []) do
  • lib/esi/api/fleet.ex: def update_put_fleets_fleet_id_members_member_id(fleet_id, member_id,
  • lib/esi/api/fleet.ex: def delete_delete_fleets_fleet_id_wings_wing_id(fleet_id, wing_id, opts \ []) do
  • lib/esi/api/fleet.ex: def update_put_fleets_fleet_id_wings_wing_id(fleet_id, wing_id, opts \ []) do

Killmail

  • lib/esi/api/killmail.ex: def get_killmails_killmail_id_killmail_hash(killmail_id, killmail_hash, opts \

Sorting of the function names and modules.

Based on the generated code some planetary interaction functions were spread to different locations, mostly within the Character module. It may be worth the time to tag functions for a similar ESI format.

What are the outputs of each function.

Looking to see a defined format of the output for the docs. An example would be;
{ "application/json": [ { "bloodline_id": 1, "charisma": 6, "corporation_id": 1000006, "description": "The Deteis are regarded as ...", "intelligence": 7, "memory": 7, "name": "Deteis", "perception": 5, "race_id": 1, "ship_type_id": 601, "willpower": 5 } ] }

Just awesome

Hey,

I was looking for a macro that generates elixir modules based on a swagger.json definition. My project targets ... guess what ? Eve.

So this is awesome.

I just want to know if you plan to work on this project again ?

I would like to add a configuration var for the url of the swagger.json which includes TQ as a datasource). So now the mix task would fetch the swagger file to the priv directory and force recompile. So the task can be called from the parent project (which doesn't seem to work right now).

EDIT:
Also, I would like to whitelist what is generated instead of using the whole swagger definition.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.