Advertisement
Guest User

Untitled

a guest
May 9th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.37 KB | None | 0 0
  1. ---
  2.  
  3. ---
  4.  
  5. # EVE Online: SDE API
  6.  
  7. 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.
  8.  
  9.  
  10.  
  11. 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/).
  12.  
  13. ## Installation
  14.  
  15. 1. Setup database environment (MySQL, Postgres, Sqlite)
  16.  
  17. 1. Create database for EVE-SDE
  18.  
  19. 2. Setup user with privileges for auto-update & inital setup
  20.  
  21. 3. Setup user with no password and privileges to **read** the EVE-SDE **only**.
  22.  
  23. - 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.
  24.  
  25.  
  26. 2. Run `npm install eve-sde`
  27.  
  28. 3. Configure `eve-sde.conf`
  29.  
  30. ## Configuration
  31.  
  32. ```yaml
  33. # Default Configuration File for eve-sde
  34.  
  35. # Update the SDE db automatically when changes are detected
  36. auto-update: true
  37. force-version: false # EVE Patch Name, auto update must be false
  38. sde-server: tranquility # (tranquility, singularity)
  39.  
  40. # Cache - cache results of requests to speed up timer
  41. cache: true
  42. cache-timer: 7200 # time in seconds
  43.  
  44. # Database Information
  45. # Types: 'mysql', 'sqlite', 'postgres'
  46. db-type: mysql
  47.  
  48. mysql-host: localhost
  49. mysql-db: eve-sde
  50. mysql-user: user # needs write privileges to auto-update & for inital setup
  51. mysql-pass: pass
  52.  
  53. mysql-query-user: restricted-user # only has read privileges for direct query access
  54. # mysql-query-pass: pass
  55.  
  56. # sqlite-path:
  57. ```
  58.  
  59.  
  60.  
  61. ## Documentation
  62.  
  63. 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.
  64.  
  65.  
  66.  
  67. #### Initialization
  68.  
  69. 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.
  70.  
  71. ```javascript
  72. var sde = require('eve-sde').initalize(); // Revisit this, get rid of initalization function if possible?
  73. ```
  74.  
  75.  
  76.  
  77. #### Direct Query
  78.  
  79. 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!
  80.  
  81. ```javascript
  82. sde.directQuery('SELECT * FROM items.invTypes WHERE id=4', function(err, done){
  83. if(err){
  84. console.log(err.e);
  85. }
  86.  
  87. console.log(done);
  88. });
  89.  
  90. // Check if using 'err' & 'done' is properly conventional and if that order is also correct?
  91. ```
  92.  
  93.  
  94.  
  95. #### Functions
  96.  
  97. 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.
  98.  
  99. | Function | Description | Object |
  100. | :---------------------------- | :--------------------------------------- | :----------------------------------- |
  101. | `getItem(id)` | Get an Item object, from it's name | **Item** |
  102. | `getItem(name)` | Get an Item object, from it's name | **Item** |
  103. | `getVariants(Item)` | Get the variants of a module, given an Item | [**Item**, **Item**] |
  104. | `getSolarSystem(id)` | Get a Solar System object, from it's ID | **System** |
  105. | `getSolarSystem(name)` | Get a Solar System object, from it's name | **System** |
  106. | `getDistance(system, system)` | Get the distance between two Solar Systems in light years | **int** |
  107. | `getJumps(system, system)` | Get the distance between two Solar Systems in jumps | **int** |
  108. | `getRoute(system, system)` | Get all of the Solar Systems in between on a route | [**Solar System**, **Solar System**] |
  109. | | | |
  110. | | | |
  111. | | | |
  112. | | | |
  113. | | | |
  114. | | | |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement