@dasch-swiss/dsp-js
Version:
TypeScript client library for DSP-API
40 lines • 1.05 kB
JavaScript
import { map } from 'rxjs';
import { GenericCache } from './GenericCache';
/**
* Caches user information obtained from Knora.
*/
export class ListAdminCache extends GenericCache {
constructor(adminEndpoint) {
super();
this.adminEndpoint = adminEndpoint;
}
/**
* Requests a whole list from the admin API.
*
* @param listIri IRI of the list.
*/
getList(listIri) {
return this.getItem(listIri);
}
/**
* Public method to access the reloadItem method
*
* @param key the id of the information to be returned.
* @return the item
*/
reloadCachedItem(key) {
return this.reloadItem(key);
}
requestItemFromKnora(key, isDependency) {
return this.adminEndpoint.listsEndpoint.getList(key).pipe(map((response) => {
return [response.body];
}));
}
getKeyOfItem(item) {
return item.list.listinfo.id;
}
getDependenciesOfItem(item) {
return [];
}
}
//# sourceMappingURL=ListAdminCache.js.map