mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 10:42:10 +00:00
Made lang settings public, Edited function params
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
f235c62c58
commit
f7044c7b10
@ -4,8 +4,8 @@ import { SetSingle, SetRequest } from './interfaces/Set'
|
|||||||
import { CardSingle } from './interfaces/Card'
|
import { CardSingle } from './interfaces/Card'
|
||||||
import { ExpansionSingle } from './interfaces/Expansion'
|
import { ExpansionSingle } from './interfaces/Expansion'
|
||||||
|
|
||||||
export default class TCGDex {
|
export default class TCGdex {
|
||||||
private lang: Langs = "en"
|
public lang: Langs = "en"
|
||||||
|
|
||||||
public constructor(lang?: Langs) {
|
public constructor(lang?: Langs) {
|
||||||
if (lang) this.lang = lang
|
if (lang) this.lang = lang
|
||||||
@ -19,7 +19,9 @@ export default class TCGDex {
|
|||||||
return this.getBaseUrl()
|
return this.getBaseUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getCard(id: string, set?: string): Promise<CardSingle> {
|
public async getCard(id: string|number, set: string): Promise<CardSingle>;
|
||||||
|
public async getCard(id: string): Promise<CardSingle>;
|
||||||
|
public async getCard(id: string|number, set?: string): Promise<CardSingle> {
|
||||||
try {
|
try {
|
||||||
const txt = set ? `sets/${set}` : "cards"
|
const txt = set ? `sets/${set}` : "cards"
|
||||||
const resp = await fetch(`${this.gbu()}/${txt}/${id}`)
|
const resp = await fetch(`${this.gbu()}/${txt}/${id}`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user