Return of the test API and update readme
This commit is contained in:
parent
3b1e500317
commit
f6825bbadc
3 changed files with 66 additions and 8 deletions
|
|
@ -22,7 +22,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
|
||||
// add icon to the left ribbon
|
||||
const ribbonIconEl = this.addRibbonIcon('database', 'Add new Media DB entry', (evt: MouseEvent) =>
|
||||
this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
|
||||
this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
|
||||
);
|
||||
ribbonIconEl.addClass('obsidian-media-db-plugin-ribbon-class');
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
this.addCommand({
|
||||
id: 'open-media-db-search-modal',
|
||||
name: 'Add new Media DB entry',
|
||||
callback: () => this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
|
||||
callback: () => this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
|
||||
});
|
||||
// register command to open id search modal
|
||||
this.addCommand({
|
||||
|
|
@ -38,7 +38,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
name: 'Add new Media DB entry by id',
|
||||
callback: () => this.createMediaDbNote(this.openMediaDbIdSearchModal.bind(this)),
|
||||
});
|
||||
|
||||
// register command to update the open note
|
||||
this.addCommand({
|
||||
id: 'update-media-db-note',
|
||||
name: 'Update the open note, if it is a Media DB entry.',
|
||||
|
|
@ -103,7 +103,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
async openMediaDbSearchModal(): Promise<MediaTypeModel> {
|
||||
async openMediaDbAdvancedSearchModal(): Promise<MediaTypeModel> {
|
||||
return new Promise(((resolve, reject) => {
|
||||
new MediaDbAdvancedSearchModal(this.app, this, (err, results) => {
|
||||
if (err) return reject(err);
|
||||
|
|
|
|||
27
src/tests/TestAPI.ts
Normal file
27
src/tests/TestAPI.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import {APIModel} from '../api/APIModel';
|
||||
import {MediaTypeModel} from '../models/MediaTypeModel';
|
||||
import MediaDbPlugin from '../main';
|
||||
|
||||
export class TestAPI extends APIModel {
|
||||
plugin: MediaDbPlugin;
|
||||
|
||||
|
||||
constructor(plugin: MediaDbPlugin) {
|
||||
super();
|
||||
|
||||
this.plugin = plugin;
|
||||
this.apiName = 'TestAPI';
|
||||
this.apiDescription = 'A test API for automated testing.';
|
||||
this.apiUrl = '';
|
||||
this.types = [];
|
||||
}
|
||||
|
||||
|
||||
async getById(item: MediaTypeModel): Promise<MediaTypeModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
|
||||
return [] as MediaTypeModel[];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue