Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gw2

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gw2 - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

40

index.js
const got = require('got')
const api = got.extend({
baseUrl: 'https://api.guildwars2.com/v2/',
json: true,
})
const gw2 = (path, { token = null, headers = {}, ...options } = {}) =>
api
.get(path, {
...options,
headers: {
...headers,
Authorization: token && `Bearer ${token}`,
},
class Client {
constructor({
baseUrl = 'https://api.guildwars2.com/',
version = '2',
token = null,
} = {}) {
this.client = got.extend({
baseUrl: `${baseUrl}v${version}/`,
json: true,
})
.then(res => res.body)
this.token = token
}
get(path, { token = null, headers = {}, ...options } = {}) {
return this.client
.get(path, {
...options,
headers: {
...headers,
Authorization: token && `Bearer ${token}`,
},
})
.then(res => res.body)
}
}
module.exports = {
gw2,
Client,
}
{
"name": "gw2",
"version": "0.0.0",
"version": "0.0.1",
"description": "Guild Wars 2 API client for Node.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -14,7 +14,9 @@ Guild Wars 2 API client for Node.

gw2('achievements/daily').then(data => {
const client = new gw2.Client()
client.get('achievements/daily').then(data => {
//
})
gw2('account', { token: 'API-KEY' }).then(data => {
client.get('account', { token: 'API-KEY' }).then(data => {
//

@@ -21,0 +23,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc