guildwars2-ts
Version:
GuildWars 2 API Wrapper in Typescript
51 lines (36 loc) • 2.04 kB
Markdown
[![NPM version][npm-image]][npm-link]
[![License][license]][license-file]
This project is a third-party package, and is strictly not affiliated with GuildWars2, ArenaNet, or NCSoft.
When used, no data is saved by, or sent to the developers, including but not limited to the logs, api tokens, or any objects returned by the endpoints.
Full support of all endpoints listed in the [API:2 Wiki](https://wiki.guildwars2.com/wiki/API:2) page
```typescript
import { GW2Api, ApiLanguage, setLogLevel, LogLevel } from "guildwars2-ts";
const api: GW2Api = new GW2Api({
// Token is not required for all of the endpoints
token: "YOUR-TOKEN-HERE",
language: ApiLanguage.English,
rateLimitRetry: true
});
// Set to error by default, so you can set it to info for extra verbosity
setLogLevel(LogLevel.info);
(async () => {
// Obtain names of all characters on the account
await api.account.get().then(console.log);
// Obtain details about each of them
await api.characters.get().then((characters) => {
characters.forEach(async (character) => {
await api.characters.getCore(character).then(console.log);
});
});
})();
```
If you encounter any kinds of errors, or wish to add/update the functionality provided by this project, please feel free to open a pull request against the [development branch](https://gitlab.com/dinckelman/guildwars2-ts/-/tree/dev).
Otherwise, please check open [issue reports](https://gitlab.com/dinckelman/guildwars2-ts/-/issues/), to see if there is an existing discussion on the issue, or open a new request. In case of runtime errors, request validation error logs are extremely helpful, so please include them in the report, as guided by the template.
[]: https://img.shields.io/npm/v/guildwars2-ts
[]: https://www.npmjs.com/package/guildwars2-ts
[]: https://img.shields.io/gitlab/license/dinckelman%2Fguildwars2-ts
[]: LICENSE