Skip to content

Commit

Permalink
Merge pull request #63 from CrowdStrike/new-plugins-and-logging-apis
Browse files Browse the repository at this point in the history
feat add new plugins and loggins apis
  • Loading branch information
rhinchey-cs authored Aug 9, 2024
2 parents 347ea25 + 80aa395 commit 9778e1b
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 45 deletions.
5 changes: 5 additions & 0 deletions .changeset/thirty-buses-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crowdstrike/foundry-js': minor
---

Adding new methods to plugins and logging apis
34 changes: 34 additions & 0 deletions src/apis/loggingapi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ export interface GetEntitiesSavedSearchesExecuteV1RequestMessage
method: 'getEntitiesSavedSearchesExecuteV1';
}

// types for getEntitiesSavedSearchesV1

export interface GetEntitiesSavedSearchesV1QueryParams extends BaseUrlParams {
ids: QueryParam;
}

export type GetEntitiesSavedSearchesV1ApiResponse = ApiResponsePayload;

export type GetEntitiesSavedSearchesV1ResponseMessage =
BaseApiResponseMessage<GetEntitiesSavedSearchesV1ApiResponse>;

export interface GetEntitiesSavedSearchesV1RequestMessage
extends BaseApiRequestMessage<GetEntitiesSavedSearchesV1QueryParams> {
api: LoggingapiRequestApi;
method: 'getEntitiesSavedSearchesV1';
}

// types for postEntitiesSavedSearchesDynamicExecuteV1

export interface PostEntitiesSavedSearchesDynamicExecuteV1QueryParams
Expand Down Expand Up @@ -124,10 +141,12 @@ export interface PostEntitiesSavedSearchesIngestV1RequestMessage

export type LoggingapiApiRequestMessage =
| GetEntitiesSavedSearchesExecuteV1RequestMessage
| GetEntitiesSavedSearchesV1RequestMessage
| PostEntitiesSavedSearchesExecuteV1RequestMessage;

export type LoggingapiApiResponseMessage =
| GetEntitiesSavedSearchesExecuteV1ResponseMessage
| GetEntitiesSavedSearchesV1ResponseMessage
| PostEntitiesSavedSearchesExecuteV1ResponseMessage;

export class LoggingapiApiBridge {
Expand Down Expand Up @@ -156,6 +175,21 @@ export class LoggingapiApiBridge {
return this.bridge.postMessage(message);
}

async getEntitiesSavedSearchesV1(
urlParams: GetEntitiesSavedSearchesV1QueryParams,
): Promise<GetEntitiesSavedSearchesV1ApiResponse> {
const message: GetEntitiesSavedSearchesV1RequestMessage = {
type: 'api',
api: 'loggingapi',
method: 'getEntitiesSavedSearchesV1',
payload: {
params: urlParams,
},
};

return this.bridge.postMessage(message);
}

async postEntitiesSavedSearchesExecuteV1(
postBody: PostEntitiesSavedSearchesExecuteV1PostData,
urlParams: PostEntitiesSavedSearchesExecuteV1QueryParams = {},
Expand Down
34 changes: 34 additions & 0 deletions src/apis/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ export interface GetEntitiesConfigsV1RequestMessage
method: 'getEntitiesConfigsV1';
}

// types for getEntitiesDefinitionsV1

export interface GetEntitiesDefinitionsV1QueryParams extends BaseUrlParams {
ids: QueryParam;
}

export type GetEntitiesDefinitionsV1ApiResponse = ApiResponsePayload;

export type GetEntitiesDefinitionsV1ResponseMessage =
BaseApiResponseMessage<GetEntitiesDefinitionsV1ApiResponse>;

export interface GetEntitiesDefinitionsV1RequestMessage
extends BaseApiRequestMessage<GetEntitiesDefinitionsV1QueryParams> {
api: PluginsRequestApi;
method: 'getEntitiesDefinitionsV1';
}

// types for postEntitiesExecuteDraftV1

export type PostEntitiesExecuteDraftV1QueryParams = BaseUrlParams;
Expand Down Expand Up @@ -88,11 +105,13 @@ export interface PostEntitiesExecuteV1RequestMessage

export type PluginsApiRequestMessage =
| GetEntitiesConfigsV1RequestMessage
| GetEntitiesDefinitionsV1RequestMessage
| PostEntitiesExecuteDraftV1RequestMessage
| PostEntitiesExecuteV1RequestMessage;

export type PluginsApiResponseMessage =
| GetEntitiesConfigsV1ResponseMessage
| GetEntitiesDefinitionsV1ResponseMessage
| PostEntitiesExecuteDraftV1ResponseMessage
| PostEntitiesExecuteV1ResponseMessage;

Expand Down Expand Up @@ -122,6 +141,21 @@ export class PluginsApiBridge {
return this.bridge.postMessage(message);
}

async getEntitiesDefinitionsV1(
urlParams: GetEntitiesDefinitionsV1QueryParams,
): Promise<GetEntitiesDefinitionsV1ApiResponse> {
const message: GetEntitiesDefinitionsV1RequestMessage = {
type: 'api',
api: 'plugins',
method: 'getEntitiesDefinitionsV1',
payload: {
params: urlParams,
},
};

return this.bridge.postMessage(message);
}

async postEntitiesExecuteDraftV1(
postBody: PostEntitiesExecuteDraftV1PostData,
urlParams: PostEntitiesExecuteDraftV1QueryParams = {},
Expand Down
Loading

0 comments on commit 9778e1b

Please sign in to comment.