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 2 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
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@
}
},
"dependencies": {
"dayjs": "^1.11.8",
"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
15 changes: 15 additions & 0 deletions src/resources/SearchAnalysis/SearchAnalysis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import dayjs from 'dayjs';
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(id: string, from = dayjs().subtract(1, 'week').format('YYYY-MM-DD')) {
olamothe marked this conversation as resolved.
Show resolved Hide resolved
olamothe marked this conversation as resolved.
Show resolved Hide resolved
olamothe marked this conversation as resolved.
Show resolved Hide resolved
return this.api.post<ReplayAnalysis>(
`${SearchAnalysis.baseUrl}/inspect/replay?organizationId=${API.orgPlaceholder}`,
{id, dateRange: {from}}
);
}
}
Loading