@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 +10 -6
- package/dist/client.d.ts +197 -195
- package/dist/client.js +10 -0
- package/dist/types.d.ts +1034 -2
- package/package.json +2 -2
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
|
+
[](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>`
|
|
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<
|
|
28
|
-
data:
|
|
31
|
+
interface EsiResponse<TData, THeaders = Record<string, string>> {
|
|
32
|
+
data: TData;
|
|
29
33
|
status: number;
|
|
30
|
-
headers:
|
|
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({
|