api scaffold

This commit is contained in:
mProjectsCode 2022-05-04 19:09:54 +02:00
parent ddcc767573
commit 96d74a7732
6 changed files with 128 additions and 60 deletions

27
src/api/apis/TestAPI.ts Normal file
View file

@ -0,0 +1,27 @@
import {APIModel} from '../APIModel';
import {APIRequestResult} from '../APIRequestResult';
export class TestAPI extends APIModel {
constructor() {
super();
this.name = 'testAPI';
this.types = ['test'];
}
async getByTitle(title: string): Promise<APIRequestResult[]> {
console.log(`MDB | api "${this.name}" queried`);
return [
{title: 'test1', type: this.types[0], apiName: this.name, data: {length: 126}} as APIRequestResult,
{title: 'test2', type: this.types[0], apiName: this.name, description: 'some test description', data: {}} as APIRequestResult,
];
}
getMataDataFromResult(item: APIRequestResult): string {
if (item.apiName !== this.name) {
return '';
}
return '';
}
}