@localisprimary/esi 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,13 +2,17 @@
2
2
 
3
3
  A slightly opinionated TypeScript client for the [EVE Online API](https://developers.eveonline.com/api-explorer).
4
4
 
5
+
6
+ [![NPM Version](https://img.shields.io/npm/v/%40localisprimary%2Fesi)](https://www.npmjs.com/package/@localisprimary/esi)
7
+
8
+
5
9
  ## Usage
6
10
 
7
11
  ```typescript
8
12
  import { EsiClient } from '@localisprimary/esi'
9
13
 
10
14
  // Create client (optionally with auth token)
11
- const esi = new EsiClient({ token: 'bearer-token' })
15
+ const esi = new EsiClient({ userAgent: 'foo@example.com', token: 'bearer-token' })
12
16
 
13
17
  // Get all alliances
14
18
  const alliances = await esi.getAlliances()
@@ -21,13 +25,13 @@ console.log(alliance.data)
21
25
 
22
26
  ## Methods
23
27
 
24
- This client provides methods for all EVE ESI endpoints. Methods return a Promise that resolves to an `EsiResponse<T>` object or throws an `EsiError`.
28
+ This client provides methods for all EVE ESI endpoints. Methods return a `Promise` that resolves to an `EsiResponse<T>` or throws an `EsiError`.
25
29
 
26
30
  ```typescript
27
- interface EsiResponse<T> {
28
- data: T;
31
+ interface EsiResponse<TData, THeaders = Record<string, string>> {
32
+ data: TData;
29
33
  status: number;
30
- headers: Partial<Record<string, string>>;
34
+ headers: THeaders;
31
35
  }
32
36
 
33
37
  interface EsiError {
@@ -40,7 +44,7 @@ All methods are fully typed: `getAlliance` will take `GetAllianceParams` and ret
40
44
 
41
45
  `Params` types make no distinction between path, query, or body parameters, it's all the same object:
42
46
  ```typescript
43
- const esi = new EsiClient({ token: 'bearer-token' })
47
+ const esi = new EsiClient({ userAgent: 'foo@example.com', token: 'bearer-token' })
44
48
 
45
49
  // POST https://esi.evetech.net/characters/{character_id}/mail
46
50
  esi.postCharacterMail({