Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 52d96e9

Browse files
committed
Merge branch 'release/v2.0.0'
2 parents 4913c33 + 1af94e2 commit 52d96e9

File tree

14 files changed

+4376
-1376
lines changed

14 files changed

+4376
-1376
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
testing.js
22
lib/
33
docs/
4+
cache/
45

56
### Node ###
67
# Logs

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
1-
# Paladins.js
1+
# paladins.js
22
![NPM License](https://img.shields.io/npm/l/paladins.js.svg?style=flat) ![Downloads](https://img.shields.io/npm/dm/paladins.js.svg?style=flat)
33

44
Paladins.js is a package that helps Hi-Rez/Paladins developers communicate with the API.
55

6+
## 2.0
7+
v2.0 is a complete rewrite of the current paladins.js library. It is not backwards compatible with any version prior.
8+
9+
Differences between 1.x / 2.x:
10+
- The complicated cache process has been redone
11+
- You can pass through more options
12+
- Proper error handling
13+
- Returns promises with proper JSON
14+
- and more...
15+
616
## Install
717
```
818
$ npm install paladins.js
919
```
1020

11-
## Cache Driver
12-
A cache driver is **highly** recommended. If there is no driver, it will create a new session on each request. This will make it so that your usage limits are hit within no time.
13-
14-
We use [cache-driver](https://www.npmjs.com/package/cache-driver) to provide flexibility in what kind of caching system you would like to use, as long as it's an implementation of `cache-driver` then it will work out of the box.
15-
1621
## Usage
1722
*The following examples are in TypeScript, which this package is written in.*
1823

19-
For the usage example's we'll be using [cache](https://www.npmjs.com/package/cache). We also need the `cache-driver` adapter for `cache` which is [here](https://www.npmjs.com/package/cache-driver-cache)
20-
21-
```
22-
$ npm install cache cache-driver-cache
23-
```
24-
2524
```javascript
26-
import API from "paladins.js";
27-
import { CacheAdapter } from "cache-driver-cache";
28-
29-
let api = new API("devId", "auhtKey", new CacheAdapter()); // API loaded and ready to go.
30-
31-
api.getItems().then((response: any) => {
32-
// Do something with response
33-
});
25+
import API from 'paladins.js';
26+
27+
let api = new API({
28+
devId: '1234',
29+
authKey: 'abcd1234'
30+
}); // API loaded and ready to go.
31+
32+
api.getDataUsage()
33+
.then((response: any) => {
34+
// Do something with response
35+
})
36+
.catch((err: any) => {
37+
// Handle the error
38+
});
3439
```
3540

3641
## Documentation / Methods
37-
You can view all the available methods and documentation on the [PaladinsDev website](https://paladins.dev/docs/paladins.js/v/1.1.0/).
42+
You can view all the available methods and documentation on the [PaladinsDev website](https://paladins.dev/docs/paladins.js/v/2.0.0/).

jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
roots: ['<rootDir>/src'],
3+
transform: {
4+
'^.+\\.tsx?$': 'ts-jest',
5+
},
6+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
7+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8+
}

0 commit comments

Comments
 (0)