mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 10:42:10 +00:00
Updated Documentation
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
8e3de78b00
commit
fbf6f2e2cd
186
CHANGELOGS.md
Normal file
186
CHANGELOGS.md
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]()
|
||||||
|
|
||||||
|
## [2.0.2-2.0.3] - 2021-05-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `rotationMark` should have been named `regulationMark`
|
||||||
|
|
||||||
|
## [2.0.1] - 2021-05-28
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Hardcoded string values are now strings as they depends on the language
|
||||||
|
|
||||||
|
## [2.0.0] - 2021-05-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- simple string endpoint typing
|
||||||
|
- Typing is exported through the main.d.ts file
|
||||||
|
- `cardCount` field in the set interface
|
||||||
|
- a `rotationMark` to the card interface
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Support new incoming datas
|
||||||
|
- Point the SDK to the new V2
|
||||||
|
- Renamed `getExpansion(s)` to `getSerie(s)`
|
||||||
|
- Typing for the new SDK
|
||||||
|
- Functions now use `fetch` instead of `get` in their names
|
||||||
|
- URL Normalization is now done by the SDK
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `getSerie(s)` now point to the correct endpoint
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- TranslationUtil as now translation are managed by the API
|
||||||
|
- the interfaces folder as every interfaces are now in `interfaces.d.ts`
|
||||||
|
- `this.gbu`
|
||||||
|
- Translation files as they are now in the Compiler
|
||||||
|
|
||||||
|
## [1.7.0] - 2021-01-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- new Rarities
|
||||||
|
|
||||||
|
## [1.6.1] - 2021-01-31
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- tags are now optionnal
|
||||||
|
|
||||||
|
## [1.6.0] - 2021-01-08
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Errors are now handled to return `undefined`
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- console.warn when using `getCards`
|
||||||
|
|
||||||
|
## [1.5.0] - 2021-01-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- getSet can now not transform the API Date to a Javascript Date
|
||||||
|
|
||||||
|
## [1.4.2] - 2021-01-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- new Tags
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- rarities to have less strange rarities
|
||||||
|
-
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- CORS blocked
|
||||||
|
|
||||||
|
|
||||||
|
## [1.4.1] - 2020-04-24
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed API url to the new one
|
||||||
|
|
||||||
|
## [1.4.0] - 2020-03-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- a `defaultLang` static field to customize the default lang
|
||||||
|
- a `getLang` function to get the current lang for the SDK
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Warnings for translations
|
||||||
|
|
||||||
|
## [1.3.0] - 2020-03-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A cache system
|
||||||
|
- some informations about differents tags on a card
|
||||||
|
- lvl on the card interface
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- cardTypes on the card interface
|
||||||
|
|
||||||
|
## [1.2.1] - 2020-03-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix items datas not in the correct interface
|
||||||
|
|
||||||
|
## [1.2.0] - 2020-03-14
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added The getCards endpoint to fetch the big list of card with an optionnal filter on the set
|
||||||
|
- Added The getExpansions endpoint to fetch the list of expansions
|
||||||
|
- Added Some informations about cardTypes
|
||||||
|
- Updated DB to add support for items
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix translation not getting the correct file
|
||||||
|
|
||||||
|
|
||||||
|
## [1.0.8] - 2020-03-11
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed typing for some interfaces
|
||||||
|
|
||||||
|
## [1.0.1-1.0.7] - 2020-03-11
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Renamed the class Name from `TCGDex` to `TCGdex`
|
||||||
|
- lang argument is now public so it can be changed while the SDK is active
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- some typing for getCard and translationUtil
|
||||||
|
|
||||||
|
## [1.0.0] - 2020-03-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- the getCard function to use with the fetch a card with it's id
|
||||||
|
- the getSet function to use with the fetch a set with it's id
|
||||||
|
- the getExpansion function to use with the fetch an expansion with it's id
|
||||||
|
- Constructor arg support for multiple langs
|
||||||
|
- TranslationUtil to go from the SDK value to a text value
|
||||||
|
|
||||||
|
[2.0.2-2.0.3]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.3
|
||||||
|
[2.0.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.1
|
||||||
|
[2.0.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.0
|
||||||
|
[1.7.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.7.0
|
||||||
|
[1.6.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.6.1
|
||||||
|
[1.6.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.6.0
|
||||||
|
[1.5.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.5.0
|
||||||
|
[1.4.2]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.2
|
||||||
|
[1.4.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.1
|
||||||
|
[1.4.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.0
|
||||||
|
[1.3.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.3.0
|
||||||
|
[1.2.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.2.1
|
||||||
|
[1.2.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.2.0
|
||||||
|
[1.0.8]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.0.8
|
||||||
|
[1.0.1-1.0.7]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.0.7
|
||||||
|
[1.0.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.0.0
|
48
README.md
48
README.md
@ -1,14 +1,14 @@
|
|||||||
# TCGdex Javacript SDK
|
# TCGdex Javacript SDK
|
||||||
|
|
||||||
|
This is the SDK used to communicate with the Open source [TCGdex API](https://www.github.com/tcgdex/cards-database)
|
||||||
|
|
||||||
|
Full API/SDK documentation in progress at https://www.tcgdex.net/docs
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
### Yarn/npm
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn add @tcgdex/sdk
|
yarn add @tcgdex/sdk
|
||||||
```
|
# or
|
||||||
or with npm
|
|
||||||
```bash
|
|
||||||
npm install @tcgdex/sdk
|
npm install @tcgdex/sdk
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -18,27 +18,33 @@ _Note: a complete documentation is in progress_
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import TCGdex from '@tcgdex/sdk'
|
import TCGdex from '@tcgdex/sdk'
|
||||||
import TranslationUtil from '@tcgdex/sdk/TranslationUtil'
|
|
||||||
import Tag from '@tcgdex/sdk/interfaces/Tag'
|
|
||||||
|
|
||||||
// init the class
|
// initialize the SDK
|
||||||
const tcgdex = new TCGdex("en") // Lang code (Optionnal) (See TranslationUtil.ts line 3)
|
const tcgdex = new TCGdex('en') // Lang code (Optionnal) (See interfaces.d.ts line 1 for supported languages)
|
||||||
|
|
||||||
// change lang
|
// if you need to change the language
|
||||||
tcgdex.lang = "fr"
|
tcgdex.lang = 'fr'
|
||||||
|
|
||||||
// get Card object wih global id
|
// get a Card using its global ID
|
||||||
await tcgdex.getCard("base1-1")
|
await tcgdex.fetch('cards', 'base1-1')
|
||||||
|
|
||||||
// get Card object with local id and set
|
// fetch a Card using it's local id and set name/ID
|
||||||
await tcgdex.getCard(1, "base1")
|
await tcgdex.fetch('sets', 'Base Set', 1)
|
||||||
|
|
||||||
// get Set informations
|
// fetch a Set's informations using the set's name/ID
|
||||||
await tcgdex.getSet("base1")
|
await tcgdex.fetch('sets', 'Sword & Shield')
|
||||||
|
|
||||||
// get Expansion
|
// Fetch a serie using the serie's name/ID
|
||||||
await tcgdex.getExpansion("base")
|
await tcgdex.fetch('series', 'Black & White')
|
||||||
|
|
||||||
// Translate information from code to the lang
|
// Fetch cards using other endpoints
|
||||||
TranslationUtil.translate("tag", Tag.STAGE2, "en")
|
/**
|
||||||
|
* categories => the the different cards categories
|
||||||
|
* 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
|
||||||
|
* types => fetch the cards using the Pokémon type(s)
|
||||||
|
**/
|
||||||
|
await tcgdex.fetch('categories')
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user