Skip to content

Commit

Permalink
feat: add search analysis module (#680)
Browse files Browse the repository at this point in the history
KIT-2526
  • Loading branch information
olamothe authored Jun 12, 2023
1 parent 133c5d8 commit 8b3e74a
Show file tree
Hide file tree
Showing 7 changed files with 481 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
},
"dependencies": {
"exponential-backoff": "^3.1.0",
"query-string-esm": "npm:query-string@^8.0.0",
"query-string-cjs": "npm:query-string@^7.0.0"
"query-string-cjs": "npm:query-string@^7.0.0",
"query-string-esm": "npm:query-string@^8.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 2 additions & 0 deletions src/resources/PlatformResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import User from './Users/User.js';
import Vaults from './Vaults/Vaults.js';
import TableauService from './TableauService/TableauService.js';
import HostedPages from './HostedPages/HostedPages.js';
import SearchAnalysis from './SearchAnalysis/SearchAnalysis.js';

const resourcesMap: Array<{key: string; resource: typeof Resource}> = [
{key: 'activity', resource: Activity},
Expand Down Expand Up @@ -100,6 +101,7 @@ const resourcesMap: Array<{key: string; resource: typeof Resource}> = [
{key: 'notification', resource: Notifications},
{key: 'privilegeEvaluator', resource: PrivilegeEvaluator},
{key: 'tableauService', resource: TableauService},
{key: 'searchAnalysis', resource: SearchAnalysis},
];

class PlatformResources {
Expand Down
22 changes: 22 additions & 0 deletions src/resources/SearchAnalysis/SearchAnalysis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import API from '../../APICore.js';
import Resource from '../Resource.js';
import {ReplayAnalysis} from './SearchAnalysisInterface.js';

export default class SearchAnalysis extends Resource {
static baseUrl = '/rest/search/v3/analysis';

/**
* Replay a query that was already done and get inspection details.
*
* @param id The SearchUID of the request to replay.
* @param from The inclusive date at which to start looking for the request. Example: 2019-08-24T14:15:22Z
* @param to The inclusive date at which to stop looking for the SearchUID. When omitted searches up until the most recent requests. Example:2019-08-24T14:15:22Z
* @returns
*/
replay(id: string, from: string, to?: string) {
return this.api.post<ReplayAnalysis>(
`${SearchAnalysis.baseUrl}/inspect/replay?organizationId=${API.orgPlaceholder}`,
{id, dateRange: {from, to}}
);
}
}
Loading

0 comments on commit 8b3e74a

Please sign in to comment.