Extracted main types of ESI (EVE Swagger Interface). This package is designed to handle ESI request and response types effectively.
eve-esi-types
helps developers interact with the EVE Online ESI API while leveraging strong TypeScript typings.
This package ensures type safety for ESI request parameters, response handling, and authentication requirements.
npm install eve-esi-types
This package is configured to use ESI version 2 by default.
If you need to work with version 1, refer to the v1 branch.
A sample script, request-v3.mjs
, is provided.
node request-v3.mjs
The core export of this package is the TESIRequestFunctionSignature2
type. It specifies the required endpoint,
HTTP method, query parameters, OAuth requirement, and response type for ESI requests.
type TESIRequestFunctionSignature2<ActualOpt extends Record<string, unknown>> = <
Mtd extends TESIEntryMethod,
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
EPO extends ResolvedEndpoint<Mtd, REP>,
Params extends ResolveEndpointParameters<Mtd, REP, EPO, ActualOpt>,
Opt extends Params["finalOptions"]
>(
method: Mtd,
endpoint: REP,
...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]
) => Promise<Params["result"]>;
You can enable authenticated requests by setting the environment variable OAUTH_TOKEN
(for testing):
export OAUTH_TOKEN=<Your Access Token>
- Added support for specifying the
OAUTH_TOKEN
environment variable. - Allows authenticated tests to run successfully by providing an OAuth access token.
- Renamed
TESIRequestFunctionSignature
toTESIRequestFunctionSignature2
. - Improved endpoint inference (
RealEP
andEP
) for better TypeScript type safety.
Reusable, narrowing-focused API request using decoreateESIRequestBody
:
import * as taggedApi from "eve-esi-types/lib/tagged-request-api.mjs";
const esiRequest = taggedApi.decoreateESIRequestBody(...);
const response = await esiRequest.universe.get("/universe/structures/", { query: { filter: "market" } });
IESIRequestFunction -> IESIRequestFunction2
TESIRequestFunctionMethods -> TESIRequestFunctionMethods2
- Introduced intuitive ESI request handling via ESI Tagged Types.
- Deprecated
injectESIRequestBody
in favor ofdecoreateESIRequestBody
in later versions.
Minimal default implementation:
import { esi } from "eve-esi-types/lib/tagged-request-api.mjs";
const response = await esi.universe.get("/universe/structures/", { query: { filter: "market" } });
Have questions or issues? Feel free to explore the GitHub repository or open an issue!