Extracted main types of ESI. Used for ESI request response types.
This package is configured to use version 2 only.
- If you need to use version 1, please refer to the following link:
eve-esi-types v1
Sample code is provided ->
request-v3.mjs
$ node request-v3.mjs
The following function signature allows you to benefit from
eve-esi-types
.
By specifying the method (get
,post
,put
,delete
) for eachendpoint
,
you can determine the result type of the ESI request, what query parameters are required,
and whether OAuth authentication is necessary (auth: true
).
// This function signature has been removed in version 3.x
// export declare function fire<
// M extends TESIEntryMethod,
// EP extends keyof TESIResponseOKMap[M],
// P2 extends IfParameterizedPath<EP, Opt>,
// Opt extends IdentifyParameters<TESIResponseOKMap[M][EP], ESIRequestOptions>,
// R extends InferESIResponseResult<M, EP>
// >(mthd: M, endp: EP, pathParams?: P2, opt?: Opt): Promise<R>;
Introduced intuitive ESI request handling using "tags" from the EVE Swagger JSON.
Utilized
to generate ESI request API objects with narrowed endpoints by accessing camel-cased "tags".injectESIRequestBody
import * as taggedApi from "eve-esi-types/lib/tagged-request-api.mjs";
// `injectESIRequestBody` has been removed in version 3.x
// const esiRequest = taggedApi.injectESIRequestBody(...);
// const ret = await esiRequest.universe.get("/universe/structures/", { query: { filter: "market" }});
- or
// Minimal default ESI request body implementation
import { esi } from "eve-esi-types/lib/tagged-request-api.mjs";
const ret = await esi.universe.get("/universe/structures/", { query: { filter: "market" }});
TESIRequestFunctionSignature
has been renamed to TESIRequestFunctionSignature2
and the generic parameters have been changed.
RealEP
andEP
help maintain endpoint inference.
WithRealEP
, TypeScript inference partially lists the possible endpoints while allowing for path parameter replacement.
type TESIRequestFunctionSignature2<ActualOpt> = <
M extends TESIEntryMethod,
RealEP extends ReplacePathParams<keyof TESIResponseOKMap[M] & string> | keyof TESIResponseOKMap[M],
EP extends InferEndpointOrigin<RealEP, keyof TESIResponseOKMap[M]> extends never ? RealEP : InferEndpointOrigin<RealEP, keyof TESIResponseOKMap[M]>,
// If RealEP points to an endpoint origin (not a replaced endpoint), the path parameter is required
PathParams extends RealEP extends EP ? IfNeedPathParams<EP> : TPathParamsNever,
Opt extends IdentifyParameters<TESIResponseOKMap[M][EP], ActualOpt & PathParams>,
R extends InferESIResponseResult<M, EP>
>(method: M, endpoint: RealEP, options?: Opt) => Promise<R>;
-
NOTE: Accordingly, the generic parameters for other request function signatures have also been changed, with "2" appended to their names.
-
IESIRequestFunction
->IESIRequestFunction2
-
TESIRequestFunctionMethods
->TESIRequestFunctionMethods2
-
TESIRequestFunctionEachMethod
->TESIRequestFunctionEachMethod2
- etc. Also,
v2/esi-tagged-types.d.ts
too
-
Utilized
decoreateESIRequestBody
to generate ESI request API objects with narrowed endpoints by accessing camel-cased "tags".
import * as taggedApi from "eve-esi-types/lib/tagged-request-api.mjs";
const esiRequest = taggedApi.decoreateESIRequestBody(...);
const ret = await esiRequest.universe.get("/universe/structures/", { query: { filter: "market" }});