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 new postEntitiesMobiledoc method to plugins api #68

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/tame-zebras-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crowdstrike/foundry-js': minor
---

Adding new postEntitiesMobiledoc method to the plugins api
42 changes: 40 additions & 2 deletions src/apis/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,40 @@ export interface PostEntitiesExecuteV1RequestMessage
method: 'postEntitiesExecuteV1';
}

// types for postEntitiesMobiledocV1

export type PostEntitiesMobiledocV1QueryParams = BaseUrlParams;

export type PostEntitiesMobiledocV1ApiResponse = ApiResponsePayload;

export interface PostEntitiesMobiledocV1PostData {}

export type PostEntitiesMobiledocV1ResponseMessage =
BaseApiResponseMessage<PostEntitiesMobiledocV1ApiResponse>;

export interface PostEntitiesMobiledocV1RequestMessage
extends BaseApiRequestMessage<
PostEntitiesMobiledocV1QueryParams,
PostEntitiesMobiledocV1PostData
> {
api: PluginsRequestApi;
method: 'postEntitiesMobiledocV1';
}
// general types

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

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

export class PluginsApiBridge {
private bridge;
Expand Down Expand Up @@ -189,4 +210,21 @@ export class PluginsApiBridge {

return this.bridge.postMessage(message);
}

async postEntitiesMobiledocV1(
postBody: PostEntitiesMobiledocV1PostData,
urlParams: PostEntitiesMobiledocV1QueryParams = {},
): Promise<PostEntitiesMobiledocV1ApiResponse> {
const message: PostEntitiesMobiledocV1RequestMessage = {
type: 'api',
api: 'plugins',
method: 'postEntitiesMobiledocV1',
payload: {
body: postBody,
params: urlParams,
},
};

return this.bridge.postMessage(message);
}
}
Loading