Setup api

This commit is contained in:
Adria Navarro 2023-07-19 10:15:05 +02:00
parent 82ea9a7cc1
commit 701772ebd5
2 changed files with 18 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import { buildTemplateEndpoints } from "./templates"
import { buildUserEndpoints } from "./user"
import { buildSelfEndpoints } from "./self"
import { buildViewEndpoints } from "./views"
import { buildViewV2Endpoints } from "./viewsV2"
import { buildLicensingEndpoints } from "./licensing"
import { buildGroupsEndpoints } from "./groups"
import { buildPluginEndpoints } from "./plugins"
@ -279,5 +280,6 @@ export const createAPIClient = config => {
...buildEventEndpoints(API),
...buildAuditLogsEndpoints(API),
...buildLogsEndpoints(API),
viewV2: buildViewV2Endpoints(API),
}
}

View File

@ -0,0 +1,16 @@
export const buildViewV2Endpoints = API => ({
/**
* Fetches all rows in a view
* @param id the id of the view
*/
get: async id => {
return await API.get({ url: `/api/v2/views/${id}` })
},
/**
* Get a view information
* @param id the id of the view
*/
fetch: async id => {
return await API.get({ url: `/api/v2/views/${id}/search` })
},
})