TypeScript Report API for Variant Call Format (VCF) Report Templates
npm install @molgenis/vip-report-api
ts
export interface Api {
getAppMetadata(): Promise;
getConfig(): Promise;
getCram(sampleId: string): Promise;
getDecisionTree(): Promise;
getFastaGz(contig: string, pos: number): Promise;
getGenesGz(): Promise;
getPhenotypes(params: Params): Promise>;
getRecordsMeta(): Promise;
getRecords(params: RecordParams): Promise>;
getRecordById(id: number): Promise- >;
getSamples(params: Params): Promise>;
getSampleById(id: number): Promise- >;
getSampleTree(): Promise;
}
`
The API can be used through either the ApiClient class or the WindowApiClient class. The ApiClient is backed by an object containing all report data whereas the WindowApiClient is backed by window.api.
`ts
import { ApiClient } from './ApiClient';
import { Api } from './Api';const reportData = { ... };
const apiClient: Api = new ApiClient();
`
`ts
import { WindowApiClient } from './WindowApiClient';
import { Api } from './Api';const apiClient: Api = WindowApiClient();
``