@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
92 lines (91 loc) • 4.57 kB
TypeScript
import { Response } from 'express';
import ReportQuery from '../types/ReportQuery';
import RestClient from './restClient';
import Dict = NodeJS.Dict;
import { components } from '../types/api';
import { ApiConfig, ListWithWarnings } from './types';
declare class ReportingClient {
restClient: RestClient;
constructor(config: ApiConfig);
getCount(resourceName: string, token: string, countRequest: ReportQuery): Promise<number>;
getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<Dict<string>>>;
getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings>;
getDefinitionSummary(token: string, reportId: string, definitionsPath?: string): Promise<components['schemas']['ReportDefinitionSummary']>;
getDefinitions(token: string, definitionsPath?: string): Promise<Array<components['schemas']['ReportDefinitionSummary']>>;
getDefinition(token: string, reportId: string, variantId: string, definitionsPath?: string, queryData?: Dict<string | string[]>): Promise<components['schemas']['SingleVariantReportDefinition']>;
requestAsyncReport(token: string, reportId: string, variantId: string, query: Record<string, string | boolean | number>): Promise<Dict<string>>;
cancelAsyncRequest(token: string, reportId: string, variantId: string, executionId: string, dataProductDefinitionsPath?: string): Promise<Dict<string>>;
downloadAsyncReport(token: string, reportId: string, variantId: string, tableId: string, query: Record<string, string | string[]>, res: Response): Promise<void>;
downloadSyncReport(token: string, resourceName: string, query: Record<string, string | string[]>, res: Response): Promise<void>;
getAsyncReport(token: string, reportId: string, variantId: string, tableId: string, query: Record<string, string | string[]>): Promise<Array<Record<string, string>>>;
getAsyncSummaryReport(token: string, reportId: string, variantId: string, tableId: string, summaryId: string, query: Dict<string | number>): Promise<Array<Record<string, string>>>;
getAsyncReportStatus(token: string, reportId: string, variantId: string, executionId: string, dataProductDefinitionsPath?: string, tableId?: string): Promise<components['schemas']['StatementExecutionStatus']>;
getAsyncCount(token: string, tableId: string, dataProductDefinitionsPath?: string): Promise<number>;
getAsyncInteractiveCount(token: string, tableId: string, reportId: string, id: string, filters: ReportQuery): Promise<number>;
/**
* Gets the expiry state for tables
*
* @param {string} token
* @param {string[]} tableIds
* @return {*}
* @memberof ReportingClient
*/
getTableExpiryState(token: string, tableIds: string[]): Promise<components['schemas']['ResultTableExpiryState'][]>;
/**
* Subscribe to a scheduled report
*
* @param {string} token
* @param {string} reportId
* @param {string} id
* @return {*} {Promise<{ tableId: string }>}
* @memberof ReportingClient
*/
subscribe(token: string, reportId: string, id: string): Promise<{
tableId: string;
}>;
/**
* Unsubscribe from a scheduled report
*
* @param {string} token
* @param {string} reportId
* @param {string} id
* @return {*} {Promise<{ success: boolean }>}
* @memberof ReportingClient
*/
unsubscribe(token: string, reportId: string, id: string): Promise<{
success: boolean;
}>;
/**
* Get a single subscription data
*
* @param {string} token
* @param {string} reportId
* @param {string} id
* @return {*} {Promise<{ reportId: string; id: string; tableId: string; createdAt: string; addedAt: string }[]>}
* @memberof ReportingClient
*/
getSubscription(token: string, reportId: string, id: string): Promise<{
reportId: string;
id: string;
tableId: string;
createdAt: string;
addedAt: string;
}[]>;
/**
* Get all a user subscriptions data
*
* @param {string} token
* @return {*} {Promise<{ reportId: string; id: string; tableId: string; createdAt: string; addedAt: string }[]>}
* @memberof ReportingClient
*/
getSubscriptions(token: string): Promise<{
reportId: string;
id: string;
tableId: string;
createdAt: string;
addedAt: string;
}[]>;
logInfo(title: string, args?: Dict<string>): void;
}
export { ReportingClient };
export default ReportingClient;