From 2aa21e80448e07e81e6079b06f88b74ffba4471e Mon Sep 17 00:00:00 2001 From: Peter Annabel Date: Wed, 23 Jul 2025 19:57:38 -0500 Subject: [PATCH] Fix the parse_one when passed the id number to agents, billing_reports, incident_reports, organizations, reports, and signals endpoints --- .../endpoints/siem/AgentsEndpoint.py | 9 +-- .../endpoints/siem/AgentsIdEndpoint.py | 72 +++++++++++++++++++ .../endpoints/siem/BillingreportsEndpoint.py | 9 +-- .../siem/BillingreportsIdEndpoint.py | 72 +++++++++++++++++++ .../endpoints/siem/IncidentreportsEndpoint.py | 9 +-- .../siem/IncidentreportsIdEndpoint.py | 72 +++++++++++++++++++ .../endpoints/siem/OrganizationsEndpoint.py | 9 +-- .../endpoints/siem/OrganizationsIdEndpoint.py | 72 +++++++++++++++++++ .../endpoints/siem/ReportsEndpoint.py | 9 +-- .../endpoints/siem/ReportsIdEndpoint.py | 72 +++++++++++++++++++ .../endpoints/siem/SignalsEndpoint.py | 9 +-- .../endpoints/siem/SignalsIdEndpoint.py | 72 +++++++++++++++++++ src/scratchpad.py | 26 +++++-- 13 files changed, 484 insertions(+), 28 deletions(-) create mode 100644 src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py create mode 100644 src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py create mode 100644 src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py create mode 100644 src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py create mode 100644 src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py create mode 100644 src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py diff --git a/src/pyhuntress/endpoints/siem/AgentsEndpoint.py b/src/pyhuntress/endpoints/siem/AgentsEndpoint.py index 09ff0b4..b0c0d65 100644 --- a/src/pyhuntress/endpoints/siem/AgentsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/AgentsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.AgentsIdEndpoint import AgentsIdEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class AgentsEndpoint( IGettable.__init__(self, SIEMAgents) IPaginateable.__init__(self, SIEMAgents) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> AgentsIdEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized AgentsIdEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + AgentsIdEndpoint: The initialized AgentsIdEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = AgentsIdEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py b/src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py new file mode 100644 index 0000000..6f5d3ff --- /dev/null +++ b/src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMAgents +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class AgentsIdEndpoint( + HuntressEndpoint, + IGettable[SIEMAgents, HuntressSIEMRequestParams], + IPaginateable[SIEMAgents, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMAgents) + IPaginateable.__init__(self, SIEMAgents) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMAgents]: + """ + Performs a GET request against the /agents endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMAgents]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMAgents, + self, + "agents", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMAgents: + """ + Performs a GET request against the /agents endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMAgents, + super()._make_request("GET", data=data, params=params).json().get('agent', {}), + ) diff --git a/src/pyhuntress/endpoints/siem/BillingreportsEndpoint.py b/src/pyhuntress/endpoints/siem/BillingreportsEndpoint.py index 8e4a15b..11d707b 100644 --- a/src/pyhuntress/endpoints/siem/BillingreportsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/BillingreportsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.BillingreportsIdEndpoint import BillingIdreportsEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class BillingreportsEndpoint( IGettable.__init__(self, SIEMBillingReports) IPaginateable.__init__(self, SIEMBillingReports) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> BillingIdreportsEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized BillingIdreportsEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + BillingIdreportsEndpoint: The initialized BillingIdreportsEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = BillingIdreportsEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py b/src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py new file mode 100644 index 0000000..ae0cfb2 --- /dev/null +++ b/src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMBillingReports +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class BillingIdreportsEndpoint( + HuntressEndpoint, + IGettable[SIEMBillingReports, HuntressSIEMRequestParams], + IPaginateable[SIEMBillingReports, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMBillingReports) + IPaginateable.__init__(self, SIEMBillingReports) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMBillingReports]: + """ + Performs a GET request against the /billing_reports endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMBillingReports]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMBillingReports, + self, + "billing_reports", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMBillingReports: + """ + Performs a GET request against the /billing_reports endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMBillingReports, + super()._make_request("GET", data=data, params=params).json().get('billing_report', {}), + ) diff --git a/src/pyhuntress/endpoints/siem/IncidentreportsEndpoint.py b/src/pyhuntress/endpoints/siem/IncidentreportsEndpoint.py index 7f2b735..cf9844b 100644 --- a/src/pyhuntress/endpoints/siem/IncidentreportsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/IncidentreportsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.IncidentreportsIdEndpoint import IncidentreportsIdEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class IncidentreportsEndpoint( IGettable.__init__(self, SIEMIncidentReports) IPaginateable.__init__(self, SIEMIncidentReports) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> IncidentreportsIdEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized IncidentreportsIdEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + IncidentreportsIdEndpoint: The initialized IncidentreportsIdEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = IncidentreportsIdEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py b/src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py new file mode 100644 index 0000000..d4ca1ca --- /dev/null +++ b/src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMIncidentReports +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class IncidentreportsIdEndpoint( + HuntressEndpoint, + IGettable[SIEMIncidentReports, HuntressSIEMRequestParams], + IPaginateable[SIEMIncidentReports, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMIncidentReports) + IPaginateable.__init__(self, SIEMIncidentReports) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMIncidentReports]: + """ + Performs a GET request against the /incident_reports endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMIncidentReports]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMIncidentReports, + self, + "incident_reports", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMIncidentReports: + """ + Performs a GET request against the /incident_reports endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMIncidentReports, + super()._make_request("GET", data=data, params=params).json().get('incident_report', {}), + ) diff --git a/src/pyhuntress/endpoints/siem/OrganizationsEndpoint.py b/src/pyhuntress/endpoints/siem/OrganizationsEndpoint.py index a452bf8..115acda 100644 --- a/src/pyhuntress/endpoints/siem/OrganizationsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/OrganizationsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.OrganizationsIdEndpoint import OrganizationsIdEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class OrganizationsEndpoint( IGettable.__init__(self, SIEMOrganizations) IPaginateable.__init__(self, SIEMOrganizations) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> OrganizationsIdEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized OrganizationsIdEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + OrganizationsIdEndpoint: The initialized OrganizationsIdEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = OrganizationsIdEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py b/src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py new file mode 100644 index 0000000..122dc95 --- /dev/null +++ b/src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMOrganizations +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class OrganizationsIdEndpoint( + HuntressEndpoint, + IGettable[SIEMOrganizations, HuntressSIEMRequestParams], + IPaginateable[SIEMOrganizations, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMOrganizations) + IPaginateable.__init__(self, SIEMOrganizations) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMOrganizations]: + """ + Performs a GET request against the /organizations endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMOrganizations]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMOrganizations, + self, + "organizations", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMOrganizations: + """ + Performs a GET request against the /organizations endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMOrganizations, + super()._make_request("GET", data=data, params=params).json().get('organization', {}), + ) diff --git a/src/pyhuntress/endpoints/siem/ReportsEndpoint.py b/src/pyhuntress/endpoints/siem/ReportsEndpoint.py index 95dc5b6..0968fc5 100644 --- a/src/pyhuntress/endpoints/siem/ReportsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/ReportsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.ReportsIdEndpoint import ReportsIdEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class ReportsEndpoint( IGettable.__init__(self, SIEMReports) IPaginateable.__init__(self, SIEMReports) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> ReportsIdEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized ReportsIdEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + ReportsIdEndpoint: The initialized ReportsIdEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = ReportsIdEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py b/src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py new file mode 100644 index 0000000..ceee639 --- /dev/null +++ b/src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMReports +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class ReportsIdEndpoint( + HuntressEndpoint, + IGettable[SIEMReports, HuntressSIEMRequestParams], + IPaginateable[SIEMReports, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMReports) + IPaginateable.__init__(self, SIEMReports) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMReports]: + """ + Performs a GET request against the /reports endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMReports]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMReports, + self, + "reports", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMReports: + """ + Performs a GET request against the /reports endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMReports, + super()._make_request("GET", data=data, params=params).json().get('report', {}), + ) diff --git a/src/pyhuntress/endpoints/siem/SignalsEndpoint.py b/src/pyhuntress/endpoints/siem/SignalsEndpoint.py index fdd4876..44a737d 100644 --- a/src/pyhuntress/endpoints/siem/SignalsEndpoint.py +++ b/src/pyhuntress/endpoints/siem/SignalsEndpoint.py @@ -1,4 +1,5 @@ from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.endpoints.siem.SignalsIdEndpoint import SignalsIdEndpoint from pyhuntress.interfaces import ( IGettable, IPaginateable, @@ -21,16 +22,16 @@ class SignalsEndpoint( IGettable.__init__(self, SIEMSignals) IPaginateable.__init__(self, SIEMSignals) - def id(self, id: int) -> HuntressEndpoint: + def id(self, id: int) -> SignalsIdEndpoint: """ - Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain. + Sets the ID for this endpoint and returns an initialized SignalsIdEndpoint object to move down the chain. Parameters: id (int): The ID to set. Returns: - HuntressEndpoint: The initialized HuntressEndpoint object. + SignalsIdEndpoint: The initialized SignalsIdEndpoint object. """ - child = HuntressEndpoint(self.client, parent_endpoint=self) + child = SignalsIdEndpoint(self.client, parent_endpoint=self) child._id = id return child diff --git a/src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py b/src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py new file mode 100644 index 0000000..8969a48 --- /dev/null +++ b/src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py @@ -0,0 +1,72 @@ +from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint +from pyhuntress.interfaces import ( + IGettable, + IPaginateable, +) +from pyhuntress.models.siem import SIEMSignals +from pyhuntress.responses.paginated_response import PaginatedResponse +from pyhuntress.types import ( + JSON, + HuntressSIEMRequestParams, +) + + +class SignalsIdEndpoint( + HuntressEndpoint, + IGettable[SIEMSignals, HuntressSIEMRequestParams], + IPaginateable[SIEMSignals, HuntressSIEMRequestParams], +): + def __init__(self, client, parent_endpoint=None) -> None: + HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint) + IGettable.__init__(self, SIEMSignals) + IPaginateable.__init__(self, SIEMSignals) + + def paginated( + self, + page: int, + limit: int, + params: HuntressSIEMRequestParams | None = None, + ) -> PaginatedResponse[SIEMSignals]: + """ + Performs a GET request against the /signals endpoint and returns an initialized PaginatedResponse object. + + Parameters: + page (int): The page number to request. + limit (int): The number of results to return per page. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + PaginatedResponse[SIEMSignals]: The initialized PaginatedResponse object. + """ + if params: + params["page"] = page + params["limit"] = limit + else: + params = {"page": page, "limit": limit} + return PaginatedResponse( + super()._make_request("GET", params=params), + SIEMSignals, + self, + "signals", + page, + limit, + params, + ) + + def get( + self, + data: JSON | None = None, + params: HuntressSIEMRequestParams | None = None, + ) -> SIEMSignals: + """ + Performs a GET request against the /signals endpoint. + + Parameters: + data (dict[str, Any]): The data to send in the request body. + params (dict[str, int | str]): The parameters to send in the request query string. + Returns: + SIEMAuthInformation: The parsed response data. + """ + return self._parse_one( + SIEMSignals, + super()._make_request("GET", data=data, params=params).json().get('signal', {}), + ) diff --git a/src/scratchpad.py b/src/scratchpad.py index 8bccbc6..f3cc957 100644 --- a/src/scratchpad.py +++ b/src/scratchpad.py @@ -24,12 +24,24 @@ siem_api_client = HuntressSIEMAPIClient( #agents = siem_api_client.agents.get() #print(agents) +#agents = siem_api_client.agents.id(3989773).get() +#print(agents) + #billingreports = siem_api_client.billing_reports.get() #print(billingreports) +#billingreports = siem_api_client.billing_reports.id(90173).get() +#print(billingreports) + #incidentreports = siem_api_client.incident_reports.get() #print(incidentreports) +incidentreports = siem_api_client.incident_reports.id(1448648).get() +print(incidentreports) + +#organizations = siem_api_client.organizations.id(174759).get() +#print(organizations) + #organizations = siem_api_client.organizations.get() #print(organizations) @@ -39,16 +51,22 @@ siem_api_client = HuntressSIEMAPIClient( #signals = siem_api_client.signals.get() #print(signals) +reports = siem_api_client.reports.id(2175766).get() +print(reports) + +signals = siem_api_client.signals.id(36581548).get() +print(signals) + #paginated_billingreports = siem_api_client.billing_reports.paginated(1, 10) #print(paginated_billingreports.data) #paginated_incidentreports = siem_api_client.incident_reports.paginated(1, 10) #print(paginated_incidentreports.data) -paginated_organizations = siem_api_client.organizations.paginated(1, 1) -print(paginated_organizations.data) -paginated_organizations.get_next_page() -print(paginated_organizations.data) +#paginated_organizations = siem_api_client.organizations.paginated(2, 100) +#print(paginated_organizations.data) +#paginated_organizations.get_next_page() +#print(paginated_organizations.data) #paginated_reports = siem_api_client.reports.paginated(1, 10) #print(paginated_reports.data)