diff --git a/.gitignore b/.gitignore index 76add87..69694e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -dist \ No newline at end of file +dist +*.tgz diff --git a/.npmignore b/.npmignore index 3e00276..aceb1cd 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,4 @@ +src tsconfig.json -src \ No newline at end of file +dist/coverage +*.tgz diff --git a/README.md b/README.md index c0d3456..a2dc9dc 100644 --- a/README.md +++ b/README.md @@ -2,60 +2,85 @@ This is the TypeScript SDK for the [Pokemon TCG API](https://pokemontcg.io). -## Installation +## Installation -``` -npm install --save pokemon-tcg-sdk-typescript -``` +**npm** + + npm install --save pokemon-tcg-sdk-typescript + +**yarn** + + yarn add pokemon-tcg-sdk-typescript ## Class Definitions ### Card ```typescript -id: number; -name: string; -imageUrl: string; -imageUrlHighRes: string; -subType: ISubType; -superType: ISuperType; ability: IAbility; -hp: number; -number: number; artist: string; -rarity: string; -series: string; -set: ISet; -setCode: string; -retreatCost: string; -text: string; -types: IType[]; attacks: IAttack[]; -weaknesses: string[]; -resistances: string[]; -nationalPokedexNumber: number; -ancientTrait: string; +convertedRetreatCost: number; evolvesFrom: string; +hp: string; +id: string; +imageUrl: string; +imageUrlHiRes: string; +name: string; +nationalPokedexNumber: number; +number: string; +rarity: string; +resistances: IResistance[]; +retreatCost: string[]; +series: string; +set: string; +setCode: string; +subtype: string; +supertype: string; +text: string[]; +types: string[]; +weaknesses: IWeakness[]; +``` + +### IAbility + +```typescript +name: string; +text: string; +type: string; +``` + +### IAttack + +```typescript +cost: string[]; +name: string; +text: string; +damage: string; +convertedEnergyCost: string; +``` + +### IResistance, IWeakness + +```typescript +type: string; +value: string; ``` ### Set ```typescript code: string; -name: string; -series: string; -totalCards: number; -standardLegal: boolean; expandedLegal: boolean; -releaseDate: string; -symbolUrl: string; +logoUrl: string; +name: string; ptcgoCode: string; -``` - -### Type, SubType, SuperType - -```typescript -type: string; +releaseDate: string; +series: string; +standardLegal: boolean; +symbolUrl: string; +totalCards: number; +updatedAt: string; ``` ### IQuery @@ -75,9 +100,9 @@ Set.find(id: string): Promise Set.where(params: IQuery[]): Promise Set.all(): Promise -Type.all(): Promise -SuperType.all(): Promise -SubType.all(): Promise +Meta.allTypes(): Promise +Meta.allSubtypes(): Promise +Meta.allSupertypes(): Promise ``` ## Usage @@ -116,10 +141,15 @@ PokemonTCG.Card.all() ## Contributing * Fork it (click the Fork button at the top of the page) * Create your feature branch (git checkout -b my-new-feature) + * Make some changes and fix some bugs! + * Run the tests `npm run-script test` + * Test your changes in a project of yours: + * Create a link with (npm)[https://docs.npmjs.com/cli/link.html] or (yarn)[https://yarnpkg.com/lang/en/docs/cli/link/] (depending on what tool you installed this SDK with) + * In your project that **uses** the SDK, install the linked package with `yarn/npm link pokemon-tcg-sdk-typescript` + * Verify the SDK behaves as expected, and your changes took effect * Commit your changes (git commit -am 'Add some feature') * Push to the branch (git push origin my-new-feature) * Create a new Pull Request ## TODO * Add more testing? -* Update package name for easier use? \ No newline at end of file diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index a8cc2c9..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,28 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'version', 'patch' ] -2 info using npm@3.5.2 -3 info using node@v6.11.4 -4 info git [ 'status', '--porcelain' ] -5 verbose stack Error: Git working directory not clean. -5 verbose stack M README.md -5 verbose stack M src/index.ts -5 verbose stack at /usr/share/npm/lib/version.js:172:21 -5 verbose stack at ChildProcess.exithandler (child_process.js:189:7) -5 verbose stack at emitTwo (events.js:106:13) -5 verbose stack at ChildProcess.emit (events.js:191:7) -5 verbose stack at maybeClose (internal/child_process.js:920:16) -5 verbose stack at Socket. (internal/child_process.js:351:11) -5 verbose stack at emitOne (events.js:96:13) -5 verbose stack at Socket.emit (events.js:188:7) -5 verbose stack at Pipe._handle.close [as _onclose] (net.js:497:12) -6 verbose cwd /home/bradyn/Projects/pokemon-tcg-sdk-typescript -7 error Linux 4.13.0-21-generic -8 error argv "/usr/bin/node" "/usr/bin/npm" "version" "patch" -9 error node v6.11.4 -10 error npm v3.5.2 -11 error Git working directory not clean. -11 error M README.md -11 error M src/index.ts -12 error If you need help, you may report this error at: -12 error -13 verbose exit [ 1, true ] diff --git a/package-lock.json b/package-lock.json index 6db4699..7fb778e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pokemon-tcg-sdk-typescript", - "version": "1.0.3", + "version": "1.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -50,9 +50,9 @@ "dev": true }, "axios": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", - "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", "requires": { "follow-redirects": "1.5.10", "is-buffer": "^2.0.2" @@ -343,9 +343,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", diff --git a/package.json b/package.json index 60b7c3c..9e49118 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pokemon-tcg-sdk-typescript", - "version": "1.0.3", + "version": "1.2.2", "description": "Typescript SDK for the PokemonTCG API (https://pokemontcg.io)", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -11,12 +11,21 @@ "SDK" ], "scripts": { - "test": "mocha --reporter spec --require ts-node/register 'src/**/*.test.ts'" + "test": "mocha --reporter spec --require ts-node/register 'src/**/*.test.ts'", + "build": "tsc" }, - "author": "Bradyn Glines", + "repository": { + "type": "git", + "url": "https://github.com/PokemonTCG/pokemon-tcg-sdk-typescript" + }, + "contributors": [ + "Bradyn Glines (https://github.com/glinesbdev)", + "CptSpaceToaster (https://github.com/CptSpaceToaster)", + "Monbrey (https://github.com/Monbrey)" + ], "license": "MIT", "dependencies": { - "axios": "^0.18.1", + "axios": "^0.19.0", "typescript": "^2.6.2" }, "devDependencies": { diff --git a/src/classes/ability.ts b/src/classes/ability.ts deleted file mode 100644 index 19fecac..0000000 --- a/src/classes/ability.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { IAbility } from '../interfaces/ability'; - -export class Ability implements IAbility { - name: string; - text: string; - type: string; - - constructor() {} -} \ No newline at end of file diff --git a/src/classes/ancientAbility.ts b/src/classes/ancientAbility.ts deleted file mode 100644 index 4017e3d..0000000 --- a/src/classes/ancientAbility.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { IAncientAbility } from '../interfaces/ancientAbility'; - -export class AncientAbility implements IAncientAbility { - name: string; - text: string; - - constructor() {} -} \ No newline at end of file diff --git a/src/classes/attack.ts b/src/classes/attack.ts deleted file mode 100644 index c37acd5..0000000 --- a/src/classes/attack.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IAttack } from '../interfaces/attack'; - -export class Attack implements IAttack { - cost: string; - name: string; - text: string; - damage: string; - convertedEnergyCost: string; - - constructor() {} -} \ No newline at end of file diff --git a/src/classes/card.ts b/src/classes/card.ts index f4ea3e6..a2a2185 100644 --- a/src/classes/card.ts +++ b/src/classes/card.ts @@ -1,40 +1,36 @@ -import { ICard } from '../interfaces/card'; -import { ISubType } from '../interfaces/subType'; -import { ISuperType } from '../interfaces/superType'; import { IAbility } from '../interfaces/ability'; -import { ISet } from '../interfaces/set'; -import { IType } from '../interfaces/type'; import { IAttack } from '../interfaces/attack'; -import { QueryBuilder } from '../queryBuilder'; +import { ICard } from '../interfaces/card'; import { IQuery } from '../interfaces/query'; +import { IResistance } from '../interfaces/resistance'; +import { IWeakness } from '../interfaces/weakness'; +import { QueryBuilder } from '../queryBuilder'; export class Card implements ICard { - id: number; - name: string; - imageUrl: string; - imageUrlHighRes: string; - subType: ISubType; - superType: ISuperType; ability: IAbility; - hp: number; - number: number; artist: string; - rarity: string; - series: string; - set: ISet; - setCode: string; - retreatCost: string; - text: string; - types: IType[]; attacks: IAttack[]; - weaknesses: string[]; - resistances: string[]; - nationalPokedexNumber: number; - ancientTrait: string; + convertedRetreatCost: number; evolvesFrom: string; + hp: string; + id: string; + imageUrl: string; + imageUrlHiRes: string; + name: string; + nationalPokedexNumber: number; + number: string; + rarity: string; + resistances: IResistance[]; + retreatCost: string[]; + series: string; + set: string; + setCode: string; + subtype: string; + supertype: string; + text: string[]; + types: string[]; + weaknesses: IWeakness[]; - constructor() {} - resource(): string { return 'cards'; } diff --git a/src/classes/meta.ts b/src/classes/meta.ts new file mode 100644 index 0000000..8e3d3c2 --- /dev/null +++ b/src/classes/meta.ts @@ -0,0 +1,15 @@ +import { Client } from '../client'; + +export class Meta { + static allTypes(): Promise { + return Client.get('types'); + } + + static allSubtypes(): Promise { + return Client.get('subtypes'); + } + + static allSupertypes(): Promise { + return Client.get('supertypes'); + } +} \ No newline at end of file diff --git a/src/classes/set.ts b/src/classes/set.ts index 8f11fda..dd5b941 100644 --- a/src/classes/set.ts +++ b/src/classes/set.ts @@ -1,19 +1,19 @@ import { ISet } from '../interfaces/set'; -import { QueryBuilder } from '../queryBuilder'; import { IQuery } from '../interfaces/query'; +import { QueryBuilder } from '../queryBuilder'; export class Set implements ISet { code: string; - name: string; - series: string; - totalCards: number; - standardLegal: boolean; expandedLegal: boolean; - releaseDate: string; - symbolUrl: string; + logoUrl: string; + name: string; ptcgoCode: string; - - constructor() {} + releaseDate: string; + series: string; + standardLegal: boolean; + symbolUrl: string; + totalCards: number; + updatedAt: string; resource(): string { return 'sets'; @@ -39,5 +39,4 @@ export class Set implements ISet { return response; }); } - } \ No newline at end of file diff --git a/src/classes/subType.ts b/src/classes/subType.ts deleted file mode 100644 index 68406c9..0000000 --- a/src/classes/subType.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ISubType } from '../interfaces/subType'; -import { QueryBuilder } from '../queryBuilder'; - -export class SubType implements ISubType { - type: string; - - constructor() {} - - resource(): string { - return 'subtypes'; - } - - static all(): Promise { - return QueryBuilder.all(this) - .then(response => { - return response; - }); - } - -} \ No newline at end of file diff --git a/src/classes/superType.ts b/src/classes/superType.ts deleted file mode 100644 index ba8af4b..0000000 --- a/src/classes/superType.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ISuperType } from '../interfaces/superType'; -import { QueryBuilder } from '../queryBuilder'; - -export class SuperType implements ISuperType { - type: string; - - constructor () {} - - resource(): string { - return 'supertypes'; - } - - static all(): Promise { - return QueryBuilder.all(this) - .then(response => { - return response; - }); - } -} \ No newline at end of file diff --git a/src/classes/type.ts b/src/classes/type.ts deleted file mode 100644 index 7c2d1f0..0000000 --- a/src/classes/type.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { IType } from '../interfaces/type'; -import { QueryBuilder } from '../queryBuilder'; - -export class Type implements IType { - type: string; - - constructor() {} - - resource(): string { - return 'types'; - } - - static all(): Promise { - return QueryBuilder.all(this) - .then(response => { - return response; - }); - } -} \ No newline at end of file diff --git a/src/client.ts b/src/client.ts index a116a07..24524d3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,16 +1,11 @@ import * as axios from 'axios'; -import { PokemonTCG } from './sdk'; +import { API_URL, API_VERSION } from './sdk'; import { IQuery } from './interfaces/query'; -import { ICard } from './interfaces/card'; -import { IType } from './interfaces/type'; -import { ISuperType } from './interfaces/superType'; -import { ISubType } from './interfaces/subType'; -import { ISet } from './interfaces/set'; export class Client { - static apiUrl: string = `${PokemonTCG.API_URL}/v${PokemonTCG.version}`; + static apiUrl: string = `${API_URL}/v${API_VERSION}`; - static get(resource: string, params?: IQuery[]): Promise { + static get(resource: string, params?: IQuery[] | string): Promise { let url: string = `${this.apiUrl}/${resource}`; let config: axios.AxiosRequestConfig = { headers: { @@ -18,36 +13,21 @@ export class Client { } }; - // This is needed because the /sets endpoint doesn't take - // an id as a parameter so we need to append it to the url - url += this.checkForId(resource, params); + if(typeof params === 'string') url += `/${params}`; + else url += `?${this.paramsToQuery(params)}`; - return axios.default.get(`${url}?${this.paramsToQuery(params)}`, config) + return axios.default.get(url, config) .then(response => { return response.data[Object.keys(response.data)[0]]; }) } - private static checkForId(resource: string, params?: IQuery[]): string { - let url: string = ''; - - if (params) { - params.map(param => { - if (resource === 'sets' && param.name === 'id') { - url = `/${param.value}`; - } - }); - } - - return url; - } - private static paramsToQuery(params?: IQuery[]): string { let query: string = ''; if (params) { params.map((q: IQuery) => { - query += `${q.name}=${encodeURI(q.value.toString())}`.concat('&'); + query += `${q.name}=${encodeURIComponent(q.value.toString())}`.concat('&'); }); } diff --git a/src/coverage/client.test.ts b/src/coverage/client.test.ts index 7e2c98c..f8ed1ec 100644 --- a/src/coverage/client.test.ts +++ b/src/coverage/client.test.ts @@ -50,8 +50,8 @@ describe('Client', () => { Client.get('sets', params) .then(response => { - expect(response).to.be.a('object'); - expect(response.name).to.equal('Base'); + expect(response).to.be.a('array'); + expect(response[0].name).to.equal('Base'); }) .catch(error => console.error(error)); }); diff --git a/src/index.ts b/src/index.ts index 7ed86cc..af5ff41 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,39 +1,2 @@ -import { Card as BaseCard } from './classes/card'; -import { Ability as BaseAbility } from './classes/ability'; -import { AncientAbility as BaseAncientAbility } from './classes/ancientAbility'; -import { Attack as BaseAttack } from './classes/attack'; -import { Set as BaseSet } from './classes/set'; -import { SubType as BaseSubType } from './classes/subType'; -import { SuperType as BaseSuperType } from './classes/superType'; -import { Type as BaseType } from './classes/type'; - -export namespace PokemonTCG { - export interface IQuery { - name: string; - value: string | number; - } - - export const Card = BaseCard; - export type Card = BaseCard; - - export const Ability = BaseAbility; - export type Ability = BaseAbility; - - export const AncientAbility = BaseAncientAbility; - export type AncientAbility = BaseAncientAbility; - - export const Attack = BaseAttack; - export type Attack = BaseAttack; - - export const Set = BaseSet; - export type Set = BaseSet; - - export const SubType = BaseSubType; - export type SubType = BaseSubType; - - export const SuperType = BaseSuperType; - export type SuperType = BaseSuperType; - - export const Type = BaseType; - export type Type = BaseType; -} \ No newline at end of file +import * as PokemonTCG from './sdk'; +export { PokemonTCG }; diff --git a/src/interfaces/ancientAbility.ts b/src/interfaces/ancientAbility.ts deleted file mode 100644 index 9e98422..0000000 --- a/src/interfaces/ancientAbility.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IAncientAbility { - name: string; - text: string; -} \ No newline at end of file diff --git a/src/interfaces/attack.ts b/src/interfaces/attack.ts index 3312c6f..0d303ad 100644 --- a/src/interfaces/attack.ts +++ b/src/interfaces/attack.ts @@ -1,7 +1,7 @@ export interface IAttack { - cost: string; + convertedEnergyCost: string; + cost: string[]; + damage: string; name: string; text: string; - damage: string; - convertedEnergyCost: string; } \ No newline at end of file diff --git a/src/interfaces/card.ts b/src/interfaces/card.ts index 37a8e45..53cc45d 100644 --- a/src/interfaces/card.ts +++ b/src/interfaces/card.ts @@ -1,32 +1,30 @@ import { IAbility } from '../interfaces/ability'; import { IAttack } from '../interfaces/attack'; -import { ISet } from '../interfaces/set'; -import { ISubType } from '../interfaces/subType'; -import { ISuperType } from '../interfaces/superType'; -import { IType } from '../interfaces/type'; +import { IResistance } from '../interfaces/resistance'; +import { IWeakness } from '../interfaces/weakness'; export interface ICard { - id: number; - name: string; - imageUrl: string; - imageUrlHighRes: string; - subType: ISubType; - superType: ISuperType; ability: IAbility; - hp: number; - number: number; artist: string; - rarity: string; - series: string; - set: ISet; - setCode: string; - retreatCost: string; - text: string; - types: IType[]; attacks: IAttack[]; - weaknesses: string[]; - resistances: string[]; - nationalPokedexNumber: number; - ancientTrait: string; + convertedRetreatCost: number; evolvesFrom: string; + hp: string; + id: string; + imageUrl: string; + imageUrlHiRes: string; + name: string; + nationalPokedexNumber: number; + number: string; + rarity: string; + resistances: IResistance[]; + retreatCost: string[]; + series: string; + set: string; + setCode: string; + subtype: string; + supertype: string; + text: string[]; + types: string[]; + weaknesses: IWeakness[]; } \ No newline at end of file diff --git a/src/interfaces/resistance.ts b/src/interfaces/resistance.ts new file mode 100644 index 0000000..22c86fd --- /dev/null +++ b/src/interfaces/resistance.ts @@ -0,0 +1,4 @@ +export interface IResistance { + type: string; + value: string; +} \ No newline at end of file diff --git a/src/interfaces/set.ts b/src/interfaces/set.ts index dd4f24e..5af706d 100644 --- a/src/interfaces/set.ts +++ b/src/interfaces/set.ts @@ -1,11 +1,13 @@ export interface ISet { code: string; - name: string; - series: string; - totalCards: number; - standardLegal: boolean; expandedLegal: boolean; - releaseDate: string; - symbolUrl: string; + logoUrl: string; + name: string; ptcgoCode: string; + releaseDate: string; + series: string; + standardLegal: boolean; + symbolUrl: string; + totalCards: number; + updatedAt: string; } \ No newline at end of file diff --git a/src/interfaces/subType.ts b/src/interfaces/subType.ts deleted file mode 100644 index 658a891..0000000 --- a/src/interfaces/subType.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface ISubType { - type: string; -} \ No newline at end of file diff --git a/src/interfaces/superType.ts b/src/interfaces/superType.ts deleted file mode 100644 index 92ba927..0000000 --- a/src/interfaces/superType.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface ISuperType { - type: string; -} \ No newline at end of file diff --git a/src/interfaces/type.ts b/src/interfaces/type.ts deleted file mode 100644 index 5d94739..0000000 --- a/src/interfaces/type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IType { - type: string; -} \ No newline at end of file diff --git a/src/interfaces/weakness.ts b/src/interfaces/weakness.ts new file mode 100644 index 0000000..fd25195 --- /dev/null +++ b/src/interfaces/weakness.ts @@ -0,0 +1,4 @@ +export interface IWeakness { + type: string; + value: string; +} \ No newline at end of file diff --git a/src/queryBuilder.ts b/src/queryBuilder.ts index b70700d..53f48cc 100644 --- a/src/queryBuilder.ts +++ b/src/queryBuilder.ts @@ -1,48 +1,28 @@ import { Client } from './client'; import { Card } from "./classes/card"; import { Set } from "./classes/set"; -import { Type } from "./classes/type"; -import { SubType } from "./classes/subType"; -import { SuperType } from "./classes/superType"; import { IQuery } from './interfaces/query'; -import { AxiosResponse } from 'axios'; export class QueryBuilder { - static all(type: (new() => T)): Promise { - let t = new type(); - let params: IQuery[] = [{ - name: 'pageSize', - value: 1000 - }]; + static all(type: (new () => T)): Promise { + let t = new type(); + let params: IQuery[] = [{ + name: 'pageSize', + value: 1000 + }]; - return this.returnResponse(t.resource(), params); - } - - static find(type: (new() => T), id: string): Promise { - let t = new type(); - let params: IQuery[] = [{ - name: 'id', - value: id - }]; + return Client.get(t.resource(), params).catch(error => console.error(error)); + } - return this.returnResponse(t.resource(), params, true); - } + static find(type: (new () => T), id: string): Promise { + let t = new type(); - static where(type: (new() => T), params: IQuery[]): Promise { - let t = new type(); - - return this.returnResponse(t.resource(), params); - } + return Client.get(t.resource(), id).catch(error => console.error(error)); + } - private static returnResponse(resource: string, params: IQuery[], single?: boolean): Promise { - return Client.get(resource, params) - .then(response => { - if (single) { - return response[0]; - } + static where(type: (new () => T), params: IQuery[]): Promise { + let t = new type(); - return response; - }) - .catch(error => console.error(error)); - } + return Client.get(t.resource(), params).catch(error => console.error(error)); + } } \ No newline at end of file diff --git a/src/sdk.ts b/src/sdk.ts index 12159d1..24df52b 100644 --- a/src/sdk.ts +++ b/src/sdk.ts @@ -1,4 +1,16 @@ -export namespace PokemonTCG { - export const API_URL: string = 'https://api.pokemontcg.io'; - export const version: string = '1'; -} \ No newline at end of file +// Constants +export const API_URL: string = 'https://api.pokemontcg.io'; +export const API_VERSION: string = '1'; + +// Classes +export * from './classes/card'; +export * from './classes/set'; +export * from './classes/meta'; + +// Interfaces +export * from './interfaces/ability'; +export * from './interfaces/attack'; +export * from './interfaces/card'; +export * from './interfaces/query'; +export * from './interfaces/resistance'; +export * from './interfaces/weakness'; diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 2d3bb80..0000000 --- a/yarn.lock +++ /dev/null @@ -1,315 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@types/chai@^4.1.1": - version "4.1.1" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.1.tgz#15f1257fab17b7acb9c413f9f88d3d87f834d11e" - -"@types/mocha@^2.2.46": - version "2.2.46" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.46.tgz#b04713f7759d1cf752effdaae7b3969e285ebc16" - -"@types/strip-bom@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2" - -"@types/strip-json-comments@0.0.30": - version "0.0.30" - resolved "https://registry.yarnpkg.com/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz#9aa30c04db212a9a0649d6ae6fd50accc40748a1" - -ansi-styles@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" - dependencies: - color-convert "^1.9.0" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -assertion-error@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - -axios@^0.17.1: - version "0.17.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.17.1.tgz#2d8e3e5d0bdbd7327f91bc814f5c57660f81824d" - dependencies: - follow-redirects "^1.2.5" - is-buffer "^1.1.5" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" - -chai@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" - dependencies: - assertion-error "^1.0.1" - check-error "^1.0.1" - deep-eql "^3.0.0" - get-func-name "^2.0.0" - pathval "^1.0.0" - type-detect "^4.0.0" - -chalk@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" - dependencies: - ansi-styles "^3.1.0" - escape-string-regexp "^1.0.5" - supports-color "^4.0.0" - -check-error@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - -color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" - dependencies: - color-name "^1.1.1" - -color-name@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - -commander@2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -debug@3.1.0, debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -deep-eql@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - dependencies: - type-detect "^4.0.0" - -diff@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" - -diff@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" - -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -follow-redirects@^1.2.5: - version "1.3.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.3.0.tgz#f684871fc116d2e329fda55ef67687f4fabc905c" - dependencies: - debug "^3.1.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - -glob@7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -growl@1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" - -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - -he@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" - -homedir-polyfill@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" - dependencies: - parse-passwd "^1.0.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - -make-error@^1.1.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.2.tgz#8762ffad2444dd8ff1f7c819629fa28e24fea1c4" - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -mkdirp@0.5.1, mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -mocha@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.0.tgz#cccac988b0bc5477119cba0e43de7af6d6ad8f4e" - dependencies: - browser-stdout "1.3.0" - commander "2.11.0" - debug "3.1.0" - diff "3.3.1" - escape-string-regexp "1.0.5" - glob "7.1.2" - growl "1.10.3" - he "1.1.1" - mkdirp "0.5.1" - supports-color "4.4.0" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -parse-passwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -pathval@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" - -source-map-support@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.2.tgz#1a6297fd5b2e762b39688c7fc91233b60984f0a5" - dependencies: - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - -strip-json-comments@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" - dependencies: - has-flag "^2.0.0" - -supports-color@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" - dependencies: - has-flag "^2.0.0" - -ts-node@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-4.1.0.tgz#36d9529c7b90bb993306c408cd07f7743de20712" - dependencies: - arrify "^1.0.0" - chalk "^2.3.0" - diff "^3.1.0" - make-error "^1.1.1" - minimist "^1.2.0" - mkdirp "^0.5.1" - source-map-support "^0.5.0" - tsconfig "^7.0.0" - v8flags "^3.0.0" - yn "^2.0.0" - -tsconfig@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7" - dependencies: - "@types/strip-bom" "^3.0.0" - "@types/strip-json-comments" "0.0.30" - strip-bom "^3.0.0" - strip-json-comments "^2.0.0" - -type-detect@^4.0.0: - version "4.0.7" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.7.tgz#862bd2cf6058ad92799ff5a5b8cf7b6cec726198" - -typescript@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" - -v8flags@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.1.tgz#dce8fc379c17d9f2c9e9ed78d89ce00052b1b76b" - dependencies: - homedir-polyfill "^1.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -yn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"