/** * @public * The operators that can be used in filter. */ export type Operators = '<' | '<=' | '==' | '!=' | '>' | '>=' | 'contains'; /** * @public * Type guard for operators. */ export declare const isOperator: (s: string) => s is Operators; /** * @public * Model for a visit entity. */ export type Visit = { /** * The auto-generated visit identification. */ id: string; /** * The visited entity, usually an entity id. */ name: string; /** * The visited url pathname, usually the entity route. */ pathname: string; /** * An individual view count. */ hits: number; /** * Last date and time of visit. Format: unix epoch in ms. */ timestamp: number; /** * Optional entity reference. See stringifyEntityRef from catalog-model. */ entityRef?: string; }; /** * @public * This data structure represents the parameters associated with search queries for visits. */ export type VisitsApiQueryParams = { /** * Limits the number of results returned. The default is 8. */ limit?: number; /** * Allows ordering visits on entity properties. * @example * Sort ascending by the timestamp field. * ``` * { orderBy: [{ field: 'timestamp', direction: 'asc' }] } * ``` */ orderBy?: Array<{ field: keyof Visit; direction: 'asc' | 'desc'; }>; /** * Allows filtering visits on entity properties. * @example * Most popular docs on the past 7 days * ``` * { * orderBy: [{ field: 'hits', direction: 'desc' }], * filterBy: [ * { field: 'timestamp', operator: '>=', value: }, * { field: 'entityRef', operator: 'contains', value: 'docs' } * ] * } * ``` */ filterBy?: Array<{ field: keyof Visit; operator: Operators; value: string | number; }>; }; /** * @public * This data structure represents the parameters associated with saving visits. */ export type VisitsApiSaveParams = { visit: Omit; }; /** * @public * Visits API public contract. */ export interface VisitsApi { /** * Persist a new visit. * @param pageVisit - a new visit data */ save(saveParams: VisitsApiSaveParams): Promise; /** * Get user visits. * @param queryParams - optional search query params. */ list(queryParams?: VisitsApiQueryParams): Promise; } /** @public */ export declare const visitsApiRef: import("@backstage/core-plugin-api").ApiRef;