From fb33ea36175bef46344b6a86568cec28dd0a5e1e Mon Sep 17 00:00:00 2001 From: Tee Date: Sun, 28 Feb 2021 23:44:13 -0500 Subject: [PATCH] Use default exports for service methods instead of classes --- src/classes/meta.ts | 19 ------------------- src/services/cardService.ts | 17 ++++++++--------- 2 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 src/classes/meta.ts diff --git a/src/classes/meta.ts b/src/classes/meta.ts deleted file mode 100644 index 5450b16..0000000 --- a/src/classes/meta.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Client } from '../client'; - -export class Meta { - static async allTypes(): Promise { - return Client.get('types'); - } - - static async allSubtypes(): Promise { - return Client.get('subtypes'); - } - - static async allSupertypes(): Promise { - return Client.get('supertypes'); - } - - static allRarities(): Promise { - return Client.get('rarities'); - } -} \ No newline at end of file diff --git a/src/services/cardService.ts b/src/services/cardService.ts index 8c2a983..362a7da 100644 --- a/src/services/cardService.ts +++ b/src/services/cardService.ts @@ -1,16 +1,15 @@ import { Query } from "../interfaces/query"; -import { APIService } from "../interfaces/apiService"; import { Card } from "../interfaces/card"; import { Client } from "../client"; -export class CardService implements APIService { - async find(id: string): Promise { +export default { + findCardByID: async function (id: string): Promise { const client: Client = Client.getInstance(); - const response: Card[] = await client.get('cards', id); + const response: Card = await client.get('cards', id); return response; - }; + }, - async all(): Promise { + getAllCards: async function (): Promise { const params: Query[] = [{ name: 'pageSize', value: 250, @@ -19,11 +18,11 @@ export class CardService implements APIService { const client: Client = Client.getInstance(); const response: Card[] = await client.get('cards', params); return response; - }; + }, - async where(params: Query[]): Promise { + findCardByQueries: async function(params: Query[]): Promise { const client: Client = Client.getInstance(); const response: Card[] = await client.get('cards', params); return response; - }; + } } \ No newline at end of file