Refactor query imports and types

This commit is contained in:
Tee
2021-03-18 09:28:39 -04:00
parent 5c67dcf4bf
commit c46b721652
4 changed files with 12 additions and 19 deletions

View File

@ -1,4 +1,4 @@
import { Query } from '../interfaces/query';
import { Parameter } from '../interfaces/parameter';
import { Card } from '../interfaces/card';
import { Type } from '../enums/type';
import { Supertype } from '../enums/supertype';
@ -12,17 +12,16 @@ export async function findCardByID(id: string): Promise<Card> {
return response;
}
export async function findCardsByQueries(params: Query[]): Promise<Card[]> {
export async function findCardsByQueries(params: Parameter): Promise<Card[]> {
const client: Client = Client.getInstance();
const response: Card[] = await client.get<Card[]>('cards', params);
return response;
}
export async function getAllCards(): Promise<Card[]> {
const param = 'pageSize:250';
const params: Parameter = { pageSize: 250 };
const client: Client = Client.getInstance();
const response: Card[] = await client.get<Card[]>('cards', param);
const response: Card[] = await client.get<Card[]>('cards', params);
return response;
}

View File

@ -1,4 +1,4 @@
import { Query } from '../interfaces/query';
import { Parameter } from '../interfaces/parameter';
import { Set } from '../interfaces/set';
import { Client } from '../client';
@ -8,16 +8,16 @@ export async function findSetByID(id: string): Promise<Set> {
return response;
}
export async function findSetsByQueries(params: Query[]): Promise<Set[]> {
export async function findSetsByQueries(params: Parameter): Promise<Set[]> {
const client: Client = Client.getInstance();
const response: Set[] = await client.get<Set[]>('sets', params);
return response;
}
export async function getAllSets(): Promise<Set[]> {
const param = 'pageSize:250';
const params: Parameter = { pageSize: 250 };
const client: Client = Client.getInstance();
const response: Set[] = await client.get<Set[]>('sets', param);
const response: Set[] = await client.get<Set[]>('sets', params);
return response;
}