@rero/ng-core
Version:
RERO angular core library.
112 lines (111 loc) • 2.72 kB
TypeScript
/**
* Class representing a record set returned by API.
*/
export declare class Record {
aggregations: any;
id?: string;
hits: any;
links: any;
}
export declare class SearchResult {
type: string;
records: Record;
}
export interface File {
updated: string;
size: string;
url?: string;
mimetype: string;
version_id: string;
is_head: boolean;
created: string;
tags: any;
delete_marker: boolean;
links: {
self: string;
version?: string;
uploads?: string;
commit?: string;
content?: string;
};
checksum: string;
key: string;
showInfo: boolean;
showChildren: boolean;
metadata: any;
}
/**
* Interface representing a search property, on which we can do a specific search
* with query string like: `q=title:query`.
*/
export interface SearchField {
label: string;
path: string;
selected?: boolean;
}
/** Interface representing a search filter */
export interface SearchFilter {
filter: string;
label: string;
value: string;
showIfQuery?: boolean;
disabledValue?: string;
persistent?: boolean;
url?: {
external?: boolean;
link?: string;
routerLink?: Array<string>;
target?: string;
title?: string;
};
}
/**
* Interface representing a collection of SearchFilters with label.
* The label adds a title to the interface.
*
* Example on the interface:
*
* Show only (label):
* Filter 1
* Filter 2
* etc…
*/
export interface SearchFilterSection {
label: string;
filters: SearchFilter[];
}
/** Interfaces for an aggregation */
export interface Aggregation {
key: string;
bucketSize: any;
value: {
buckets: Array<any>;
};
expanded: boolean;
loaded?: boolean;
doc_count?: number;
type?: string;
config?: AggregationConfig;
name?: string;
}
/**
* Interface to describe an aggregation configuration
*
* Additionally to aggregation buckets, an aggregation configuration object could be
* provided to control the aggregation display behavior. The configuration keys depends
* on the aggregation type.
*
* attributes are :
* @attribute type - string: the type of aggregation (ex date-range, sum, date-histogram, ...)
* @attribute min - number: the minimum value into the aggregation buckets.
* @attribute max - number: the maximum value into the aggregation buckets.
* @attribute step - number: the step uses between to value.
* @attributes any additional/not known attributes.
*/
export interface AggregationConfig {
type?: string;
min?: number;
max?: number;
step?: number;
[x: string | number | symbol]: unknown;
}