Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- ---
- # EVE Online: SDE API
- The EVE Online SDE API is a layer between the acutal database of the SDE and your application. This layer is designed to allow extremely access to the data within the SDE with a function as opposed to connecting to the database and querying by hand.
- This layer is easy to implement into your application, there are two methods for doing so. Your first option is to host the database and use the npm module locally, or, you can use the existing API, the details of which can be found [here](http://api.-eve-sde.io/).
- ## Installation
- 1. Setup database environment (MySQL, Postgres, Sqlite)
- 1. Create database for EVE-SDE
- 2. Setup user with privileges for auto-update & inital setup
- 3. Setup user with no password and privileges to **read** the EVE-SDE **only**.
- - This is *technically* optional, if EVE-SDE cannot use the `query-user`, it will fall back on the normal user, logging a warning on start up.
-
- 2. Run `npm install eve-sde`
- 3. Configure `eve-sde.conf`
- ## Configuration
- ```yaml
- # Default Configuration File for eve-sde
- # Update the SDE db automatically when changes are detected
- auto-update: true
- force-version: false # EVE Patch Name, auto update must be false
- sde-server: tranquility # (tranquility, singularity)
- # Cache - cache results of requests to speed up timer
- cache: true
- cache-timer: 7200 # time in seconds
- # Database Information
- # Types: 'mysql', 'sqlite', 'postgres'
- db-type: mysql
- mysql-host: localhost
- mysql-db: eve-sde
- mysql-user: user # needs write privileges to auto-update & for inital setup
- mysql-pass: pass
- mysql-query-user: restricted-user # only has read privileges for direct query access
- # mysql-query-pass: pass
- # sqlite-path:
- ```
- ## Documentation
- This is the documentation for using the NPM module locally, to use the hosted API, the documentation can be found [here](http://api.eve-sde.io/docs). The documentation found below can also be found on the EVE-SDE website, [here](http://eve-sde.io/docs). The documentation for the NPM Module details how to use the module itself, while the documenation for the hosted API is purely on how to access the API, what to request and what to expect to recieve.
- #### Initialization
- Initializing EVE-SDE is done automatically the first time that the application is started, EVE-SDE checks the database to see if data is present, if not, it will download the SDE according the settings in the configuration. In addition, EVE-SDE will check for updates, if it is enabled in the configuration.
- ```javascript
- var sde = require('eve-sde').initalize(); // Revisit this, get rid of initalization function if possible?
- ```
- #### Direct Query
- Direct Query allows you to directly query the EVE-SDE database, should you find that data is inaccessible through the functions within EVE-SDE. In theory, you shouldn't need to use this, as you could do this without EVE-SDE. However, this does make it super simple to query a database because you don't have to worry about setting up a connection and all of that stuff!
- ```javascript
- sde.directQuery('SELECT * FROM items.invTypes WHERE id=4', function(err, done){
- if(err){
- console.log(err.e);
- }
- console.log(done);
- });
- // Check if using 'err' & 'done' is properly conventional and if that order is also correct?
- ```
- #### Functions
- This section serves as a directory for all the functions within EVE-SDE, with a short explanation of each, the object you'll receive, ect.
- | Function | Description | Object |
- | :---------------------------- | :--------------------------------------- | :----------------------------------- |
- | `getItem(id)` | Get an Item object, from it's name | **Item** |
- | `getItem(name)` | Get an Item object, from it's name | **Item** |
- | `getVariants(Item)` | Get the variants of a module, given an Item | [**Item**, **Item**] |
- | `getSolarSystem(id)` | Get a Solar System object, from it's ID | **System** |
- | `getSolarSystem(name)` | Get a Solar System object, from it's name | **System** |
- | `getDistance(system, system)` | Get the distance between two Solar Systems in light years | **int** |
- | `getJumps(system, system)` | Get the distance between two Solar Systems in jumps | **int** |
- | `getRoute(system, system)` | Get all of the Solar Systems in between on a route | [**Solar System**, **Solar System**] |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement