Marked Promise methods as async; const correctness; return reject Promise, if failed.
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
import { Client } from './client';
|
||||
import { Card } from "./classes/card";
|
||||
import { Set } from "./classes/set";
|
||||
import { Card } from './classes/card';
|
||||
import { Set } from './classes/set';
|
||||
import { IQuery } from './interfaces/query';
|
||||
|
||||
export class QueryBuilder {
|
||||
static all<T extends Card | Set>(type: (new () => T)): Promise<T[]> {
|
||||
let t = new type();
|
||||
let params: IQuery[] = [{
|
||||
static all<T extends Card | Set>(type: {new (): T}): Promise<T[]> {
|
||||
const t = new type();
|
||||
const params: IQuery[] = [{
|
||||
name: 'pageSize',
|
||||
value: 1000
|
||||
}];
|
||||
@ -14,14 +14,14 @@ export class QueryBuilder {
|
||||
return Client.get(t.resource(), params);
|
||||
}
|
||||
|
||||
static find<T extends Card | Set>(type: (new () => T), id: string): Promise<T> {
|
||||
let t = new type();
|
||||
static find<T extends Card | Set>(type: {new (): T}, id: string): Promise<T> {
|
||||
const t = new type();
|
||||
|
||||
return Client.get(t.resource(), id);
|
||||
}
|
||||
|
||||
static where<T extends Card | Set>(type: (new () => T), params: IQuery[]): Promise<T[]> {
|
||||
let t = new type();
|
||||
static where<T extends Card | Set>(type: {new (): T}, params: IQuery[]): Promise<T[]> {
|
||||
const t = new type();
|
||||
|
||||
return Client.get(t.resource(), params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user