Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search analysis module #680

Merged
merged 4 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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