@localisprimary/esi 1.1.0 → 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
@@ -12,7 +12,7 @@ A slightly opinionated TypeScript client for the [EVE Online API](https://develo
12
12
  import { EsiClient } from '@localisprimary/esi'
13
13
 
14
14
  // Create client (optionally with auth token)
15
- const esi = new EsiClient({ token: 'bearer-token' })
15
+ const esi = new EsiClient({ userAgent: 'foo@example.com', token: 'bearer-token' })
16
16
 
17
17
  // Get all alliances
18
18
  const alliances = await esi.getAlliances()
@@ -25,7 +25,7 @@ console.log(alliance.data)
25
25
 
26
26
  ## Methods
27
27
 
28
- 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`.
29
29
 
30
30
  ```typescript
31
31
  interface EsiResponse<TData, THeaders = Record<string, string>> {
@@ -44,7 +44,7 @@ All methods are fully typed: `getAlliance` will take `GetAllianceParams` and ret
44
44
 
45
45
  `Params` types make no distinction between path, query, or body parameters, it's all the same object:
46
46
  ```typescript
47
- const esi = new EsiClient({ token: 'bearer-token' })
47
+ const esi = new EsiClient({ userAgent: 'foo@example.com', token: 'bearer-token' })
48
48
 
49
49
  // POST https://esi.evetech.net/characters/{character_id}/mail
50
50
  esi.postCharacterMail({
package/dist/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import * as Types from './types';
2
2
  export declare class EsiClient {
3
3
  private readonly baseUrl;
4
+ private readonly userAgent;
4
5
  private readonly token?;
5
6
  constructor(options?: {
6
7
  token?: string;
8
+ userAgent?: string;
7
9
  });
8
10
  private request;
9
11
  /**
package/dist/client.js CHANGED
@@ -1,7 +1,15 @@
1
+ const COMPATIBILITY_DATE = '2025-07-29';
1
2
  export class EsiClient {
2
3
  constructor(options = {}) {
3
4
  this.baseUrl = 'https://esi.evetech.net';
5
+ this.userAgent = '@localisprimary/esi';
4
6
  this.token = options.token;
7
+ if (options.userAgent?.length) {
8
+ this.userAgent += ` ${options.userAgent}`;
9
+ }
10
+ else {
11
+ console.warn('@localisprimary/esi: No user agent provided in constructor. This will be required in a future release.');
12
+ }
5
13
  }
6
14
  async request(method, path, params, body) {
7
15
  const url = new URL(path, this.baseUrl);
@@ -14,6 +22,8 @@ export class EsiClient {
14
22
  }
15
23
  const headers = {
16
24
  'Content-Type': 'application/json',
25
+ 'X-Compatibility-Date': COMPATIBILITY_DATE,
26
+ 'X-User-Agent': this.userAgent,
17
27
  };
18
28
  if (this.token) {
19
29
  headers['Authorization'] = `Bearer ${this.token}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localisprimary/esi",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Auto-generated TypeScript client for the EVE Online API",
6
6
  "main": "dist/index.js",