mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 10:42:10 +00:00
Bump deps
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
3d8ef329f7
commit
496c04fc4c
216
README.md
216
README.md
@ -1,83 +1,133 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.tcgdex.net">
|
<a href="https://www.tcgdex.net">
|
||||||
<img src="https://www.tcgdex.net/assets/og.png" width="90%" alt="TCGdex Main Image">
|
<img src="https://www.tcgdex.net/assets/og.png" width="90%" alt="TCGdex Main Image">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="http://npmjs.com/@tcgdex/sdk">
|
<a href="http://npmjs.com/@tcgdex/sdk">
|
||||||
<img src="https://img.shields.io/npm/v/@tcgdex/sdk?style=flat-square" alt="NOM Version">
|
<img src="https://img.shields.io/npm/v/@tcgdex/sdk?style=flat-square" alt="NOM Version">
|
||||||
</a>
|
</a>
|
||||||
<a href="http://npmjs.com/@tcgdex/sdk">
|
<a href="http://npmjs.com/@tcgdex/sdk">
|
||||||
<img src="https://img.shields.io/npm/dw/@tcgdex/sdk?style=flat-square" alt="NPM Downloads">
|
<img src="https://img.shields.io/npm/dm/@tcgdex/sdk?style=flat-square" alt="NPM Downloads">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://app.codecov.io/gh/tcgdex/javascript-sdk/">
|
<a href="https://app.codecov.io/gh/tcgdex/javascript-sdk/">
|
||||||
<img src="https://img.shields.io/codecov/c/github/tcgdex/javascript-sdk?style=flat-square&token=FR4BI94N4Q" alt="npm version">
|
<img src="https://img.shields.io/codecov/c/github/tcgdex/javascript-sdk?style=flat-square&token=FR4BI94N4Q" alt="npm version">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/tcgdex/javascript-sdk/blob/master/LICENSE.md">
|
<a href="https://github.com/tcgdex/javascript-sdk/stargazers">
|
||||||
<img src="https://img.shields.io/github/license/tcgdex/javascript-sdk?style=flat-square" alt="the TCGdex JAvascript SDK is released under the MIT license." />
|
<img src="https://img.shields.io/github/stars/tcgdex/javascript-sdk?style=flat-square" alt="Github stars">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/tcgdex/javascript-sdk/actions/workflows/build.yml">
|
<a href="https://github.com/tcgdex/javascript-sdk/actions/workflows/build.yml">
|
||||||
<img src="https://img.shields.io/github/workflow/status/tcgdex/javascript-sdk/Build%20&%20Test?style=flat-square" alt="the TCGdex JAvascript SDK is released under the MIT license." />
|
<img src="https://img.shields.io/github/workflow/status/tcgdex/javascript-sdk/Build%20&%20Test?style=flat-square" alt="the TCGdex JAvascript SDK is released under the MIT license." />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://discord.gg/NehYTAhsZE">
|
<a href="https://discord.gg/NehYTAhsZE">
|
||||||
<img src="https://img.shields.io/discord/857231041261076491?color=%235865F2&label=Discord&style=flat-square" alt="Discord Link">
|
<img src="https://img.shields.io/discord/857231041261076491?color=%235865F2&label=Discord&style=flat-square" alt="Discord Link">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# TCGdex JavaScript/TypeScript SDK
|
# TCGdex JavaScript/TypeScript SDK
|
||||||
|
|
||||||
Communicate with the Open Source TCGdex API in Javascript/Typescript using the SDK
|
The Javascript/Typescript SDK provides a convenient access with the Open Source TCGdex API.
|
||||||
|
|
||||||
Full API/SDK documentation in progress at https://www.tcgdex.net/docs
|
The SDK is available in ESM and CommonJS and should be automaticly chosen.
|
||||||
|
|
||||||
## Getting Started
|
## Documentation
|
||||||
|
|
||||||
Install the SDK using:
|
_The full API/SDK documentation in progress at [API Documentation - TCGdex](https://www.tcgdex.dev)_
|
||||||
```bash
|
|
||||||
yarn add @tcgdex/sdk
|
### Getting Started
|
||||||
# or
|
|
||||||
npm install @tcgdex/sdk
|
#### How To install
|
||||||
```
|
|
||||||
|
**In the browser**
|
||||||
or in the web browser
|
|
||||||
```html
|
To use the SDK in the browser, simply add the following script tag to your
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@tcgdex/sdk@2/dist/tcgdex.browser.js"></script>
|
HTML pages:
|
||||||
```
|
|
||||||
|
```html
|
||||||
## Usage
|
<script src="https://cdn.jsdelivr.net/npm/@tcgdex/sdk@2/dist/tcgdex.browser.js"></script>
|
||||||
|
```
|
||||||
_Note: a complete documentation is in progress_
|
|
||||||
|
You cna also download the script from [JSDelivr](https://cdn.jsdelivr.net/npm/@tcgdex/sdk@2/dist/tcgdex.browser.js) by right clicking the link and selecting save link as.
|
||||||
```javascript
|
|
||||||
// only if using with NPM/Yarn
|
**In Node.js**
|
||||||
import TCGdex from '@tcgdex/sdk'
|
|
||||||
|
Simply type the following into a terminal window:
|
||||||
// initialize the SDK
|
|
||||||
const tcgdex = new TCGdex('en') // Lang code (Optionnal) (See interfaces.ts line 1 for supported languages)
|
```bash
|
||||||
|
npm install @tcgdex/sdk
|
||||||
// if you need to change the language
|
```
|
||||||
tcgdex.lang = 'fr'
|
|
||||||
|
#### Usage
|
||||||
// get a Card using its global ID
|
|
||||||
await tcgdex.fetch('cards', 'base1-1')
|
_Note: a complete documentation is available at [TCGdex.dev](https://www.tcgdex.dev)_
|
||||||
|
|
||||||
// fetch a Card using it's local id and set name/ID
|
**Example: Fetch a Card**
|
||||||
await tcgdex.fetch('sets', 'Base Set', 1)
|
|
||||||
|
```typescript
|
||||||
// fetch a Set's informations using the set's name/ID
|
// Import the SDK in Typescript
|
||||||
await tcgdex.fetch('sets', 'Sword & Shield')
|
import TCGdex from '@tcgdex/sdk';
|
||||||
|
|
||||||
// Fetch a serie using the serie's name/ID
|
// Instantiate the SDK
|
||||||
await tcgdex.fetch('series', 'Black & White')
|
// note: you can use one of the following lanugages
|
||||||
|
const tcgdex = new TCGdex('en');
|
||||||
// Fetch cards using other endpoints
|
|
||||||
/**
|
// Card will be Furret from the Darkness Ablaze Set
|
||||||
* categories => the the different cards categories
|
const card = await tcgdex.fetch('cards', 'swsh3-136');
|
||||||
* hp => fetch the different cards possible HPs
|
|
||||||
* illustrators => fetch all the cards illustrators
|
// You can also get the same result using
|
||||||
* rarities => fetch the cards rarities
|
const card = await tcgdex.fetch('sets', 'Darkness Ablaze', 136);
|
||||||
* retreats => fetch the cards using the retreat count
|
```
|
||||||
* types => fetch the cards using the Pokémon type(s)
|
|
||||||
**/
|
**Other Examples**
|
||||||
await tcgdex.fetch('categories')
|
|
||||||
```
|
```javascript
|
||||||
|
// fetch a Set's informations using the set's name or ID
|
||||||
|
await tcgdex.fetch('sets', 'Darkness Ablaze')
|
||||||
|
|
||||||
|
// Fetch a serie using the serie's name or ID
|
||||||
|
await tcgdex.fetch('series', 'Sword & Shield')
|
||||||
|
|
||||||
|
// Fetch cards possible pokemon cards HP
|
||||||
|
await tcgdex.fetch('hp');
|
||||||
|
|
||||||
|
// Fetch Cards with the specific number of HP
|
||||||
|
await tcgdex.fetch('hp', 110);
|
||||||
|
|
||||||
|
// Fetch cards possible illustrators
|
||||||
|
await tcgdex.fetch('illustrators');
|
||||||
|
|
||||||
|
// Fetch Cards with the specific illustrator
|
||||||
|
await tcgdex.fetch('illustrators', 'tetsuya koizumi');
|
||||||
|
```
|
||||||
|
|
||||||
|
**Other Endpoints**
|
||||||
|
|
||||||
|
_They work like the two (`hp` and `illustrators`) abose_
|
||||||
|
|
||||||
|
- categories: the the different cards categories
|
||||||
|
- energy-types: Fetch different types of energies
|
||||||
|
- hp: fetch the different cards possible HPs
|
||||||
|
- illustrators: fetch all the cards illustrators
|
||||||
|
- rarities: fetch the cards rarities
|
||||||
|
- retreats: fetch the cards using the retreat count
|
||||||
|
- stages: fetch differents cards stages
|
||||||
|
- suffixes: fetch differents cards suffixes
|
||||||
|
- trainer-types: fetch trainer cards types
|
||||||
|
- dex-ids: fetch pokemon Global Pokédex IDS
|
||||||
|
- types: fetch the cards using the Pokémon type(s)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
See [CONTRIBUTING.md](https://github.com/tcgdex/javascript-sdk/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
TL::DR
|
||||||
|
|
||||||
|
- Fork
|
||||||
|
|
||||||
|
- Commit your changes
|
||||||
|
|
||||||
|
- Pull Request on this Repository
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the IT License. A copy of the license is available at [LICENSE.md](https://github.com/tcgdex/javascript-sdk/blob/master/LICENSE.md)
|
||||||
|
5971
package-lock.json
generated
5971
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,10 +27,10 @@
|
|||||||
"@babel/preset-typescript": "^7.14.5",
|
"@babel/preset-typescript": "^7.14.5",
|
||||||
"@dzeio/config": "^1.0.0",
|
"@dzeio/config": "^1.0.0",
|
||||||
"@types/node-fetch": "^2.5.10",
|
"@types/node-fetch": "^2.5.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
||||||
"@typescript-eslint/parser": "^4.28.0",
|
"@typescript-eslint/parser": "^5.7.0",
|
||||||
"esbuild": "^0.12.15",
|
"esbuild": "^0.14.5",
|
||||||
"eslint": "^7.29.0",
|
"eslint": "^8.4.1",
|
||||||
"jest": "^27.0.5",
|
"jest": "^27.0.5",
|
||||||
"ts-node": "^10.0.0",
|
"ts-node": "^10.0.0",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user