mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-07-24 23:29:49 +00:00
feat: Allow a user to filters elements on the API (#275)
This commit is contained in:
47
src/models/CardResume.ts
Normal file
47
src/models/CardResume.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import type { Extension, Quality } from '../interfaces'
|
||||
import type Card from './Card'
|
||||
import Model from './Model'
|
||||
|
||||
export default class CardResume extends Model {
|
||||
/**
|
||||
* Globally unique card ID based on the set ID and the cards ID within the set
|
||||
*/
|
||||
public id!: string
|
||||
|
||||
/**
|
||||
* Card image url without the extension and quality
|
||||
*
|
||||
* @see {@link getImageURL}
|
||||
*/
|
||||
public image?: string
|
||||
|
||||
/**
|
||||
* ID indexing this card within its set, usually just its number
|
||||
*/
|
||||
public localId!: string
|
||||
|
||||
/**
|
||||
* Card Name (Including the suffix if next to card name)
|
||||
*/
|
||||
public name!: string
|
||||
|
||||
/**
|
||||
* the the Card Image full URL
|
||||
*
|
||||
* @param {Quality} quality the quality you want your image to be in
|
||||
* @param {Extension} extension extension you want you image to be
|
||||
* @return the full card URL
|
||||
*/
|
||||
public getImageURL(quality: Quality = 'high', extension: Extension = 'png'): string {
|
||||
return `${this.image}/${quality}.${extension}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full Card
|
||||
*
|
||||
* @return the full card if available
|
||||
*/
|
||||
public async getCard(): Promise<Card> {
|
||||
return (await this.sdk.card.get(this.id))!
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user