eve-esi-types 3.1.4 → 3.1.7

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
@@ -100,6 +100,6 @@ const ret = await esiRequest.universe.get("/universe/structures/", { query: { fi
100
100
 
101
101
  ## References
102
102
 
103
- - [`ESI Types Utility Definitions`](./docs/esi-types-util3.md)
103
+ - [`ESI Types Utility Definitions`](./docs/v3/esi-types-util3.md)
104
104
 
105
105
  - [`ESI Tagged Types Utility Definitions`](./docs/esi-tagged-types.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve-esi-types",
3
- "version": "3.1.4",
3
+ "version": "3.1.7",
4
4
  "description": "Extracted the main type of ESI. use for ESI request response types (version 2 only)",
5
5
  "main": "v2/index.d.ts",
6
6
  "scripts": {
@@ -15,7 +15,6 @@
15
15
  "v2",
16
16
  "lib",
17
17
  "web",
18
- "docs",
19
18
  "*.d.mts",
20
19
  "*.mjs",
21
20
  "LICENSE",
@@ -9,7 +9,7 @@
9
9
  * THIS DTS IS AUTO GENERATED, DO NOT EDIT
10
10
  *
11
11
  * @file eve-esi-types/v2/esi-tagged-types.d.ts
12
- * @summary This file is auto-generated and defines version 3.1.4 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.1.7 of the EVE Online ESI response types.
13
13
  */
14
14
  import { TESIResponseOKMap } from "./index.d.ts";
15
15
  export * from "./index.d.ts";
package/v2/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * THIS DTS IS AUTO GENERATED, DO NOT EDIT
10
10
  *
11
11
  * @file eve-esi-types/v2/index.d.ts
12
- * @summary This file is auto-generated and defines version 3.1.4 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.1.7 of the EVE Online ESI response types.
13
13
  */
14
14
  import type { TESIResponseOKMap } from "./response-map.d.ts";
15
15
  export type { TESIResponseOKMap } from "./response-map.d.ts";
@@ -91,10 +91,13 @@ export declare type TESICachedSeconds<
91
91
  : never
92
92
  }[ESIEndpointOf<M>];
93
93
  }[Method];
94
- // declare const cacheSecGet: TESICachedSeconds<"get">;
95
- // declare const cache5sec: TESICachedSeconds<"put">;
96
- // declare const cache3600sEndpoint: TESICachedSeconds<"post", 1>;
97
- // TODO: 2025/3/17 How do I get rid of `pathParams` completely?
94
+
95
+ /**
96
+ * Indicates that no path parameters are allowed.
97
+ *
98
+ * This type serves as a compile-time signal for endpoints that do not support dynamic URL segments.
99
+ * By using this type, it is clear that no path parameters should be provided.
100
+ */
98
101
  export declare type TPathParamsNever = { /* pathParams?: never */ };
99
102
 
100
103
  // local types
@@ -143,7 +146,7 @@ export type _IfNeedPathParams<EP extends unknown> = IfParameterizedPath<EP> exte
143
146
  *
144
147
  * @template M - The HTTP method (e.g., "get", "post").
145
148
  * @template EP - The endpoint path.
146
- * @deprecated 2025/3/17 12:12:33
149
+ * @deprecated 2025/3/17
147
150
  */
148
151
  export type __InferESIResponseResult<
149
152
  M extends TESIEntryMethod,
@@ -155,7 +158,7 @@ export type __InferESIResponseResult<
155
158
  * @template Entry - The entry type to identify parameters for.
156
159
  * @template Opt - The type of the parameters.
157
160
  * @type {Opt & Pick<Entry, Exclude<keyof Entry, "result">>}
158
- * @deprecated 2025/3/17 12:12:33
161
+ * @deprecated 2025/3/17
159
162
  */
160
163
  export type __IdentifyParameters<
161
164
  Entry, Opt,
@@ -227,6 +230,7 @@ declare global {
227
230
  * type RequiredA = RequireThese<Original, 'a'>;
228
231
  * // Result: { a: number; b?: string; c: boolean }
229
232
  * ```
233
+ * @see Documentation of [`RequireThese`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/require-these.md)
230
234
  */
231
235
  type RequireThese<T, K extends keyof T> = {
232
236
  [P in keyof T as P extends K ? P : never]-?: T[P];
@@ -303,6 +307,7 @@ declare global {
303
307
  * otherwise optional.
304
308
  *
305
309
  * @returns {Promise<Ret>} A promise that resolves with the result type `Ret`, representing the response data from the ESI endpoint.
310
+ * @see Documentation of [`TESIEnhancedRequestFunctionSignature`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/esi-enhanced-function-signature.md)
306
311
  */
307
312
  type TESIEnhancedRequestFunctionSignature<
308
313
  PrependParam extends unknown, ActualOpt extends Record<string, unknown>
@@ -361,6 +366,7 @@ declare global {
361
366
  * type Example = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
362
367
  * // Result: `/characters/${number}/fittings/${number}/`
363
368
  * ```
369
+ * @see Documentation of [`ReplacePathParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/replace-path-params.md)
364
370
  */
365
371
  type ReplacePathParams<T extends unknown> = T extends `${infer Start}{${infer Param}}${infer End}`
366
372
  ? `${Start}${number}${ReplacePathParams<End>}` : T;
@@ -378,7 +384,8 @@ declare global {
378
384
  * @returns {TPathParamsNever | _IfNeedPathParams<EPx>}
379
385
  * @see {@link _IfNeedPathParams}
380
386
  * @see {@link TPathParamsNever}
381
- * @date 2025/3/17 4:32:47
387
+ * @see Documentation of [`InferPathParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/infer-path-params.md)
388
+ * @date 2025/3/17
382
389
  */
383
390
  type InferPathParams<
384
391
  RealEP extends unknown, EPx extends unknown
@@ -401,6 +408,7 @@ declare global {
401
408
  * ```
402
409
  * @see {@link ESIEndpointOf}
403
410
  * @see {@link ReplacePathParams}
411
+ * @see Documentation of [`InferEndpointOrigin`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/infer-endpoint-origin.md)
404
412
  */
405
413
  type InferEndpointOrigin<
406
414
  RealEP extends unknown, M extends TESIEntryMethod,
@@ -420,9 +428,8 @@ declare global {
420
428
  * type Resolved = ResolvedEndpoint<"/characters/123/fittings/456/", "delete">;
421
429
  * // Result: "/characters/{character_id}/fittings/{fitting_id}/"
422
430
  * ```
423
- * DONE: 2025/3/17 4:12:09 Ok, works
424
- *
425
431
  * @see {@link InferEndpointOrigin}
432
+ * @see Documentation of [`ResolvedEndpoint`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/resolved-endpoint.md)
426
433
  */
427
434
  type ResolvedEndpoint<
428
435
  RealEP extends unknown, M extends TESIEntryMethod,
@@ -447,6 +454,7 @@ declare global {
447
454
  * ```
448
455
  * @see {@link ESIEndpointOf}
449
456
  * @see {@link _ESIResponseType}
457
+ * @see Documentation of [`PickRequireParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/pick-require-params.md)
450
458
  */
451
459
  type PickRequireParams<
452
460
  M extends TESIEntryMethod,
@@ -471,6 +479,7 @@ declare global {
471
479
  * ```
472
480
  * @see {@link ESIEndpointOf}
473
481
  * @see {@link PickRequireParams}
482
+ * @see Documentation of [`HasRequireParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/has-require-params.md)
474
483
  */
475
484
  type HasRequireParams<
476
485
  M extends TESIEntryMethod,
@@ -488,6 +497,7 @@ declare global {
488
497
  * @template Opt The type to return if `EP` is not parameterized.
489
498
  * @returns {number | [number, number] | Opt}
490
499
  * Returns `number` if there is one parameter, `[number, number]` if there are two parameters, otherwise `Opt`.
500
+ * @see Documentation of [`IfParameterizedPath`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/if-parameterized-path.md)
491
501
  */
492
502
  type IfParameterizedPath<EP extends unknown, Opt = never> = EP extends `${string}/{${string}}${string}`
493
503
  ? PickPathParameters<EP> extends never
@@ -517,6 +527,7 @@ declare global {
517
527
  * @see {@link RequireThese}
518
528
  * @see {@link ESIEndpointOf}
519
529
  * @see {@link _ESIResponseType}
530
+ * @see Documentation of [`IdentifyParameters`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/identify-parameters.md)
520
531
  */
521
532
  //* ctt
522
533
  type IdentifyParameters<
@@ -555,6 +566,7 @@ declare global {
555
566
  * ```
556
567
  * @see {@link ESIEndpointOf}
557
568
  * @see {@link _ESIResponseType}
569
+ * @see Documentation of [`InferESIResponseResult`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/infer-esi-response-result.md)
558
570
  */
559
571
  type InferESIResponseResult<
560
572
  M extends TESIEntryMethod,
@@ -578,7 +590,8 @@ declare global {
578
590
  type TESIEntryMethod = keyof TESIResponseOKMap;
579
591
 
580
592
  /**
581
- * @date 2025/3/16 21:45:50
593
+ * Represents endpoints using `TESIEntryMethod`.
594
+ * @date 2025/3/16
582
595
  */
583
596
  type ESIEndpointOf<M extends TESIEntryMethod> = keyof TESIResponseOKMap[M];
584
597
  /**
@@ -9,7 +9,7 @@
9
9
  * THIS DTS IS AUTO GENERATED, DO NOT EDIT
10
10
  *
11
11
  * @file eve-esi-types/v2/response-map.d.ts
12
- * @summary This file is auto-generated and defines version 3.1.4 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.1.7 of the EVE Online ESI response types.
13
13
  */
14
14
  import "./types-index.d.ts";
15
15
 
@@ -1025,16 +1025,16 @@ export type TESIResponseOKMap = {
1025
1025
  post: {
1026
1026
  "/fleets/{fleet_id}/members/": {
1027
1027
  result: NoContentResponse;
1028
+ tag: "Fleets";
1028
1029
  /** `esi-fleets.write_fleet.v1` */
1029
1030
  auth: true;
1030
- tag: "Fleets";
1031
1031
  body: PostFleetsFleetIdMembersInvitation;
1032
1032
  },
1033
1033
  "/ui/autopilot/waypoint/": {
1034
1034
  result: NoContentResponse;
1035
+ tag: "User Interface";
1035
1036
  /** `esi-ui.write_waypoint.v1` */
1036
1037
  auth: true;
1037
- tag: "User Interface";
1038
1038
  query: {
1039
1039
  add_to_beginning: boolean;
1040
1040
  clear_other_waypoints: boolean;
@@ -1043,36 +1043,36 @@ export type TESIResponseOKMap = {
1043
1043
  },
1044
1044
  "/ui/openwindow/contract/": {
1045
1045
  result: NoContentResponse;
1046
+ tag: "User Interface";
1046
1047
  /** `esi-ui.open_window.v1` */
1047
1048
  auth: true;
1048
- tag: "User Interface";
1049
1049
  query: {
1050
1050
  contract_id: number;
1051
1051
  }
1052
1052
  },
1053
1053
  "/ui/openwindow/information/": {
1054
1054
  result: NoContentResponse;
1055
+ tag: "User Interface";
1055
1056
  /** `esi-ui.open_window.v1` */
1056
1057
  auth: true;
1057
- tag: "User Interface";
1058
1058
  query: {
1059
1059
  target_id: number;
1060
1060
  }
1061
1061
  },
1062
1062
  "/ui/openwindow/marketdetails/": {
1063
1063
  result: NoContentResponse;
1064
+ tag: "User Interface";
1064
1065
  /** `esi-ui.open_window.v1` */
1065
1066
  auth: true;
1066
- tag: "User Interface";
1067
1067
  query: {
1068
1068
  type_id: number;
1069
1069
  }
1070
1070
  },
1071
1071
  "/ui/openwindow/newmail/": {
1072
1072
  result: NoContentResponse;
1073
+ tag: "User Interface";
1073
1074
  /** `esi-ui.open_window.v1` */
1074
1075
  auth: true;
1075
- tag: "User Interface";
1076
1076
  body: PostUiOpenwindowNewmailNewMail;
1077
1077
  },
1078
1078
  "/characters/affiliation/": {
@@ -1175,17 +1175,17 @@ export type TESIResponseOKMap = {
1175
1175
  put: {
1176
1176
  "/characters/{character_id}/calendar/{event_id}/": {
1177
1177
  result: NoContentResponse;
1178
- /** `esi-calendar.respond_calendar_events.v1` */
1179
- auth: true;
1180
1178
  tag: "Calendar";
1181
1179
  cachedSeconds: 5;
1180
+ /** `esi-calendar.respond_calendar_events.v1` */
1181
+ auth: true;
1182
1182
  body: PutCharactersCharacterIdCalendarEventIdResponse;
1183
1183
  },
1184
1184
  "/characters/{character_id}/contacts/": {
1185
1185
  result: NoContentResponse;
1186
+ tag: "Contacts";
1186
1187
  /** `esi-characters.write_contacts.v1` */
1187
1188
  auth: true;
1188
- tag: "Contacts";
1189
1189
  body: PutCharactersCharacterIdContactsContactIds;
1190
1190
  query: {
1191
1191
  label_ids?: PutCharactersCharacterIdContactsLabelIds;
@@ -1195,85 +1195,85 @@ export type TESIResponseOKMap = {
1195
1195
  },
1196
1196
  "/characters/{character_id}/mail/{mail_id}/": {
1197
1197
  result: NoContentResponse;
1198
+ tag: "Mail";
1198
1199
  /** `esi-mail.organize_mail.v1` */
1199
1200
  auth: true;
1200
- tag: "Mail";
1201
1201
  body: PutCharactersCharacterIdMailMailIdContents;
1202
1202
  },
1203
1203
  "/fleets/{fleet_id}/": {
1204
1204
  result: NoContentResponse;
1205
+ tag: "Fleets";
1205
1206
  /** `esi-fleets.write_fleet.v1` */
1206
1207
  auth: true;
1207
- tag: "Fleets";
1208
1208
  body: PutFleetsFleetIdNewSettings;
1209
1209
  },
1210
1210
  "/fleets/{fleet_id}/members/{member_id}/": {
1211
1211
  result: NoContentResponse;
1212
+ tag: "Fleets";
1212
1213
  /** `esi-fleets.write_fleet.v1` */
1213
1214
  auth: true;
1214
- tag: "Fleets";
1215
1215
  body: PutFleetsFleetIdMembersMemberIdMovement;
1216
1216
  },
1217
1217
  "/fleets/{fleet_id}/squads/{squad_id}/": {
1218
1218
  result: NoContentResponse;
1219
+ tag: "Fleets";
1219
1220
  /** `esi-fleets.write_fleet.v1` */
1220
1221
  auth: true;
1221
- tag: "Fleets";
1222
1222
  body: PutFleetsFleetIdSquadsSquadIdNaming;
1223
1223
  },
1224
1224
  "/fleets/{fleet_id}/wings/{wing_id}/": {
1225
1225
  result: NoContentResponse;
1226
+ tag: "Fleets";
1226
1227
  /** `esi-fleets.write_fleet.v1` */
1227
1228
  auth: true;
1228
- tag: "Fleets";
1229
1229
  body: PutFleetsFleetIdWingsWingIdNaming;
1230
1230
  }
1231
1231
  },
1232
1232
  delete: {
1233
1233
  "/characters/{character_id}/contacts/": {
1234
1234
  result: NoContentResponse;
1235
+ tag: "Contacts";
1235
1236
  /** `esi-characters.write_contacts.v1` */
1236
1237
  auth: true;
1237
- tag: "Contacts";
1238
1238
  query: {
1239
1239
  contact_ids: DeleteCharactersCharacterIdContactsContactIds;
1240
1240
  }
1241
1241
  },
1242
1242
  "/characters/{character_id}/fittings/{fitting_id}/": {
1243
1243
  result: NoContentResponse;
1244
+ tag: "Fittings";
1244
1245
  /** `esi-fittings.write_fittings.v1` */
1245
1246
  auth: true;
1246
- tag: "Fittings";
1247
1247
  },
1248
1248
  "/characters/{character_id}/mail/labels/{label_id}/": {
1249
1249
  result: NoContentResponse;
1250
+ tag: "Mail";
1250
1251
  /** `esi-mail.organize_mail.v1` */
1251
1252
  auth: true;
1252
- tag: "Mail";
1253
1253
  },
1254
1254
  "/characters/{character_id}/mail/{mail_id}/": {
1255
1255
  result: NoContentResponse;
1256
+ tag: "Mail";
1256
1257
  /** `esi-mail.organize_mail.v1` */
1257
1258
  auth: true;
1258
- tag: "Mail";
1259
1259
  },
1260
1260
  "/fleets/{fleet_id}/members/{member_id}/": {
1261
1261
  result: NoContentResponse;
1262
+ tag: "Fleets";
1262
1263
  /** `esi-fleets.write_fleet.v1` */
1263
1264
  auth: true;
1264
- tag: "Fleets";
1265
1265
  },
1266
1266
  "/fleets/{fleet_id}/squads/{squad_id}/": {
1267
1267
  result: NoContentResponse;
1268
+ tag: "Fleets";
1268
1269
  /** `esi-fleets.write_fleet.v1` */
1269
1270
  auth: true;
1270
- tag: "Fleets";
1271
1271
  },
1272
1272
  "/fleets/{fleet_id}/wings/{wing_id}/": {
1273
1273
  result: NoContentResponse;
1274
+ tag: "Fleets";
1274
1275
  /** `esi-fleets.write_fleet.v1` */
1275
1276
  auth: true;
1276
- tag: "Fleets";
1277
1277
  }
1278
1278
  }
1279
1279
  };
@@ -9,7 +9,7 @@
9
9
  * THIS DTS IS AUTO GENERATED, DO NOT EDIT
10
10
  *
11
11
  * @file eve-esi-types/v2/types-index.d.ts
12
- * @summary This file is auto-generated and defines version 3.1.4 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.1.7 of the EVE Online ESI response types.
13
13
  */
14
14
  import "./get_wars_ok.d.ts";
15
15
  import "./get_status_ok.d.ts";
@@ -1,120 +0,0 @@
1
- # ESI Tagged Types
2
-
3
- This document provides an overview of the types defined in the `eve-esi-types/v2/esi-tagged-types.d.ts` file. These types are used to handle EVE Online ESI responses.
4
-
5
- ## LCamelCase
6
-
7
- Converts a string to lower camel case.
8
-
9
- ```typescript
10
- type LCamelCase<S extends string> = S extends `${infer P1} ${infer P2}`
11
- ? `${Lowercase<P1>}${Capitalize<P2>}` : Lowercase<S>;
12
- ```
13
-
14
- ### Example
15
-
16
- ```typescript
17
- // returns "assets"
18
- LCamelCase<"Assets">
19
-
20
- // returns "factionWarfare"
21
- LCamelCase<"Faction Warfare">
22
- ```
23
-
24
- ## InferSomethingBy
25
-
26
- Infers something by a brand.
27
-
28
- ```typescript
29
- type InferSomethingByBrand<N = number> = N & { __enum: "InferSomethingBy" };
30
- type InferSomethingByMethod = InferSomethingByBrand<0>;
31
- type InferSomethingByTags = InferSomethingByBrand<1>;
32
- type InferSomethingBy<Tag, AsType extends InferSomethingByBrand = InferSomethingByMethod> = {
33
- [M in TESIEntryMethod]: TESIResponseOKMap[M] extends Record<`/${string}/`, { tag: infer ActualTag }>
34
- ? AsType extends InferSomethingByTags
35
- ? ActualTag : ActualTag extends Tag
36
- ? M
37
- : never
38
- : never;
39
- }[TESIEntryMethod];
40
- ```
41
-
42
- ## ESITags
43
-
44
- Maps HTTP methods to their corresponding tags.
45
-
46
- ```typescript
47
- type ESITags = InferSomethingBy<never, InferSomethingByTags>;
48
- ```
49
-
50
- ## InferMethod
51
-
52
- Infers the HTTP method based on the provided tag.
53
-
54
- ```typescript
55
- type InferMethod<Tag> = InferSomethingBy<Tag>;
56
- ```
57
-
58
- ## TaggedEndpointRequestFunction2
59
-
60
- Creates a function type for making requests to tagged endpoints.
61
-
62
- ```typescript
63
- type TaggedEndpointRequestFunction2<
64
- M extends TESIEntryMethod, Tag extends ESITags,
65
- ActualOpt extends Record<string, unknown> = {},
66
- EndPoints extends SelectEndpointByTag<Tag, M> = SelectEndpointByTag<Tag, M>,
67
- > = <
68
- REP extends ReplacePathParams<EndPoints> | EndPoints,
69
- EPX extends _InferEndpointOrigin<REP, EndPoints> extends never ? REP: _InferEndpointOrigin<REP, EndPoints>,
70
- PPM extends InferPathParams<REP, EPX>,
71
- Opt extends IdentifyParameters<M, EPX, ActualOpt & PPM>,
72
- Ret extends InferESIResponseResult<M, EPX>,
73
- HasOpt = HasRequireParams<M, EPX, PPM>,
74
- >(endpoint: REP, ...options: HasOpt extends 1 ? [Opt] : [Opt?]) => Promise<Ret>;
75
- ```
76
-
77
- ## ESITaggedEndpointRequest2
78
-
79
- Maps tags to their corresponding endpoint request functions.
80
-
81
- ```typescript
82
- type ESITaggedEndpointRequest2<Tag extends ESITags, ActualOpt extends Record<string, unknown> = {}> = {
83
- [tag in Tag]: {
84
- [method in InferMethod<Tag>]: TaggedEndpointRequestFunction2<method, tag, ActualOpt>;
85
- };
86
- }[Tag];
87
- ```
88
-
89
- ## SelectEndpointByTag
90
-
91
- Selects an endpoint by tag and method.
92
-
93
- ```typescript
94
- type SelectEndpointByTag<
95
- Tag extends ESITags, M extends TESIEntryMethod
96
- > = {
97
- [EP in keyof TESIResponseOKMap[M]]: TESIResponseOKMap[M][EP] extends { tag: infer ActualTag }
98
- ? ActualTag extends Tag
99
- ? EP : never
100
- : never;
101
- }[keyof TESIResponseOKMap[M]];
102
- ```
103
-
104
- ## TaggedESIRequestMap2
105
-
106
- Maps lower camel case tags to their corresponding endpoint request functions.
107
-
108
- ```typescript
109
- type TaggedESIRequestMap2<ActualOpt extends Record<string, unknown> = {}> = {
110
- [tag in ESITags as LCamelCase<tag>]: ESITaggedEndpointRequest2<tag, ActualOpt>;
111
- };
112
- ```
113
-
114
- ## TaggedESIRequestMapPartial2
115
-
116
- Creates a partial map of lower camel case tags to their corresponding endpoint request functions.
117
-
118
- ```typescript
119
- type TaggedESIRequestMapPartial2<Props extends LCamelCase<ESITags>> = RequireThese<Partial<TaggedESIRequestMap2>, Props>;
120
- ```
@@ -1,319 +0,0 @@
1
- <!--!
2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3
- Copyright (C) 2025 jeffy-g <hirotom1107@gmail.com>
4
- Released under the MIT license
5
- https://opensource.org/licenses/mit-license.php
6
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
- -->
8
-
9
- # ESI Types Utility 3.1 Summary
10
-
11
- This document provides detailed explanations of each type defined in the `eve-esi-types/v2/index.d.ts` file.
12
-
13
- > ## TESIRequestFunctionSignature2
14
-
15
- `TESIRequestFunctionSignature2` is a type that defines the signature of an ESI request function where the endpoint can be a real endpoint or a parameterized endpoint. This function sends a request to a specified endpoint and returns a response.
16
-
17
- #### Type Parameters
18
-
19
- - `ActualOpt`: The actual type of the options.
20
- - `M`: The HTTP method to use for the request.
21
- - `RealEP`: The real path of the ESI endpoint to send the request to.
22
- - `EPx`: The parameterized path of the ESI endpoint to send the request to.
23
- - `PathParams`: Parameters to include in the request if the endpoint is parameterized.
24
- - `Opt`: Options to include in the request. If there is a required parameter, its type will be merged with `ActualOpt`.
25
- - `R`: The response type.
26
- - `HasOpt`: Determines if the options parameter is required.
27
-
28
- #### Parameters
29
-
30
- - `method`: The HTTP method to use for the request (e.g., "get", "post").
31
- - `endpoint`: The real path of the ESI endpoint to send the request to.
32
- - `options`: An optional object containing additional options for the request. If the endpoint has required parameters, this parameter must be provided.
33
-
34
- #### Returns
35
-
36
- A `Promise` object containing the response data, with the type inferred based on the method and endpoint.
37
-
38
- #### Remarks
39
-
40
- The `...options: HasOpt extends 1 ? [Opt] : [Opt?]` parameter is defined this way to enforce that if the endpoint has required parameters, the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
41
-
42
-
43
- > ## TESIRequestFunctionEachMethod2
44
-
45
- `TESIRequestFunctionEachMethod2` is a type that defines the signature of an ESI request function for a specific HTTP method. This function sends a request to a specified endpoint and returns a response.
46
-
47
- #### Type Parameters
48
-
49
- - `M`: The HTTP method to use for the request.
50
- - `ActualOpt`: The actual type of the options.
51
- - `RealEP`: The real path of the ESI endpoint to send the request to.
52
- - `EPx`: The parameterized path of the ESI endpoint to send the request to.
53
- - `PathParams`: Parameters to include in the request if the endpoint is parameterized.
54
- - `Opt`: Options to include in the request. If there is a required parameter, its type will be merged with `ActualOpt`.
55
- - `R`: The response type.
56
- - `HasOpt`: Determines if the options parameter is required.
57
-
58
- #### Parameters
59
-
60
- - `endpoint`: The real path of the ESI endpoint to send the request to.
61
- - `options`: An optional object containing additional options for the request. If the endpoint has required parameters, this parameter must be provided.
62
-
63
- #### Returns
64
-
65
- A `Promise` object containing the response data, with the type inferred based on the method and endpoint.
66
-
67
- #### Remarks
68
-
69
- The `...options: HasOpt extends 1 ? [Opt] : [Opt?]` parameter is defined this way to enforce that if the endpoint has required parameters, the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
70
-
71
-
72
-
73
- ## ReplacePathParams
74
-
75
- `ReplacePathParams` is a type that replaces path parameters in a string with numbers.
76
-
77
- ```typescript
78
- type ReplacePathParams<T extends unknown> = T extends `${infer Start}{${infer Param}}${infer End}`
79
- ? `${Start}${number}${ReplacePathParams<End>}` : T;
80
- ```
81
-
82
- <details>
83
- > Example
84
-
85
- ```typescript
86
- type Example = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
87
- // Result: `/characters/${number}/fittings/${number}/`
88
- ```
89
- </details>
90
-
91
- ## InferPathParams
92
-
93
- `InferPathParams` is a type that infers the path parameters based on the real endpoint and the resolved endpoint.
94
-
95
- ```typescript
96
- type InferPathParams<
97
- RealEP extends unknown, EPx extends unknown
98
- > = RealEP extends EPx ? _IfNeedPathParams<EPx> : TPathParamsNever;
99
- ```
100
-
101
- ## InferEndpointOrigin
102
-
103
- `InferEndpointOrigin` is a type that infers the original endpoint based on the real endpoint and the HTTP method. This type maps the real endpoint to its corresponding parameterized endpoint by checking if the real endpoint matches the pattern of any parameterized endpoint.
104
-
105
- ```typescript
106
- type InferEndpointOrigin<
107
- RealEP extends unknown, M extends TESIEntryMethod,
108
- Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>
109
- > = {
110
- [EP in Endpoints]: RealEP extends ReplacePathParams<EP>
111
- ? EP : never;
112
- }[Endpoints];
113
- ```
114
-
115
- <details>
116
- > Example
117
-
118
- ```typescript
119
- type Original = InferEndpointOrigin<"/characters/123/fittings/456/", "delete">;
120
- // Result: "/characters/{character_id}/fittings/{fitting_id}/"
121
- ```
122
- </details>
123
-
124
-
125
- ## ResolvedEndpoint
126
-
127
- `ResolvedEndpoint` is a type that determines the resolved endpoint based on the real endpoint and the method.
128
-
129
- ```typescript
130
- type ResolvedEndpoint<
131
- RealEP extends unknown, M extends TESIEntryMethod,
132
- > = InferEndpointOrigin<RealEP, M> extends never ? RealEP: InferEndpointOrigin<RealEP, M>;
133
- ```
134
-
135
- <details>
136
- > Example
137
-
138
- ```typescript
139
- type Resolved = ResolvedEndpoint<"/characters/123/fittings/456/", "delete">;
140
- // Result: "/characters/{character_id}/fittings/{fitting_id}/"
141
- ```
142
- </details>
143
-
144
- ## PickRequireParams
145
-
146
- `PickRequireParams` is a type that picks the required parameters from an entry type, including additional parameters. This type excludes the keys "result", "tag", and "cachedSeconds" from the entry type and the additional parameters, and returns the remaining keys as the required parameters.
147
-
148
- ```typescript
149
- type PickRequireParams<
150
- M extends TESIEntryMethod,
151
- EPx extends ESIEndpointOf<M> | string,
152
- AdditionalParams,
153
- Entry = _ESIResponseType<M, EPx>
154
- > = Exclude<keyof (Entry & AdditionalParams), "result" | "tag" | "cachedSeconds">;
155
- ```
156
-
157
- <details>
158
- > Example
159
-
160
- ```typescript
161
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
162
- type RequiredParams = PickRequireParams<"get", "/example/endpoint", { auth: string }>;
163
- // Result: "auth"
164
- ```
165
- </details>
166
-
167
- ## HasRequireParams
168
-
169
- `HasRequireParams` is a type that determines if the given entry has required parameters, including additional options. This type checks if an entry has any required parameters by excluding the keys "result", "tag", and "cachedSeconds". If any keys remain after this exclusion, it means the entry has required parameters.
170
-
171
- ```typescript
172
- type HasRequireParams<
173
- M extends TESIEntryMethod,
174
- EPx extends ESIEndpointOf<M> | string,
175
- AdditionalParams,
176
- > = PickRequireParams<M, EPx, AdditionalParams> extends never ? 0 : 1;
177
- ```
178
-
179
- <details>
180
- > Example
181
-
182
- ```typescript
183
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
184
- type HasRequired = HasRequireParams<"get", "/example/endpoint", { auth: string }>;
185
- // Result: 1
186
- ```
187
- </details>
188
-
189
- ## IfParameterizedPath
190
-
191
- `IfParameterizedPath` is a type that determines the required number of replacements if `EP` (endpoint) is a parameterized path.
192
-
193
- ```typescript
194
- type IfParameterizedPath<EP extends unknown, Opt = never> = EP extends `${string}/{${string}}${string}`
195
- ? PickPathParameters<EP> extends never
196
- ? Opt : InferKeysLen<PickPathParameters<EP>> extends 1
197
- ? number : [number, number]
198
- : Opt;
199
- ```
200
-
201
- ## IdentifyParameters
202
-
203
- `IdentifyParameters` is a type that identifies the required parameters for a given entry type, including additional options. This type combines the required parameters from the entry type and the additional options, ensuring that all required parameters are marked as required.
204
-
205
- ```typescript
206
- type IdentifyParameters<
207
- M extends TESIEntryMethod,
208
- EPx extends ESIEndpointOf<M> | string,
209
- Opt extends Record<string, unknown>,
210
- Entry = _ESIResponseType<M, EPx>,
211
- Keys = Exclude<keyof Entry, "result" | "tag" | "cachedSeconds">
212
- > = RequireThese<Opt, Keys> & Pick<Entry, Keys>;
213
- ```
214
-
215
- <details>
216
- > Example
217
-
218
- ```typescript
219
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
220
- type ExampleOpt = { auth: string };
221
- type IdentifiedParams = IdentifyParameters<"get", "/example/endpoint", ExampleOpt, ExampleEntry>;
222
- // Result: { auth: string } & { auth: string }
223
- ```
224
- </details>
225
-
226
- ## InferESIResponseResult
227
-
228
- `InferESIResponseResult` is a type that infers the result type of an ESI response based on the method and endpoint.
229
-
230
- ```typescript
231
- type InferESIResponseResult<
232
- M extends TESIEntryMethod,
233
- EPx extends ESIEndpointOf<M> | string
234
- > = _ESIResponseType<M, EPx> extends { result: infer U } ? U : never;
235
- ```
236
-
237
- <details>
238
- > Example
239
-
240
- ```typescript
241
- type Result = InferESIResponseResult<"get", "/characters/{character_id}/">;
242
- // Result: The inferred type of the response for the given method and endpoint.
243
- ```
244
- </details>
245
-
246
- ## NoContentResponse
247
-
248
- `NoContentResponse` is a type that represents a response with no content (HTTP status 204).
249
-
250
- ```typescript
251
- type NoContentResponse = { /* status: 204 */ };
252
- ```
253
-
254
- ## TESIEntryMethod
255
-
256
- `TESIEntryMethod` is a type that represents the HTTP methods supported by ESI.
257
-
258
- ```typescript
259
- type TESIEntryMethod = keyof TESIResponseOKMap;
260
- ```
261
-
262
- <details>
263
- > Example
264
-
265
- ```typescript
266
- "get" | "post" | "put" | "delete"
267
- ```
268
- </details>
269
-
270
- ## ESIEndpointOf
271
-
272
- `ESIEndpointOf` is a type that represents the endpoints for the specified HTTP method.
273
-
274
- ```typescript
275
- type ESIEndpointOf<M extends TESIEntryMethod> = keyof TESIResponseOKMap[M];
276
- ```
277
-
278
- <details>
279
- > Example
280
-
281
- ```typescript
282
- type TEndPointGet = ESIEndpointOf<"get">;
283
- type TEndPointPost = ESIEndpointOf<"post">;
284
- type TEndPointPut = ESIEndpointOf<"put">;
285
- type TEndPointDelete = ESIEndpointOf<"delete">;
286
- ```
287
- </details>
288
-
289
- ## TESIResponseGetEntry
290
-
291
- `TESIResponseGetEntry` is a type that represents the entry details for the "get" method.
292
-
293
- ```typescript
294
- type TESIResponseGetEntry<K extends TEndPointGet> = TESIResponseOKMap["get"][K];
295
- ```
296
-
297
- ## TESIResponsePutEntry
298
-
299
- `TESIResponsePutEntry` is a type that represents the entry details for the "put" method.
300
-
301
- ```typescript
302
- type TESIResponsePutEntry<K extends TEndPointPut> = TESIResponseOKMap["put"][K];
303
- ```
304
-
305
- ## TESIResponsePostEntry
306
-
307
- `TESIResponsePostEntry` is a type that represents the entry details for the "post" method.
308
-
309
- ```typescript
310
- type TESIResponsePostEntry<K extends TEndPointPost> = TESIResponseOKMap["post"][K];
311
- ```
312
-
313
- ## TESIResponseDeleteEntry
314
-
315
- `TESIResponseDeleteEntry` is a type that represents the entry details for the "delete" method.
316
-
317
- ```typescript
318
- type TESIResponseDeleteEntry<K extends TEndPointDelete> = TESIResponseOKMap["delete"][K];
319
- ```