UNPKG

hud-ai

Version:
50 lines (40 loc) 1.22 kB
import * as Promise from 'bluebird'; import { HudAiCreateAttributes, HudAiListAttributes, HudAiUpdateAttributes, Resource } from '../utils/Resource'; import { RequestManager } from '../RequestManager'; import { KeyTerm } from '../entities'; export interface KeyTermListAttributes extends HudAiListAttributes { term?: string; } export interface KeyTermCreateAttributes extends HudAiCreateAttributes { term: string; } export class KeyTermResource extends Resource< KeyTerm, KeyTermListAttributes, KeyTermCreateAttributes, any > { constructor(requestManager: RequestManager) { super('/key-terms', requestManager); } public list(listArgs: KeyTermListAttributes): Promise<{ count: number, rows: KeyTerm[] }> { return this._list(listArgs); } public create(createArgs: KeyTermCreateAttributes): Promise<KeyTerm> { return this._create(createArgs); } public get(id: string | number): Promise<KeyTerm> { return this._get(id); } public del(id: string | number): Promise<void> { return this.destroy(id); } public destroy(id: string | number): Promise<void> { return this._destroy(id); } }