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

Add parameters to method alert.promote_to_case() #269

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 5 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,13 @@ 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 = {}
vdebergue marked this conversation as resolved.
Show resolved Hide resolved
) -> 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: 23 additions & 0 deletions thehive4py/types/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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):
Expand Down Expand Up @@ -88,3 +90,24 @@ 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