Skip to content

Commit

Permalink
Add parameters to method alert.promote_to_case()
Browse files Browse the repository at this point in the history
  • Loading branch information
vdebergue committed Jan 12, 2023
1 parent 0593e35 commit 2c3cbf7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions thehive4py/endpoints/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
InputAlert,
InputBulkUpdateAlert,
InputUpdateAlert,
InputPromoteAlert,
OutputAlert,
)
from thehive4py.types.case import OutputCase
Expand Down Expand Up @@ -59,11 +60,11 @@ def follow(self, alert_id: str) -> None:
def unfollow(self, alert_id: str) -> None:
self._session.make_request("POST", path=f"/api/v1/alert/{alert_id}/unfollow")

def promote_to_case(self, alert_id: str) -> OutputCase:
def promote_to_case(self, alert_id: str, update: InputPromoteAlert = {}) -> OutputCase:
return self._session.make_request(
"POST",
path=f"/api/v1/alert/{alert_id}/case",
json={"placholder": ""}, # TODO: replace with optional body definition
json=update,
)

def create_observable(
Expand Down
23 changes: 22 additions & 1 deletion thehive4py/types/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from thehive4py.types.custom_field import InputCustomFieldValue, OutputCustomFieldValue
from thehive4py.types.observable import InputObservable

from thehive4py.types.share import InputShare
from thehive4py.types.task import InputTask

class InputAlertRequired(TypedDict):
type: str
Expand Down Expand Up @@ -88,3 +89,23 @@ class InputUpdateAlert(TypedDict, total=False):

class InputBulkUpdateAlert(InputUpdateAlert):
ids: List[str]

class InputPromoteAlert(TypedDict, total=False):
title: str
description: str
severity: int
startDate: int
endDate: int
tags: List[str]
flag: bool
tlp: int
pap: int
status: str
summary: str
assignee: str
customFields: List[InputCustomFieldValue]
caseTemplate: str
tasks: List[InputTask]
sharingParameters: List[InputShare]
taskRule: str
observableRule: str

0 comments on commit 2c3cbf7

Please sign in to comment.