mirror of
https://github.com/brygphilomena/pyironscales.git
synced 2025-11-05 00:17:29 +00:00
Compare commits
No commits in common. "c45bf964473b30c7ef0b205c8664f7e3407e6c3e" and "83a238d20647352f696770e45ccc3d3ccdbbc670" have entirely different histories.
c45bf96447
...
83a238d206
1
.gitignore
vendored
1
.gitignore
vendored
@ -206,4 +206,3 @@ marimo/_static/
|
|||||||
marimo/_lsp/
|
marimo/_lsp/
|
||||||
__marimo__/
|
__marimo__/
|
||||||
src/ironscales_scratchpad.py
|
src/ironscales_scratchpad.py
|
||||||
src/pyironscales/endpoints/ironscales/old/
|
|
||||||
|
|||||||
@ -1,20 +1,16 @@
|
|||||||
import typing
|
import typing
|
||||||
import json
|
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from pyironscales.clients.base_client import IronscalesClient
|
from pyironscales.clients.base_client import IronscalesClient
|
||||||
from pyironscales.config import Config
|
from pyironscales.config import Config
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from pyironscales.endpoints.ironscales.CampaignsEndpoint import CampaignsEndpoint
|
from pyironscales.endpoints.ironscales.SurveysEndpoint import SurveysEndpoint
|
||||||
from pyironscales.endpoints.ironscales.CompanyEndpoint import CompanyEndpoint
|
from pyironscales.endpoints.ironscales.AnswersEndpoint import AnswersEndpoint
|
||||||
from pyironscales.endpoints.ironscales.EmailsEndpoint import EmailsEndpoint
|
from pyironscales.endpoints.ironscales.CustomersEndpoint import CustomersEndpoint
|
||||||
from pyironscales.endpoints.ironscales.IncidentEndpoint import IncidentEndpoint
|
from pyironscales.endpoints.ironscales.QuestionsEndpoint import QuestionsEndpoint
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsEndpoint import IntegrationsEndpoint
|
from pyironscales.endpoints.ironscales.TeamMembersEndpoint import TeamMembersEndpoint
|
||||||
from pyironscales.endpoints.ironscales.MailboxesEndpoint import MailboxesEndpoint
|
from pyironscales.endpoints.ironscales.ResponsesEndpoint import ResponsesEndpoint
|
||||||
from pyironscales.endpoints.ironscales.MitigationEndpoint import MitigationEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.PlanDetailsEndpoint import PlanDetailsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.SettingsEndpoint import SettingsEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IronscalesAPIClient(IronscalesClient):
|
class IronscalesAPIClient(IronscalesClient):
|
||||||
@ -26,7 +22,7 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
privatekey: str,
|
privatekey: str,
|
||||||
scopes: list,
|
scope: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Initializes the client with the given credentials.
|
Initializes the client with the given credentials.
|
||||||
@ -35,7 +31,7 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
privatekey (str): Your Ironscales API private key.
|
privatekey (str): Your Ironscales API private key.
|
||||||
"""
|
"""
|
||||||
self.privatekey: str = privatekey
|
self.privatekey: str = privatekey
|
||||||
self.scopes: list = json.loads(scopes) if isinstance(json.loads(scopes), list) else [json.loads(scopes)]
|
self.scope: list = scope
|
||||||
self.token_expiry_time: datetime = datetime.now(tz=timezone.utc)
|
self.token_expiry_time: datetime = datetime.now(tz=timezone.utc)
|
||||||
|
|
||||||
# Grab first access token
|
# Grab first access token
|
||||||
@ -43,58 +39,10 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
|
|
||||||
# Initializing endpoints
|
# Initializing endpoints
|
||||||
@property
|
@property
|
||||||
def campaigns(self) -> "CampaignsEndpoint":
|
def surveys(self) -> "SurveysEndpoint":
|
||||||
from pyironscales.endpoints.ironscales.CampaignsEndpoint import CampaignsEndpoint
|
from pyironscales.endpoints.ironscales.SurveysEndpoint import SurveysEndpoint
|
||||||
|
|
||||||
return CampaignsEndpoint(self)
|
return SurveysEndpoint(self)
|
||||||
|
|
||||||
@property
|
|
||||||
def company(self) -> "CompanyEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyEndpoint import CompanyEndpoint
|
|
||||||
|
|
||||||
return CompanyEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def emails(self) -> "EmailsEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.EmailsEndpoint import EmailsEndpoint
|
|
||||||
|
|
||||||
return EmailsEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def incident(self) -> "IncidentEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentEndpoint import IncidentEndpoint
|
|
||||||
|
|
||||||
return IncidentEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def integrations(self) -> "IntegrationsEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsEndpoint import IntegrationsEndpoint
|
|
||||||
|
|
||||||
return IntegrationsEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def mailboxes(self) -> "MailboxesEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.MailboxesEndpoint import MailboxesEndpoint
|
|
||||||
|
|
||||||
return MailboxesEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def mitigation(self) -> "MitigationEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationEndpoint import MitigationEndpoint
|
|
||||||
|
|
||||||
return MitigationEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def plan_details(self) -> "PlanDetailsEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.PlanDetailsEndpoint import PlanDetailsEndpoint
|
|
||||||
|
|
||||||
return PlanDetailsEndpoint(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def settings(self) -> "SettingsEndpoint":
|
|
||||||
from pyironscales.endpoints.ironscales.SettingsEndpoint import SettingsEndpoint
|
|
||||||
|
|
||||||
return SettingsEndpoint(self)
|
|
||||||
|
|
||||||
def _get_url(self) -> str:
|
def _get_url(self) -> str:
|
||||||
"""
|
"""
|
||||||
@ -113,16 +61,17 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
"POST",
|
"POST",
|
||||||
f"{self._get_url()}/get-token/",
|
f"{self._get_url()}/get-token/",
|
||||||
data={
|
data={
|
||||||
"key": self.privatekey,
|
"key": self.privatekey,
|
||||||
"scopes": self.scopes
|
"scopes": self.scope
|
||||||
},
|
},
|
||||||
headers={
|
headers={
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
"Accept": "application/json"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
auth_resp_json = auth_response.json()
|
auth_resp_json = auth_response.json()
|
||||||
token = auth_resp_json["jwt"]
|
token = auth_resp_json["jwt"]
|
||||||
expires_in_sec = 43200
|
expires_in_sec = auth_resp_json["expires_in"]
|
||||||
self.token_expiry_time = datetime.now(tz=timezone.utc) + timedelta(seconds=expires_in_sec)
|
self.token_expiry_time = datetime.now(tz=timezone.utc) + timedelta(seconds=expires_in_sec)
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|||||||
24
src/pyironscales/endpoints/ironscales/AnswersEndpoint.py
Normal file
24
src/pyironscales/endpoints/ironscales/AnswersEndpoint.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.AnswersIdEndpoint import AnswersIdEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.AnswersSearchEndpoint import AnswersSearchEndpoint
|
||||||
|
|
||||||
|
|
||||||
|
class AnswersEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "answers", parent_endpoint=parent_endpoint)
|
||||||
|
self.search = self._register_child_endpoint(AnswersSearchEndpoint(client, parent_endpoint=self))
|
||||||
|
|
||||||
|
def id(self, id: int) -> AnswersIdEndpoint:
|
||||||
|
"""
|
||||||
|
Sets the ID for this endpoint and returns an initialized AnswersIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
id (int): The ID to set.
|
||||||
|
Returns:
|
||||||
|
AnswersIdEndpoint: The initialized AnswersIdEndpoint object.
|
||||||
|
"""
|
||||||
|
child = AnswersIdEndpoint(self.client, parent_endpoint=self)
|
||||||
|
child._id = id
|
||||||
|
return child
|
||||||
@ -1,40 +1,41 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPuttable,
|
IPuttable
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import AccountTakeoverSensitivySettings
|
from pyironscales.models.ironscales import Answer
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
class SettingsIdAccountTakeoverEndpoint(
|
|
||||||
|
class AnswersIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[AccountTakeoverSensitivySettings, IronscalesRequestParams],
|
IGettable[Answer, IronscalesRequestParams],
|
||||||
IPuttable[AccountTakeoverSensitivySettings, IronscalesRequestParams],
|
IPuttable[Answer, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "account-takeover/", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, AccountTakeoverSensitivySettings)
|
IGettable.__init__(self, Answer)
|
||||||
IPuttable.__init__(self, AccountTakeoverSensitivySettings)
|
IPuttable.__init__(self, Answer)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> AccountTakeoverSensitivySettings:
|
) -> Answer:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /settings/{id}/account-takeover/ endpoint.
|
Performs a GET request against the /answers/{id} endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
AccountTakeoverSensitivySettings: The parsed response data.
|
AuthInformation: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
AccountTakeoverSensitivySettings,
|
Answer,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,17 +43,17 @@ class SettingsIdAccountTakeoverEndpoint(
|
|||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> AccountTakeoverSensitivySettings:
|
) -> Answer:
|
||||||
"""
|
"""
|
||||||
Performs a PUT request against the /settings/{id}/account-takeover/ endpoint.
|
Performs a PUT request against the /answers/{id} endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
AccountTakeoverSensitivySettings: The parsed response data.
|
Answer: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
AccountTakeoverSensitivySettings,
|
Answer,
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Answer
|
||||||
|
from pyironscales.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AnswersSearchEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[Answer, IronscalesRequestParams],
|
||||||
|
IPaginateable[Answer, IronscalesRequestParams],
|
||||||
|
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "search", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Answer)
|
||||||
|
IPaginateable.__init__(self, Answer)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[Answer]:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /answers/search 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[Answer]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page[number]"] = page
|
||||||
|
params["page[size]"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page[number]": page, "page[size]": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("POST", params=params),
|
||||||
|
Answer,
|
||||||
|
self,
|
||||||
|
"answers",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Answer:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /answers/search 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_many(Answer, super()._make_request("POST", data=data, params=params).json().get('answers', {}))
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CampaignsIdEndpoint import CampaignsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class CampaignsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "campaigns", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> CampaignsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized CampaignsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
CampaignsIdEndpoint: The initialized CampaignsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = CampaignsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import Campaigns
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CampaignsIdDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[Campaigns, IronscalesRequestParams],
|
|
||||||
IPaginateable[Campaigns, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "details", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, Campaigns)
|
|
||||||
IPaginateable.__init__(self, Campaigns)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[Campaigns]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /campaigns/{id}/details endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[Campaigns]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
Campaigns,
|
|
||||||
self,
|
|
||||||
"campaigns",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> Campaigns:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /campaigns/{id}/details 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:
|
|
||||||
AuthInformation: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
Campaigns,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('campaigns', {}),
|
|
||||||
)
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.models.ironscales import Answer
|
|
||||||
from pyironscales.endpoints.ironscales.CampaignsIdDetailsEndpoint import CampaignsIdDetailsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CampaignsIdParticipantDetailsEndpoint import CampaignsIdParticipantDetailsEndpoint
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CampaignsIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
self.search = self._register_child_endpoint(CampaignsIdDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.search = self._register_child_endpoint(CampaignsIdParticipantDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CampaignParticipants
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CampaignsIdParticipantDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CampaignParticipants, IronscalesRequestParams],
|
|
||||||
IPaginateable[CampaignParticipants, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "participant-details", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CampaignParticipants)
|
|
||||||
IPaginateable.__init__(self, CampaignParticipants)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[CampaignParticipants]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /campaigns/{id}/participant-details endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[CampaignParticipants]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
CampaignParticipants,
|
|
||||||
self,
|
|
||||||
"participants",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CampaignParticipants:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /campaigns/{id}/participant-details 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:
|
|
||||||
AuthInformation: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CampaignParticipants,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('participants', {}),
|
|
||||||
)
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdEndpoint import CompanyIdEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyCreateEndpoint import CompanyCreateEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyListEndpoint import CompanyListEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "company", parent_endpoint=parent_endpoint)
|
|
||||||
self.create = self._register_child_endpoint(CompanyCreateEndpoint(client, parent_endpoint=self))
|
|
||||||
self.list = self._register_child_endpoint(CompanyListEndpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def id(self, id: int) -> CompanyIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized CompanyIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
CompanyIdEndpoint: The initialized CompanyIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = CompanyIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IDeleteable
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import Company911Email
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyId911EmailEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[Company911Email, IronscalesRequestParams],
|
|
||||||
IPostable[Company911Email, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "911-email/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, Company911Email)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> Company911Email:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/911-email/ 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:
|
|
||||||
Company911Email: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
Company911Email,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Company911Email:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /company/{id}/911-email/ 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:
|
|
||||||
Survey: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(Company911Email, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Company911Email:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /company/{id}/911-email/ 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:
|
|
||||||
Company911Email: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(Company911Email, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdAutoSyncGroupsEndpoint import CompanyIdAutoSyncGroupsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdAutoSyncMailboxesEndpoint import CompanyIdAutoSyncMailboxesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IDeleteable
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyAutoSyncStatus
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdAutoSyncEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyAutoSyncStatus, IronscalesRequestParams],
|
|
||||||
IPostable[CompanyAutoSyncStatus, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "auto-sync/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyAutoSyncStatus)
|
|
||||||
IPostable.__init__(self, CompanyAutoSyncStatus)
|
|
||||||
IDeleteable.__init__(self, CompanyAutoSyncStatus)
|
|
||||||
self.groups = self._register_child_endpoint(CompanyIdAutoSyncGroupsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.mailboxes = self._register_child_endpoint(CompanyIdAutoSyncMailboxesEndpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyAutoSyncStatus:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/auto-sync/ 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:
|
|
||||||
CompanyAutoSyncStatus: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyAutoSyncStatus,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyAutoSyncStatus:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /company/{id}/auto-sync/ 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:
|
|
||||||
CompanyAutoSyncStatus: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyAutoSyncStatus, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyAutoSyncStatus:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /company/{id}/auto-sync/ 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:
|
|
||||||
CompanyAutoSyncStatus: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyAutoSyncStatus, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyMailboxes
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdAutoSyncMailboxesEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyMailboxes, IronscalesRequestParams],
|
|
||||||
IPaginateable[CompanyMailboxes, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "mailboxes/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyMailboxes)
|
|
||||||
IPaginateable.__init__(self, CompanyMailboxes)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[CompanyMailboxes]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/auto-sync/mailboxes/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[CompanyMailboxes]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
CompanyMailboxes,
|
|
||||||
self,
|
|
||||||
"emails",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyMailboxes:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/auto-sync/mailboxes/ 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:
|
|
||||||
CompanyMailboxes: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
CompanyMailboxes,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('emails', {}),
|
|
||||||
)
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPuttable,
|
|
||||||
IDeleteable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import PartnerCompany
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyId911EmailEndpoint import CompanyId911EmailEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdAutoSyncEndpoint import CompanyIdAutoSyncEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdFeaturesEndpoint import CompanyIdFeaturesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdManifestEndpoint import CompanyIdManifestEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyIdStatsEndpoint import CompanyIdStatsEndpoint
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[PartnerCompany, IronscalesRequestParams],
|
|
||||||
IPuttable[PartnerCompany, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, PartnerCompany)
|
|
||||||
IPuttable.__init__(self, PartnerCompany)
|
|
||||||
IDeleteable.__init__(self, PartnerCompany)
|
|
||||||
self._911_email = self._register_child_endpoint(CompanyId911EmailEndpoint(client, parent_endpoint=self))
|
|
||||||
self.auto_sync = self._register_child_endpoint(CompanyIdAutoSyncEndpoint(client, parent_endpoint=self))
|
|
||||||
self.features = self._register_child_endpoint(CompanyIdFeaturesEndpoint(client, parent_endpoint=self))
|
|
||||||
self.manifest = self._register_child_endpoint(CompanyIdManifestEndpoint(client, parent_endpoint=self))
|
|
||||||
self.stats = self._register_child_endpoint(CompanyIdStatsEndpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PartnerCompany:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id} 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:
|
|
||||||
AuthInformation: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
PartnerCompany,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PartnerCompany:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /company/{id} 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:
|
|
||||||
PartnerCompany: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
PartnerCompany,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> PartnerCompany:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /company/{id}/ 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:
|
|
||||||
PartnerCompany: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(PartnerCompany, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IPuttable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyFeaturesStates
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdFeaturesEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyFeaturesStates, IronscalesRequestParams],
|
|
||||||
IPostable[CompanyFeaturesStates, IronscalesRequestParams],
|
|
||||||
IPuttable[CompanyFeaturesStates, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "features/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyFeaturesStates)
|
|
||||||
IPostable.__init__(self, CompanyFeaturesStates)
|
|
||||||
IPuttable.__init__(self, CompanyFeaturesStates)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyFeaturesStates:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/features/ 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:
|
|
||||||
CompanyFeaturesStates: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyFeaturesStates,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyFeaturesStates:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /company/{id}/features/ 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:
|
|
||||||
CompanyAutoSyncStatus: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyFeaturesStates, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyFeaturesStates:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /company/{id} 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:
|
|
||||||
CompanyFeaturesStates: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyFeaturesStates,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyStatisticsAndLicense
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdStatsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyStatisticsAndLicense, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "stats/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyStatisticsAndLicense)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyStatisticsAndLicense:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/{id}/stats/ 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:
|
|
||||||
CompanyStatisticsAndLicense: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyStatisticsAndLicense,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.CompanyListV2Endpoint import CompanyListV2Endpoint
|
|
||||||
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import PartnerCompany
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[PartnerCompany, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "list", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, PartnerCompany)
|
|
||||||
self.v2 = self._register_child_endpoint(CompanyListV2Endpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PartnerCompany:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/list 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:
|
|
||||||
AuthInformation: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
PartnerCompany,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('companies', {}),
|
|
||||||
)
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import PartnerCompanyV2
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyListV2Endpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[PartnerCompanyV2, IronscalesRequestParams],
|
|
||||||
IPaginateable[PartnerCompanyV2, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "v2/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, PartnerCompanyV2)
|
|
||||||
IPaginateable.__init__(self, PartnerCompanyV2)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[PartnerCompanyV2]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/list/v2/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[PartnerCompanyV2]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
PartnerCompanyV2,
|
|
||||||
self,
|
|
||||||
"data",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PartnerCompanyV2:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /company/list/v2/ 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:
|
|
||||||
PartnerCompanyV2: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
PartnerCompanyV2,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('data', {}),
|
|
||||||
)
|
|
||||||
@ -2,29 +2,30 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import IncidentClassify
|
from pyironscales.models.ironscales import CustomerBulk
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdClassifyIdEndpoint(
|
class CustomersBulkEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[IncidentClassify, IronscalesRequestParams],
|
IPostable[CustomerBulk, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "bulk", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, IncidentClassify)
|
IPostable.__init__(self, CustomerBulk)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IncidentClassify:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CustomerBulk:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /incident/{id}/classify/{id} endpoint.
|
Performs a POST request against the /customers/bulk endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
IncidentClassify: The parsed Company data.
|
Survey: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(IncidentClassify, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(CustomerBulk, super()._make_request("POST", data=data, params=params).json())
|
||||||
46
src/pyironscales/endpoints/ironscales/CustomersEndpoint.py
Normal file
46
src/pyironscales/endpoints/ironscales/CustomersEndpoint.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.CustomersIdEndpoint import CustomersIdEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.CustomersBulkEndpoint import CustomersBulkEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Customer
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CustomersEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[Customer, IronscalesRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "customers", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Customer)
|
||||||
|
self.bulk = self._register_child_endpoint(CustomersBulkEndpoint(client, parent_endpoint=self))
|
||||||
|
|
||||||
|
def id(self, id: int) -> CustomersIdEndpoint:
|
||||||
|
"""
|
||||||
|
Sets the ID for this endpoint and returns an initialized CustomersIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
id (int): The ID to set.
|
||||||
|
Returns:
|
||||||
|
CustomersIdEndpoint: The initialized CustomersIdEndpoint object.
|
||||||
|
"""
|
||||||
|
child = CustomersIdEndpoint(self.client, parent_endpoint=self)
|
||||||
|
child._id = id
|
||||||
|
return child
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Customer:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /customers 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:
|
||||||
|
Customer: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(Customer, super()._make_request("POST", data=data, params=params).json())
|
||||||
59
src/pyironscales/endpoints/ironscales/CustomersIdEndpoint.py
Normal file
59
src/pyironscales/endpoints/ironscales/CustomersIdEndpoint.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPuttable
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Customer
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CustomersIdEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IGettable[Customer, IronscalesRequestParams],
|
||||||
|
IPuttable[Customer, IronscalesRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, Customer)
|
||||||
|
IPuttable.__init__(self, Customer)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Customer:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /customers/{id} 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:
|
||||||
|
AuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Customer,
|
||||||
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
|
)
|
||||||
|
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Customer:
|
||||||
|
"""
|
||||||
|
Performs a PUT request against the /customers/{id} 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:
|
||||||
|
Customer: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Customer,
|
||||||
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
|
)
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.EmailsIdEndpoint import EmailsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class EmailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "emails", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> EmailsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized EmailsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
EmailsIdEndpoint: The initialized EmailsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = EmailsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import EscalatedEmails
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class EmailsIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[EscalatedEmails, IronscalesRequestParams],
|
|
||||||
IPaginateable[EscalatedEmails, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, EscalatedEmails)
|
|
||||||
IPaginateable.__init__(self, EscalatedEmails)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[EscalatedEmails]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/list/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[EscalatedEmails]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
EscalatedEmails,
|
|
||||||
self,
|
|
||||||
"emails",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> EscalatedEmails:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /emails/{id} 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:
|
|
||||||
EscalatedEmails: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
EscalatedEmails,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('emails', {}),
|
|
||||||
)
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdEndpoint import IncidentIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "incident", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> IncidentIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized IncidentIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
IncidentIdEndpoint: The initialized IncidentIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = IncidentIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdClassifyIdEndpoint import IncidentIdClassifyIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdClassifyEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "classify", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> IncidentIdClassifyIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized IncidentIdClassifyIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
IncidentIdClassifyIdEndpoint: The initialized IncidentIdClassifyIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = IncidentIdClassifyIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdDetailsIdEndpoint import IncidentIdDetailsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "details", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> IncidentIdDetailsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized IncidentIdDetailsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
IncidentIdDetailsIdEndpoint: The initialized IncidentIdDetailsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = IncidentIdDetailsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdClassifyEndpoint import IncidentIdClassifyEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdDetailsEndpoint import IncidentIdDetailsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdListEndpoint import IncidentIdListEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdScanbackListEndpoint import IncidentIdScanbackListEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdStatsEndpoint import IncidentIdStatsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdStatusEndpoint import IncidentIdStatusEndpoint
|
|
||||||
|
|
||||||
class IncidentIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
self.classify = self._register_child_endpoint(IncidentIdClassifyEndpoint(client, parent_endpoint=self))
|
|
||||||
self.details = self._register_child_endpoint(IncidentIdDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.list = self._register_child_endpoint(IncidentIdListEndpoint(client, parent_endpoint=self))
|
|
||||||
self.scanback_list = self._register_child_endpoint(IncidentIdScanbackListEndpoint(client, parent_endpoint=self))
|
|
||||||
self.stats = self._register_child_endpoint(IncidentIdStatsEndpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def id(self, id: int) -> IncidentIdStatusEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized IncidentIdStatusEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
IncidentIdStatusEndpoint: The initialized IncidentIdStatusEndpoint object.
|
|
||||||
"""
|
|
||||||
child = IncidentIdStatusEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import Incidents
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[Incidents, IronscalesRequestParams],
|
|
||||||
IPaginateable[Incidents, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "list/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, Incidents)
|
|
||||||
IPaginateable.__init__(self, Incidents)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[Incidents]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/list/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[Incidents]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
Incidents,
|
|
||||||
self,
|
|
||||||
"incidents",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> Incidents:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/list/ 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:
|
|
||||||
Incidents: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
Incidents,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('incidents', {}),
|
|
||||||
)
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import ScanbackIncidents
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdScanbackListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[ScanbackIncidents, IronscalesRequestParams],
|
|
||||||
IPaginateable[ScanbackIncidents, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "scanback-list/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, ScanbackIncidents)
|
|
||||||
IPaginateable.__init__(self, ScanbackIncidents)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[ScanbackIncidents]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/scanback-list/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[ScanbackIncidents]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
ScanbackIncidents,
|
|
||||||
self,
|
|
||||||
"incidents",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> ScanbackIncidents:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/scanback-list/ 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:
|
|
||||||
ScanbackIncidents: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
ScanbackIncidents,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('incidents', {}),
|
|
||||||
)
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IncidentIdStatsRemediationStatusesEndpoint import IncidentIdStatsRemediationStatusesEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdStatsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "stats", parent_endpoint=parent_endpoint)
|
|
||||||
self.remediation_statuses = self._register_child_endpoint(IncidentIdStatsRemediationStatusesEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import RemediationStatusesStats
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdStatsRemediationStatusesEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[RemediationStatusesStats, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "*", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, RemediationStatusesStats)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> RemediationStatusesStats:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /incident/{id}/stats/remediation-statuses 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:
|
|
||||||
RemediationStatusesStats: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
RemediationStatusesStats,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdEndpoint import IntegrationsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "integrations", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> IntegrationsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized IntegrationsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
IntegrationsIdEndpoint: The initialized IntegrationsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = IntegrationsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationDisableIntegration
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdDisableIntegrationEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[IntegrationDisableIntegration, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "manifest/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, IntegrationDisableIntegration)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IntegrationDisableIntegration:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /integrations/{id}/disable-integration/ 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:
|
|
||||||
IntegrationDisableIntegration: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(IntegrationDisableIntegration, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdIntegrationStatusEndpoint import IntegrationsIdIntegrationStatusEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdDisableIntegrationEndpoint import IntegrationsIdDisableIntegrationEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdGWSAuthorizeEndpoint import IntegrationsIdGWSAuthorizeEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdGWSConsentRedirectURIEndpoint import IntegrationsIdGWSConsentRedirectURIEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdO365AuthorizeEndpoint import IntegrationsIdO365AuthorizeEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.IntegrationsIdO365ConsentRedirectURIEndpoint import IntegrationsIdO365ConsentRedirectURIEndpoint
|
|
||||||
|
|
||||||
class IntegrationsIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
self.integration_status = self._register_child_endpoint(IntegrationsIdIntegrationStatusEndpoint(client, parent_endpoint=self))
|
|
||||||
self.disable_integration = self._register_child_endpoint(IntegrationsIdDisableIntegrationEndpoint(client, parent_endpoint=self))
|
|
||||||
self.gws_authorize_endpoint = self._register_child_endpoint(IntegrationsIdGWSAuthorizeEndpoint(client, parent_endpoint=self))
|
|
||||||
self.gws_consent_redirect_uri = self._register_child_endpoint(IntegrationsIdGWSConsentRedirectURIEndpoint(client, parent_endpoint=self))
|
|
||||||
self.o365_authorize = self._register_child_endpoint(IntegrationsIdO365AuthorizeEndpoint(client, parent_endpoint=self))
|
|
||||||
self.o365_consent_redirect_uri = self._register_child_endpoint(IntegrationsIdO365ConsentRedirectURIEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationGWSAuthorizeResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdGWSAuthorizeEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[IntegrationGWSAuthorizeResponse, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "gws-authorize/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, IntegrationGWSAuthorizeResponse)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IntegrationGWSAuthorizeResponse:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /integrations/{id}/gws-authorize/ 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:
|
|
||||||
IntegrationGWSAuthorizeResponse: The parsed IntegrationGWSAuthorizeResponse data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(IntegrationGWSAuthorizeResponse, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationsGWSConsentRedirectURL
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdGWSConsentRedirectURIEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[IntegrationsGWSConsentRedirectURL, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "gws-consent-redirect-uri/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, IntegrationsGWSConsentRedirectURL)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IntegrationsGWSConsentRedirectURL:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /integrations/{id}/gws-consent-redirect-uri/ 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:
|
|
||||||
IntegrationsGWSConsentRedirectURL: The parsed IntegrationsGWSConsentRedirectURL data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(IntegrationsGWSConsentRedirectURL, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationStatus
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdIntegrationStatusEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[IntegrationStatus, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "integration-status/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, IntegrationStatus)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> IntegrationStatus:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /integrations/{id}/integration-status/ 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:
|
|
||||||
IntegrationStatus: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
IntegrationStatus,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationO365AuthorizeResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdO365AuthorizeEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[IntegrationO365AuthorizeResponse, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "o365-authorize/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, IntegrationO365AuthorizeResponse)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IntegrationO365AuthorizeResponse:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /integrations/{id}/o365-authorize/ 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:
|
|
||||||
IntegrationO365AuthorizeResponse: The parsed IntegrationO365AuthorizeResponse data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(IntegrationO365AuthorizeResponse, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IntegrationsO365ConsentRedirectURLResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationsIdO365ConsentRedirectURIEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[IntegrationsO365ConsentRedirectURLResponse, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "o365-consent-redirect-uri/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, IntegrationsO365ConsentRedirectURLResponse)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IntegrationsO365ConsentRedirectURLResponse:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /integrations/{id}/o365-consent-redirect-uri/ 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:
|
|
||||||
IntegrationsO365ConsentRedirectURLResponse: The parsed IntegrationsO365ConsentRedirectURLResponse data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(IntegrationsO365ConsentRedirectURLResponse, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MailboxesIdEndpoint import MailboxesIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class MailboxesEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "mailboxes", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> MailboxesIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized MailboxesIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
MailboxesIdEndpoint: The initialized MailboxesIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = MailboxesIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import ComplianceReport
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MailboxesIdComplianceReportEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[ComplianceReport, IronscalesRequestParams],
|
|
||||||
IPaginateable[ComplianceReport, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "compliance-report/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, ComplianceReport)
|
|
||||||
IPaginateable.__init__(self, ComplianceReport)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[ComplianceReport]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/compliance-report/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[ComplianceReport]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
ComplianceReport,
|
|
||||||
self,
|
|
||||||
"data",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> ComplianceReport:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/compliance-report/ 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:
|
|
||||||
ComplianceReport: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
ComplianceReport,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('data', {}),
|
|
||||||
)
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MailboxesIdComplianceReportEndpoint import MailboxesIdComplianceReportEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MailboxesIdListEndpoint import MailboxesIdListEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MailboxesIdUserCampaignsPerformanceEndpoint import MailboxesIdUserCampaignsPerformanceEndpoint
|
|
||||||
|
|
||||||
class MailboxesIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
self.compliance_report = self._register_child_endpoint(MailboxesIdComplianceReportEndpoint(client, parent_endpoint=self))
|
|
||||||
self.list = self._register_child_endpoint(MailboxesIdListEndpoint(client, parent_endpoint=self))
|
|
||||||
self.user_campaigns_performance = self._register_child_endpoint(MailboxesIdUserCampaignsPerformanceEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPuttable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyMailboxes, CompanyMailboxesPutResponse
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MailboxesIdListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyMailboxes, IronscalesRequestParams],
|
|
||||||
IPuttable[CompanyMailboxes, IronscalesRequestParams],
|
|
||||||
IPaginateable[CompanyMailboxes, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "list/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyMailboxes)
|
|
||||||
IPuttable.__init__(self, CompanyMailboxes)
|
|
||||||
IPaginateable.__init__(self, CompanyMailboxes)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[CompanyMailboxes]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/list/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[CompanyMailboxes]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
CompanyMailboxes,
|
|
||||||
self,
|
|
||||||
"mailboxes",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyMailboxes:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/list/ 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:
|
|
||||||
CompanyMailboxes: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
CompanyMailboxes,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('mailboxes', {}),
|
|
||||||
)
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyMailboxesPutResponse:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /company/{id}/list/ 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:
|
|
||||||
CompanyMailboxesPutResponse: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyMailboxesPutResponse,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import UserCampaignPerformance
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MailboxesIdUserCampaignsPerformanceEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[UserCampaignPerformance, IronscalesRequestParams],
|
|
||||||
IPaginateable[UserCampaignPerformance, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "user-campaigns-performance/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, UserCampaignPerformance)
|
|
||||||
IPaginateable.__init__(self, UserCampaignPerformance)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[UserCampaignPerformance]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/user-campaigns-performance/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[UserCampaignPerformance]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
UserCampaignPerformance,
|
|
||||||
self,
|
|
||||||
"data",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> UserCampaignPerformance:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mailboxes/{id}/user-campaigns-performance/ 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:
|
|
||||||
UserCampaignPerformance: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
UserCampaignPerformance,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('data', {}),
|
|
||||||
)
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationIdEndpoint import MitigationIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class MitigationEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "mitigations", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> MitigationIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized MitigationIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
MitigationIdEndpoint: The initialized MitigationIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = MitigationIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdDetailsEndpoint import MitigationsIdDetailsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdImpersonationEndpoint import MitigationsIdImpersonationEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdIncidentsEndpoint import MitigationsIdIncidentsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdStatsEndpoint import MitigationsIdStatsEndpoint
|
|
||||||
|
|
||||||
class MitigationIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
|
||||||
self.details = self._register_child_endpoint(MitigationsIdDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.impersonation = self._register_child_endpoint(MitigationsIdImpersonationEndpoint(client, parent_endpoint=self))
|
|
||||||
self.incidents = self._register_child_endpoint(MitigationsIdIncidentsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.stats = self._register_child_endpoint(MitigationsIdStatsEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdDetailsEndpoint import MitigationsIdDetailsEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IPostable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyMitigationDetails, CompanyMitigationDetailsPostResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class IncidentIdDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IPostable[CompanyMitigationDetails, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "details/", parent_endpoint=parent_endpoint)
|
|
||||||
IPostable.__init__(self, CompanyMitigationDetailsPostResponse)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyMitigationDetailsPostResponse:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /mitigations/{id}/details/ 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:
|
|
||||||
CompanyMitigationDetailsPostResponse: The parsed CompanyMitigationDetailsPostResponse data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyMitigationDetailsPostResponse, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyImpersonationIncidents
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdImpersonationDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyImpersonationIncidents, IronscalesRequestParams],
|
|
||||||
IPostable[CompanyImpersonationIncidents, IronscalesRequestParams],
|
|
||||||
IPaginateable[CompanyImpersonationIncidents, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "details/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyImpersonationIncidents)
|
|
||||||
IPostable.__init__(self, CompanyImpersonationIncidents)
|
|
||||||
IPaginateable.__init__(self, CompanyImpersonationIncidents)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[CompanyImpersonationIncidents]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/impersonation/details/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[CompanyImpersonationIncidents]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
CompanyImpersonationIncidents,
|
|
||||||
self,
|
|
||||||
"incidents",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyImpersonationIncidents:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/impersonation/details/ 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:
|
|
||||||
CompanyImpersonationIncidents: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
CompanyImpersonationIncidents,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('incidents', {}),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyImpersonationIncidents:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /mitigations/{id}/details/ 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:
|
|
||||||
CompanyImpersonationIncidents: The parsed CompanyImpersonationIncidents data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyImpersonationIncidents, super()._make_request("POST", data=data, params=params).json().get('incidents', {}))
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdImpersonationDetailsEndpoint import MitigationsIdImpersonationDetailsEndpoint
|
|
||||||
|
|
||||||
class MitigationsIdImpersonationEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "impersonation", parent_endpoint=parent_endpoint)
|
|
||||||
self.details = self._register_child_endpoint(MitigationsIdImpersonationDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPaginateable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import IncidentDetails
|
|
||||||
from pyironscales.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdIncidentsDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[IncidentDetails, IronscalesRequestParams],
|
|
||||||
IPaginateable[IncidentDetails, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "details/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, IncidentDetails)
|
|
||||||
IPaginateable.__init__(self, IncidentDetails)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[IncidentDetails]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/incidents/details/ endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[IncidentDetails]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page"] = page
|
|
||||||
else:
|
|
||||||
params = {"page": page}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
IncidentDetails,
|
|
||||||
self,
|
|
||||||
"incidents",
|
|
||||||
page,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> IncidentDetails:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/incidents/details/ 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:
|
|
||||||
IncidentDetails: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_many(
|
|
||||||
IncidentDetails,
|
|
||||||
super()._make_request("GET", data=data, params=params).json().get('incidents', {}),
|
|
||||||
)
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdIncidentsDetailsEndpoint import MitigationsIdIncidentsDetailsEndpoint
|
|
||||||
|
|
||||||
class MitigationsIdIncidentsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "incidents", parent_endpoint=parent_endpoint)
|
|
||||||
self.details = self._register_child_endpoint(MitigationsIdIncidentsDetailsEndpoint(client, parent_endpoint=self))
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyEmailStatistics
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdStatsEmailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyEmailStatistics, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "emails/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyEmailStatistics)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyEmailStatistics:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/stats/emails/ 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:
|
|
||||||
CompanyMitigationStatistics: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyEmailStatistics,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdStatsEmailsEndpoint import MitigationsIdStatsEmailsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdStatsMostTargetedDepartmentsEndpoint import MitigationsIdStatsMostTargetedDepartmentsEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdStatsMostTargetedEmployeesEndpoint import MitigationsIdStatsMostTargetedEmployeesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.MitigationsIdStatsV2Endpoint import MitigationsIdStatsV2Endpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyMitigationStatistics
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdStatsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyMitigationStatistics, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "stats/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyMitigationStatistics)
|
|
||||||
self.emails = self._register_child_endpoint(MitigationsIdStatsEmailsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.most_targeted_departments = self._register_child_endpoint(MitigationsIdStatsMostTargetedDepartmentsEndpoint(client, parent_endpoint=self))
|
|
||||||
self.most_targeted_employees = self._register_child_endpoint(MitigationsIdStatsMostTargetedEmployeesEndpoint(client, parent_endpoint=self))
|
|
||||||
self.v2 = self._register_child_endpoint(MitigationsIdStatsV2Endpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyMitigationStatistics:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/stats/ 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:
|
|
||||||
CompanyMitigationStatistics: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyMitigationStatistics,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import MostTargetedDepartments
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdStatsMostTargetedDepartmentsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[MostTargetedDepartments, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "most-targeted-departments/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, MostTargetedDepartments)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> MostTargetedDepartments:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/stats/most-targeted-departments/ 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:
|
|
||||||
MostTargetedDepartments: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
MostTargetedDepartments,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import MostTargetedEmployees
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdStatsMostTargetedEmployeesEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[MostTargetedEmployees, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "most-targeted-employees/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, MostTargetedEmployees)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> MostTargetedEmployees:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/stats/most-targeted-employees/ 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:
|
|
||||||
MostTargetedEmployees: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
MostTargetedEmployees,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyMitigationStatisticsV2
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class MitigationsIdStatsV2Endpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyMitigationStatisticsV2, IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "v2/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyMitigationStatisticsV2)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyMitigationStatisticsV2:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /mitigations/{id}/stats/v2/ 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:
|
|
||||||
CompanyMitigationStatisticsV2: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyMitigationStatisticsV2,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.PlanDetailsDomainsIdEndpoint import PlanDetailsDomainsIdEndpoint
|
|
||||||
|
|
||||||
class CompanyListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "list", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> PlanDetailsDomainsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized PlanDetailsDomainsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
PlanDetailsDomainsIdEndpoint: The initialized PlanDetailsDomainsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = PlanDetailsDomainsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPuttable,
|
|
||||||
IDeleteable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyLicensedDomains, CompanyLicensedDomainsPutResponse
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class PlanDetailsDomainsIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyLicensedDomains, IronscalesRequestParams],
|
|
||||||
IPuttable[CompanyLicensedDomains, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyLicensedDomains)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyLicensedDomains:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /plan-details/domains/{id}/ 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:
|
|
||||||
CompanyLicensedDomains: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyLicensedDomains,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyLicensedDomainsPutResponse:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /plan-details/domains/{id}/ 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:
|
|
||||||
CompanyLicensedDomainsPutResponse: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyLicensedDomainsPutResponse, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyLicensedDomains:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /plan-details/domains/{id}/ 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:
|
|
||||||
CompanyLicensedDomains: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyLicensedDomains, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.PlanDetailsIdEndpoint import PlanDetailsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class PlanDetailsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "plan-details", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> PlanDetailsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized PlanDetailsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
PlanDetailsIdEndpoint: The initialized PlanDetailsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = PlanDetailsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -2,36 +2,37 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CompanyAutoSyncGroups
|
from pyironscales.models.ironscales import Question
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdAutoSyncGroupsEndpoint(
|
class QuestionsEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[CompanyAutoSyncGroups, IronscalesRequestParams],
|
IGettable[Question, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "groups/", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "questions", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, CompanyAutoSyncGroups)
|
IGettable.__init__(self, Question)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> CompanyAutoSyncGroups:
|
) -> Question:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /company/{id}/auto-sync/groups/ endpoint.
|
Performs a GET request against the /questions endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
CompanyAutoSyncGroups: The parsed response data.
|
Question: The parsed response data.
|
||||||
"""
|
"""
|
||||||
|
print("get")
|
||||||
return self._parse_many(
|
return self._parse_many(
|
||||||
CompanyAutoSyncGroups,
|
Question,
|
||||||
super()._make_request("GET", data=data, params=params).json().get('groups', {}),
|
super()._make_request("GET", data=data, params=params).json().get('questions', {}),
|
||||||
)
|
)
|
||||||
@ -2,29 +2,30 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CompanyManifest
|
from pyironscales.models.ironscales import Response
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CompanyIdManifestEndpoint(
|
class ResponsesCreateOrUpdateEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[CompanyManifest, IronscalesRequestParams],
|
IPostable[Response, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "manifest/", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "create-or-update", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, CompanyManifest)
|
IPostable.__init__(self, Response)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyManifest:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Response:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /company/{id}/manifest/ endpoint.
|
Performs a POST request against the /responses/create-or-update endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
CompanyManifest: The parsed Company data.
|
Survey: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(CompanyManifest, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(Response, super()._make_request("POST", data=data, params=params).json())
|
||||||
26
src/pyironscales/endpoints/ironscales/ResponsesEndpoint.py
Normal file
26
src/pyironscales/endpoints/ironscales/ResponsesEndpoint.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.ResponsesIdEndpoint import ResponsesIdEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.ResponsesSearchEndpoint import ResponsesSearchEndpoint
|
||||||
|
from pyironscales.endpoints.ironscales.ResponsesCreateOrUpdateEndpoint import ResponsesCreateOrUpdateEndpoint
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "responses", parent_endpoint=parent_endpoint)
|
||||||
|
self.search = self._register_child_endpoint(ResponsesSearchEndpoint(client, parent_endpoint=self))
|
||||||
|
self.createorupdate = self._register_child_endpoint(ResponsesCreateOrUpdateEndpoint(client, parent_endpoint=self))
|
||||||
|
|
||||||
|
def id(self, id: int) -> ResponsesIdEndpoint:
|
||||||
|
"""
|
||||||
|
Sets the ID for this endpoint and returns an initialized ResponsesIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
id (int): The ID to set.
|
||||||
|
Returns:
|
||||||
|
ResponsesIdEndpoint: The initialized ResponsesIdEndpoint object.
|
||||||
|
"""
|
||||||
|
child = ResponsesIdEndpoint(self.client, parent_endpoint=self)
|
||||||
|
child._id = id
|
||||||
|
return child
|
||||||
@ -2,36 +2,36 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CompanyLicense
|
from pyironscales.models.ironscales import Response
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PlanDetailsIdEndpoint(
|
class ResponsesIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[CompanyLicense, IronscalesRequestParams],
|
IGettable[Response, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, CompanyLicense)
|
IGettable.__init__(self, Response)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> CompanyLicense:
|
) -> Response:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /emails/{id} endpoint.
|
Performs a GET request against the /responses/{id} endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
CompanyLicense: The parsed response data.
|
AuthInformation: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
CompanyLicense,
|
Response,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -1,40 +1,37 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
from pyironscales.endpoints.ironscales.SettingsIdAccountTakeoverEndpoint import SettingsIdAccountTakeoverEndpoint
|
|
||||||
|
|
||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IPuttable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CompanyLicense
|
from pyironscales.models.ironscales import Response
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SettingsIdEndpoint(
|
class ResponsesIdUpdateEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[CompanyLicense, IronscalesRequestParams],
|
IPuttable[Response, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, CompanyLicense)
|
IPuttable.__init__(self, Response)
|
||||||
self.account_takeover = self._register_child_endpoint(SettingsIdAccountTakeoverEndpoint(client, parent_endpoint=self))
|
|
||||||
|
|
||||||
def get(
|
def put(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> CompanyLicense:
|
) -> Response:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /emails/{id} endpoint.
|
Performs a PUT request against the /responses/{id}/update endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
CompanyLicense: The parsed response data.
|
Response: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
CompanyLicense,
|
Response,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Response
|
||||||
|
from pyironscales.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesSearchEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IPostable[Response, RequestParams],
|
||||||
|
IPaginateable[Response, RequestParams],
|
||||||
|
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "search", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Response)
|
||||||
|
IPaginateable.__init__(self, Response)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: RequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[Response]:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /responses/search 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[Response]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page[number]"] = page
|
||||||
|
params["page[size]"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page[number]": page, "page[size]": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("POST", params=params),
|
||||||
|
Response,
|
||||||
|
self,
|
||||||
|
"responses",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#TODO: How do I paginate a post?
|
||||||
|
def post(self, data: JSON | None = None, params: RequestParams | None = None) -> Response:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /responses/search 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_many(Response, super()._make_request("POST", data=data, params=params).json().get('responses', {}))
|
||||||
@ -1,22 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.endpoints.ironscales.SettingsIdEndpoint import SettingsIdEndpoint
|
|
||||||
|
|
||||||
|
|
||||||
class SettingsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "settings", parent_endpoint=parent_endpoint)
|
|
||||||
|
|
||||||
def id(self, id: int) -> SettingsIdEndpoint:
|
|
||||||
"""
|
|
||||||
Sets the ID for this endpoint and returns an initialized SettingsIdEndpoint object to move down the chain.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
id (int): The ID to set.
|
|
||||||
Returns:
|
|
||||||
SettingsIdEndpoint: The initialized SettingsIdEndpoint object.
|
|
||||||
"""
|
|
||||||
child = SettingsIdEndpoint(self.client, parent_endpoint=self)
|
|
||||||
child._id = id
|
|
||||||
return child
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IPuttable,
|
|
||||||
IDeleteable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import AllowListSettings
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class SettingsIdAllowListEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[AllowListSettings, IronscalesRequestParams],
|
|
||||||
IPostable[AllowListSettings, IronscalesRequestParams],
|
|
||||||
IPuttable[AllowListSettings, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "allow-list/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, AllowListSettings)
|
|
||||||
IPuttable.__init__(self, AllowListSettings)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> AllowListSettings:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /settings/{id}/allow-list/ 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:
|
|
||||||
AllowListSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
AllowListSettings,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> AllowListSettings:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /settings/{id}/allow-list/ 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:
|
|
||||||
AllowListSettings: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(AllowListSettings, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> AllowListSettings:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /settings/{id}/allow-list/ 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:
|
|
||||||
AllowListSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
AllowListSettings,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> AllowListSettings:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /settings/{id}/allow-list/ 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:
|
|
||||||
AllowListSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(AllowListSettings, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IPuttable,
|
|
||||||
IDeleteable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import ChallengedAlerts
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class SettingsIdChallengedAlertsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[ChallengedAlerts, IronscalesRequestParams],
|
|
||||||
IPostable[ChallengedAlerts, IronscalesRequestParams],
|
|
||||||
IPuttable[ChallengedAlerts, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "challenged-alerts/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, ChallengedAlerts)
|
|
||||||
IPuttable.__init__(self, ChallengedAlerts)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> ChallengedAlerts:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /settings/{id}/challenged-alerts/ 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:
|
|
||||||
ChallengedAlerts: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
ChallengedAlerts,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> ChallengedAlerts:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /settings/{id}/challenged-alerts/ 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:
|
|
||||||
ChallengedAlerts: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(ChallengedAlerts, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> ChallengedAlerts:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /settings/{id}/challenged-alerts/ 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:
|
|
||||||
ChallengedAlerts: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
ChallengedAlerts,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> ChallengedAlerts:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /settings/{id}/challenged-alerts/ 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:
|
|
||||||
ChallengedAlerts: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(ChallengedAlerts, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|
||||||
from pyironscales.interfaces import (
|
|
||||||
IGettable,
|
|
||||||
IPostable,
|
|
||||||
IPuttable,
|
|
||||||
IDeleteable,
|
|
||||||
)
|
|
||||||
from pyironscales.models.ironscales import CompanyNotificationSettings
|
|
||||||
from pyironscales.types import (
|
|
||||||
JSON,
|
|
||||||
IronscalesRequestParams,
|
|
||||||
)
|
|
||||||
|
|
||||||
class SettingsIdChallengedAlertsEndpoint(
|
|
||||||
IronscalesEndpoint,
|
|
||||||
IGettable[CompanyNotificationSettings, IronscalesRequestParams],
|
|
||||||
IPostable[CompanyNotificationSettings, IronscalesRequestParams],
|
|
||||||
IPuttable[CompanyNotificationSettings, IronscalesRequestParams],
|
|
||||||
IDeleteable[IronscalesRequestParams],
|
|
||||||
):
|
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
|
||||||
IronscalesEndpoint.__init__(self, client, "incident-alerts/", parent_endpoint=parent_endpoint)
|
|
||||||
IGettable.__init__(self, CompanyNotificationSettings)
|
|
||||||
IPuttable.__init__(self, CompanyNotificationSettings)
|
|
||||||
|
|
||||||
def get(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyNotificationSettings:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /settings/{id}/incident-alerts/ 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:
|
|
||||||
CompanyNotificationSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyNotificationSettings,
|
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyNotificationSettings:
|
|
||||||
"""
|
|
||||||
Performs a POST request against the /settings/{id}/incident-alerts/ 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:
|
|
||||||
CompanyNotificationSettings: The parsed Company data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyNotificationSettings, super()._make_request("POST", data=data, params=params).json())
|
|
||||||
|
|
||||||
def put(
|
|
||||||
self,
|
|
||||||
data: JSON | None = None,
|
|
||||||
params: IronscalesRequestParams | None = None,
|
|
||||||
) -> CompanyNotificationSettings:
|
|
||||||
"""
|
|
||||||
Performs a PUT request against the /settings/{id}/incident-alerts/ 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:
|
|
||||||
CompanyNotificationSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(
|
|
||||||
CompanyNotificationSettings,
|
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
|
||||||
)
|
|
||||||
|
|
||||||
def delete(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyNotificationSettings:
|
|
||||||
"""
|
|
||||||
Performs a DELETE request against the /settings/{id}/incident-alerts/ 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:
|
|
||||||
CompanyNotificationSettings: The parsed response data.
|
|
||||||
"""
|
|
||||||
return self._parse_one(CompanyNotificationSettings, super()._make_request("DELETE", data=data, params=params).json())
|
|
||||||
52
src/pyironscales/endpoints/ironscales/SurveysEndpoint.py
Normal file
52
src/pyironscales/endpoints/ironscales/SurveysEndpoint.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.endpoints.ironscales.SurveysIdEndpoint import SurveysIdEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Survey
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SurveysEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IGettable[Survey, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "surveys", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, Survey)
|
||||||
|
|
||||||
|
def id(self, id: int) -> SurveysIdEndpoint:
|
||||||
|
"""
|
||||||
|
Sets the ID for this endpoint and returns an initialized SurveysIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
id (int): The ID to set.
|
||||||
|
Returns:
|
||||||
|
SurveysIdEndpoint: The initialized SurveysIdEndpoint object.
|
||||||
|
"""
|
||||||
|
child = SurveysIdEndpoint(self.client, parent_endpoint=self)
|
||||||
|
child._id = id
|
||||||
|
return child
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: RequestParams | None = None,
|
||||||
|
) -> Survey:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /surveys 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
print("get")
|
||||||
|
return self._parse_many(
|
||||||
|
Survey,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('surveys', {}),
|
||||||
|
)
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import SurveyEmail
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SurveysIdEmailEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IPostable[SurveyEmail, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "email", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, SurveyEmail)
|
||||||
|
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: RequestParams | None = None) -> SurveyEmail:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /surveys/{id}/email 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:
|
||||||
|
SurveyEmail: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(SurveyEmail, super()._make_request("POST", data=data, params=params).json())
|
||||||
10
src/pyironscales/endpoints/ironscales/SurveysIdEndpoint.py
Normal file
10
src/pyironscales/endpoints/ironscales/SurveysIdEndpoint.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.endpoints.ironscales.SurveysIdEmailEndpoint import SurveysIdEmailEndpoint
|
||||||
|
|
||||||
|
|
||||||
|
class SurveysIdEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
self.email = self._register_child_endpoint(SurveysIdEmailEndpoint(client, parent_endpoint=self))
|
||||||
44
src/pyironscales/endpoints/ironscales/TeamMembersEndpoint.py
Normal file
44
src/pyironscales/endpoints/ironscales/TeamMembersEndpoint.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.endpoints.ironscales.TeamMembersIdEndpoint import TeamMembersIdEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import TeamMember
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TeamMembersEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IPostable[TeamMember, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "team-members", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, TeamMember)
|
||||||
|
|
||||||
|
def id(self, id: int) -> TeamMembersIdEndpoint:
|
||||||
|
"""
|
||||||
|
Sets the ID for this endpoint and returns an initialized TeamMembersIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
id (int): The ID to set.
|
||||||
|
Returns:
|
||||||
|
TeamMembersIdEndpoint: The initialized TeamMembersIdEndpoint object.
|
||||||
|
"""
|
||||||
|
child = TeamMembersIdEndpoint(self.client, parent_endpoint=self)
|
||||||
|
child._id = id
|
||||||
|
return child
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: RequestParams | None = None) -> TeamMember:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /team-members 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:
|
||||||
|
TeamMember: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(TeamMember, super()._make_request("POST", data=data, params=params).json())
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import TeamMember
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TeamMembersIdEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IGettable[TeamMember, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, TeamMember)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: RequestParams | None = None,
|
||||||
|
) -> TeamMember:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /team-members/{id} 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:
|
||||||
|
AuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
TeamMember,
|
||||||
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
|
)
|
||||||
59
src/pyironscales/endpoints/simplesat/AnswersIdEndpoint.py
Normal file
59
src/pyironscales/endpoints/simplesat/AnswersIdEndpoint.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPuttable
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Answer
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AnswersIdEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IGettable[Answer, IronscalesRequestParams],
|
||||||
|
IPuttable[Answer, IronscalesRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, Answer)
|
||||||
|
IPuttable.__init__(self, Answer)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Answer:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /answers/{id} 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:
|
||||||
|
AuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Answer,
|
||||||
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
|
)
|
||||||
|
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Answer:
|
||||||
|
"""
|
||||||
|
Performs a PUT request against the /answers/{id} 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:
|
||||||
|
Answer: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Answer,
|
||||||
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
|
)
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Answer
|
||||||
|
from pyironscales.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AnswersSearchEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[Answer, IronscalesRequestParams],
|
||||||
|
IPaginateable[Answer, IronscalesRequestParams],
|
||||||
|
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "search", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Answer)
|
||||||
|
IPaginateable.__init__(self, Answer)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[Answer]:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /answers/search 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[Answer]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page[number]"] = page
|
||||||
|
params["page[size]"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page[number]": page, "page[size]": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("POST", params=params),
|
||||||
|
Answer,
|
||||||
|
self,
|
||||||
|
"answers",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Answer:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /answers/search 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_many(Answer, super()._make_request("POST", data=data, params=params).json().get('answers', {}))
|
||||||
@ -2,29 +2,30 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import PartnerCompany
|
from pyironscales.models.ironscales import CustomerBulk
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CompanyCreateEndpoint(
|
class CustomersBulkEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[PartnerCompany, IronscalesRequestParams],
|
IPostable[CustomerBulk, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "create", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "bulk", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, PartnerCompany)
|
IPostable.__init__(self, CustomerBulk)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> PartnerCompany:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CustomerBulk:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /company/create endpoint.
|
Performs a POST request against the /customers/bulk endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
Survey: The parsed Company data.
|
Survey: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(PartnerCompany, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(CustomerBulk, super()._make_request("POST", data=data, params=params).json())
|
||||||
59
src/pyironscales/endpoints/simplesat/CustomersIdEndpoint.py
Normal file
59
src/pyironscales/endpoints/simplesat/CustomersIdEndpoint.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPuttable
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Customer
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CustomersIdEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IGettable[Customer, IronscalesRequestParams],
|
||||||
|
IPuttable[Customer, IronscalesRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, Customer)
|
||||||
|
IPuttable.__init__(self, Customer)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Customer:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /customers/{id} 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:
|
||||||
|
AuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Customer,
|
||||||
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
|
)
|
||||||
|
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> Customer:
|
||||||
|
"""
|
||||||
|
Performs a PUT request against the /customers/{id} 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:
|
||||||
|
Customer: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Customer,
|
||||||
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
|
)
|
||||||
@ -2,36 +2,37 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import UnclassifiedIncidentIDs
|
from pyironscales.models.ironscales import Question
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdStatusEndpoint(
|
class QuestionsEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[UnclassifiedIncidentIDs, IronscalesRequestParams],
|
IGettable[Question, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}/", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "questions", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, UnclassifiedIncidentIDs)
|
IGettable.__init__(self, Question)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> UnclassifiedIncidentIDs:
|
) -> Question:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /incident/{id}/{status}/ endpoint.
|
Performs a GET request against the /questions endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
UnclassifiedIncidentIDs: The parsed response data.
|
Question: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
print("get")
|
||||||
UnclassifiedIncidentIDs,
|
return self._parse_many(
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
Question,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('questions', {}),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Response
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesCreateOrUpdateEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[Response, IronscalesRequestParams],
|
||||||
|
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "create-or-update", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Response)
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Response:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /responses/create-or-update 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(Response, super()._make_request("POST", data=data, params=params).json())
|
||||||
37
src/pyironscales/endpoints/simplesat/ResponsesIdEndpoint.py
Normal file
37
src/pyironscales/endpoints/simplesat/ResponsesIdEndpoint.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Response
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesIdEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IGettable[Response, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, Response)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: RequestParams | None = None,
|
||||||
|
) -> Response:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /responses/{id} 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:
|
||||||
|
AuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Response,
|
||||||
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
|
)
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import Endpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPuttable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Response
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
RequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesIdUpdateEndpoint(
|
||||||
|
Endpoint,
|
||||||
|
IPuttable[Response, RequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
Endpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IPuttable.__init__(self, Response)
|
||||||
|
|
||||||
|
def put(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: RequestParams | None = None,
|
||||||
|
) -> Response:
|
||||||
|
"""
|
||||||
|
Performs a PUT request against the /responses/{id}/update 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:
|
||||||
|
Response: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
Response,
|
||||||
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import Response
|
||||||
|
from pyironscales.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ResponsesSearchEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[Response, IronscalesRequestParams],
|
||||||
|
IPaginateable[Response, IronscalesRequestParams],
|
||||||
|
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "search", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, Response)
|
||||||
|
IPaginateable.__init__(self, Response)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: IronscalesRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[Response]:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /responses/search 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[Response]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page[number]"] = page
|
||||||
|
params["page[size]"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page[number]": page, "page[size]": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("POST", params=params),
|
||||||
|
Response,
|
||||||
|
self,
|
||||||
|
"responses",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#TODO: How do I paginate a post?
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Response:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /responses/search 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:
|
||||||
|
Survey: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_many(Response, super()._make_request("POST", data=data, params=params).json().get('responses', {}))
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
||||||
|
from pyironscales.interfaces import (
|
||||||
|
IPostable,
|
||||||
|
)
|
||||||
|
from pyironscales.models.ironscales import SurveyEmail
|
||||||
|
from pyironscales.types import (
|
||||||
|
JSON,
|
||||||
|
IronscalesRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SurveysIdEmailEndpoint(
|
||||||
|
IronscalesEndpoint,
|
||||||
|
IPostable[SurveyEmail, IronscalesRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
IronscalesEndpoint.__init__(self, client, "email", parent_endpoint=parent_endpoint)
|
||||||
|
IPostable.__init__(self, SurveyEmail)
|
||||||
|
|
||||||
|
|
||||||
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> SurveyEmail:
|
||||||
|
"""
|
||||||
|
Performs a POST request against the /surveys/{id}/email 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:
|
||||||
|
SurveyEmail: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(SurveyEmail, super()._make_request("POST", data=data, params=params).json())
|
||||||
@ -2,36 +2,36 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import IncidentDetails
|
from pyironscales.models.ironscales import TeamMember
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncidentIdDetailsIdEndpoint(
|
class TeamMembersIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[IncidentDetails, IronscalesRequestParams],
|
IGettable[TeamMember, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, IncidentDetails)
|
IGettable.__init__(self, TeamMember)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> IncidentDetails:
|
) -> TeamMember:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /incident/{id}/details/{id} endpoint.
|
Performs a GET request against the /team-members/{id} endpoint.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
data (dict[str, Any]): The data to send in the request body.
|
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.
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
Returns:
|
Returns:
|
||||||
IncidentDetails: The parsed response data.
|
AuthInformation: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
IncidentDetails,
|
TeamMember,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -16,429 +16,61 @@ class Pagination(IronscalesModel):
|
|||||||
next_page_url: str | None = Field(default=None, alias="NextPageURL")
|
next_page_url: str | None = Field(default=None, alias="NextPageURL")
|
||||||
next_page_token: str | None = Field(default=None, alias="NextPageToken")
|
next_page_token: str | None = Field(default=None, alias="NextPageToken")
|
||||||
|
|
||||||
class Campaigns(IronscalesModel):
|
class Answer(IronscalesModel):
|
||||||
campaignID: int | None = Field(default=None, alias="CampaignId")
|
id: int | None = Field(default=None, alias="Id")
|
||||||
campaignName: str | None = Field(default=None, alias="CampaignName")
|
created: datetime | None = Field(default=None, alias="Created")
|
||||||
campaignStatus: str | None = Field(default=None, alias="CampaignStatus")
|
modified: datetime | None = Field(default=None, alias="Modified")
|
||||||
flowType: str | None = Field(default=None, alias="FlowType")
|
question: dict[str, Any] | None = Field(default=None, alias="Question")
|
||||||
language: str | None = Field(default=None, alias="Language")
|
choice: str | None = Field(default=None, alias="Choice")
|
||||||
maxEmailPerDay: int | None = Field(default=None, alias="MaxEmailPerDay")
|
choice_label: str | None = Field(default=None, alias="ChoiceLabel")
|
||||||
endDate: datetime | None = Field(default=None, alias="Modified")
|
choices: list | None = Field(default=None, alias="Choices")
|
||||||
launchDate: datetime | None = Field(default=None, alias="Modified")
|
sentiment: str | None = Field(default=None, alias="Sentiment")
|
||||||
emailsSent: int | None = Field(default=None, alias="EmailsSent")
|
comment: str | None = Field(default=None, alias="Comment")
|
||||||
participants: int | None = Field(default=None, alias="Participants")
|
follow_up_answer: str | None = Field(default=None, alias="FollowUpAnswer")
|
||||||
emailsBounced: int | None = Field(default=None, alias="EmailsBounced")
|
follow_up_answer_choice: str | None = Field(default=None, alias="FollowUpAnswerChoice")
|
||||||
numberOfClickedParticipants: int | None = Field(default=None, alias="NumberOfClickedParticipants")
|
follow_up_answer_choices: list | None = Field(default=None, alias="FollowUpAnswerChoices")
|
||||||
numberOfTrainedParticipants: int | None = Field(default=None, alias="NumberOfTrainedParticipants")
|
survey: dict[str, str | int] | None = Field(default=None, alias="Survey")
|
||||||
numberOfTrainedParticipatns: int | None = Field(default=None, alias="NumberOfTrainedParticipatns") #Seems ironscales had a type and for some reason continued to include it alongside the fixed string
|
published_as_testimonial: bool | None = Field(default=None, alias="PublishedAsTestimonial")
|
||||||
numberOfReportedParticipants: int | None = Field(default=None, alias="NumberOfReportedParticipants")
|
response_id: int | None = Field(default=None, alias="ResponseId")
|
||||||
numberOfReadParticipants: int | None = Field(default=None, alias="NumberOfReadParticipants")
|
|
||||||
numberOfDeleted: int | None = Field(default=None, alias="NumberOfDeleted")
|
|
||||||
attackReadinessFirstReport: str | None = Field(default=None, alias="AttackReadinessFirstReport")
|
|
||||||
attackReadinessMitigationTime: str | None = Field(default=None, alias="AttackReadinessMitigationTime")
|
|
||||||
attackReadinessLuredBeforeMitigation: str | None = Field(default=None, alias="AttackReadinessLuredBeforeMitigation")
|
|
||||||
attackReadinessReportsToMitigate: str | None = Field(default=None, alias="AttackReadinessReportsToMitigate")
|
|
||||||
companyId: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
randomized: bool | None = Field(default=None, alias="Randomized")
|
|
||||||
|
|
||||||
class CampaignParticipants(IronscalesModel):
|
class Customer(IronscalesModel):
|
||||||
internalID: int | None = Field(default=None, alias="InternalID")
|
id: int | None = Field(default=None, alias="Id")
|
||||||
|
external_id: str | None = Field(default=None, alias="ExternalId")
|
||||||
|
created: datetime | None = Field(default=None, alias="Created")
|
||||||
|
modified: datetime | None = Field(default=None, alias="Modified")
|
||||||
name: str | None = Field(default=None, alias="Name")
|
name: str | None = Field(default=None, alias="Name")
|
||||||
displayName: str | None = Field(default=None, alias="DisplayName")
|
email: str | None = Field(default=None, alias="Email")
|
||||||
lastUpdate: datetime | None = Field(default=None, alias="LastUpdate")
|
|
||||||
title: str | None = Field(default=None, alias="Title")
|
|
||||||
department: str | None = Field(default=None, alias="Department")
|
|
||||||
company: str | None = Field(default=None, alias="Company")
|
company: str | None = Field(default=None, alias="Company")
|
||||||
manager: str | None = Field(default=None, alias="Manager")
|
custom_attributes: dict[str, str | int] | None = Field(default=None, alias="CustomAttributes")
|
||||||
office: str | None = Field(default=None, alias="Office")
|
|
||||||
country: str | None = Field(default=None, alias="Country")
|
|
||||||
city: str | None = Field(default=None, alias="City")
|
|
||||||
sentAt: datetime | None = Field(default=None, alias="SentAt")
|
|
||||||
opened: str | None = Field(default=None, alias="Opened")
|
|
||||||
openedAt: datetime | None = Field(default=None, alias="OpenedAt")
|
|
||||||
enteredDetails: str | None = Field(default=None, alias="EnteredDetails")
|
|
||||||
trainingModule: str | None = Field(default=None, alias="TrainingModule")
|
|
||||||
trainingVideoStarted: str | None = Field(default=None, alias="TrainingVideoStarted")
|
|
||||||
awarenessLevel: str | None = Field(default=None, alias="AwarenessLevel")
|
|
||||||
customTags: str | None = Field(default=None, alias="CustomTags")
|
|
||||||
reported: str | None = Field(default=None, alias="Reported")
|
|
||||||
reportedTime: datetime | None = Field(default=None, alias="ReportedTime")
|
|
||||||
read: str | None = Field(default=None, alias="Read")
|
|
||||||
clicked: str | None = Field(default=None, alias="Clicked")
|
|
||||||
clickedTime: datetime | None = Field(default=None, alias="ClickedTime")
|
|
||||||
resendTrainingDates: list[datetime] | None = Field(default=None, alias="ResendTrainingDates")
|
|
||||||
deleted: str | None = Field(default=None, alias="Deleted")
|
|
||||||
trained: str | None = Field(default=None, alias="Trained")
|
|
||||||
trainingCompletionDate: datetime | None = Field(default=None, alias="TrainingCompletionDate")
|
|
||||||
trainingScore: int | None = Field(default=None, alias="TrainingScore")
|
|
||||||
trainingDuration: int | None = Field(default=None, alias="TrainingDuration")
|
|
||||||
trainingStartedOn: datetime | None = Field(default=None, alias="TrainingStartedOn")
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
template: str | None = Field(default=None, alias="Template")
|
|
||||||
userIp: str | None = Field(default=None, alias="UserIp")
|
|
||||||
|
|
||||||
class PartnerCompany(IronscalesModel):
|
class TeamMember(IronscalesModel):
|
||||||
|
id: int | None = Field(default=None, alias="Id")
|
||||||
|
external_id: str | None = Field(default=None, alias="ExternalId")
|
||||||
|
created: datetime | None = Field(default=None, alias="Created")
|
||||||
|
modified: datetime | None = Field(default=None, alias="Modified")
|
||||||
|
name: str | None = Field(default=None, alias="Name")
|
||||||
|
email: str | None = Field(default=None, alias="Email")
|
||||||
|
custom_attributes: dict[str, str | int] | None = Field(default=None, alias="CustomAttributes")
|
||||||
|
|
||||||
|
class Response(IronscalesModel):
|
||||||
|
survey_id: int | None = Field(default=None, alias="SurveyId")
|
||||||
|
tags: list | None = Field(default=None, alias="Tags")
|
||||||
|
answers: list[dict[str, Any]] | None = Field(default=None, alias="Answers")
|
||||||
|
team_members: list[dict[str, Any]] | None = Field(default=None, alias="TeamMembers")
|
||||||
|
ticket: dict[str, Any] | None = Field(default=None, alias="Ticket")
|
||||||
|
customer: dict[str, Any] | None = Field(default=None, alias="Customer")
|
||||||
|
|
||||||
|
class Survey(IronscalesModel):
|
||||||
id: int | None = Field(default=None, alias="Id")
|
id: int | None = Field(default=None, alias="Id")
|
||||||
name: str | None = Field(default=None, alias="Name")
|
name: str | None = Field(default=None, alias="Name")
|
||||||
domain: str | None = Field(default=None, alias="Domain")
|
metric: str | None = Field(default=None, alias="Metric")
|
||||||
ownerEmail: str | None = Field(default=None, alias="OwnerEmail")
|
survey_token: str | None = Field(default=None, alias="SurveyToken")
|
||||||
ownerName: str | None = Field(default=None, alias="OwnerName")
|
survey_type: str | None = Field(default=None, alias="SurveyType")
|
||||||
country: str | None = Field(default=None, alias="Country")
|
brand_name: str | None = Field(default=None, alias="BrandName")
|
||||||
registrationDate: datetime | None = Field(default=None, alias="RegistrationDate")
|
|
||||||
partner_id: int | None = Field(default=None, alias="PartnerID")
|
|
||||||
|
|
||||||
class PartnerCompanyV2(IronscalesModel):
|
class CustomerBulk(IronscalesModel):
|
||||||
id: int | None = Field(default=None, alias="Id")
|
request_id: str | None = Field(default=None, alias="RequestId")
|
||||||
name: str | None = Field(default=None, alias="Name")
|
detail: str | None = Field(default=None, alias="Detail")
|
||||||
domain: str | None = Field(default=None, alias="Domain")
|
|
||||||
ownerEmail: str | None = Field(default=None, alias="OwnerEmail")
|
|
||||||
ownerName: str | None = Field(default=None, alias="OwnerName")
|
|
||||||
country: str | None = Field(default=None, alias="Country")
|
|
||||||
registrationDate: datetime | None = Field(default=None, alias="RegistrationDate")
|
|
||||||
partner_id: int | None = Field(default=None, alias="PartnerID")
|
|
||||||
planExpirationDate: datetime | None = Field(default=None, alias="PlanExpirationDate")
|
|
||||||
trialPlanExpirationDate: datetime | None = Field(default=None, alias="TrialPlanExpirationDate")
|
|
||||||
|
|
||||||
class CompanyAutoSyncStatus(IronscalesModel):
|
class SurveyEmail(IronscalesModel):
|
||||||
in_progress: bool | None = Field(default=None, alias="InProgress")
|
detail: str | None = Field(default=None, alias="Detail")
|
||||||
mailboxes_total_count: int | None = Field(default=None, alias="MailboxesTotalCount")
|
|
||||||
protected_mailboxes_count: int | None = Field(default=None, alias="ProtectedMailboxesCount")
|
|
||||||
enabled_mailboxes_count: int | None = Field(default=None, alias="EnabledMailboxesCount")
|
|
||||||
synced_mailboxes_count: int | None = Field(default=None, alias="SyncedMailboxesCount")
|
|
||||||
failed_mailboxes_count: int | None = Field(default=None, alias="FailedMailboxesCount")
|
|
||||||
last_synced_at: datetime | None = Field(default=None, alias="LastSyncedAt")
|
|
||||||
|
|
||||||
class Company911Email(IronscalesModel):
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
|
|
||||||
class CompanyAutoSyncGroups(IronscalesModel):
|
|
||||||
id: str | None = Field(default=None, alias="Id")
|
|
||||||
display_name: str | None = Field(default=None, alias="DisplayName")
|
|
||||||
|
|
||||||
class CompanyManifest(IronscalesModel):
|
|
||||||
report_button: str | None = Field(default=None, alias="ReportButton")
|
|
||||||
add_in_description: str | None = Field(default=None, alias="AddInDescription")
|
|
||||||
report_phishing_caption: str | None = Field(default=None, alias="ReportPhishingCaption")
|
|
||||||
provider_name: str | None = Field(default=None, alias="ProviderName")
|
|
||||||
logo: str | None = Field(default=None, alias="Logo")
|
|
||||||
|
|
||||||
class CompanySyncedEmails(IronscalesModel):
|
|
||||||
first_name: str | None = Field(default=None, alias="FirstName")
|
|
||||||
last_name: str | None = Field(default=None, alias="LastName")
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
change_date: datetime | None = Field(default=None, alias="ChangeDate")
|
|
||||||
|
|
||||||
class CompanyFeaturesStates(IronscalesModel):
|
|
||||||
silentMode: bool | None = Field(default=None, alias="SilentMode")
|
|
||||||
silentModeMsg: bool | None = Field(default=None, alias="SilentModeMsg")
|
|
||||||
ato: bool | None = Field(default=None, alias="ATO")
|
|
||||||
serviceManagement: bool | None = Field(default=None, alias="ServiceManagement")
|
|
||||||
trainingCampaignsWizer: bool | None = Field(default=None, alias="TrainingCampaignsWizer")
|
|
||||||
api: bool | None = Field(default=None, alias="API")
|
|
||||||
themisCoPilot: bool | None = Field(default=None, alias="ThemisCoPilot")
|
|
||||||
attachmentsScan: bool | None = Field(default=None, alias="AttachmentsScan")
|
|
||||||
linksScan: bool | None = Field(default=None, alias="LinksScan")
|
|
||||||
STbundle: bool | None = Field(default=None, alias="STBundle")
|
|
||||||
SATBundlePlus: bool | None = Field(default=None, alias="SATBundlePlus")
|
|
||||||
AiEmpowerBundle: bool | None = Field(default=None, alias="AiEmpowerBundle")
|
|
||||||
autopilotEnabled: bool | None = Field(default=None, alias="AutopilotEnabled")
|
|
||||||
|
|
||||||
class CompanyStatisticsAndLicense(IronscalesModel):
|
|
||||||
openIncidentCount: int | None = Field(default=None, alias="OpenIncidentCount")
|
|
||||||
highPriorityIncidentCount: int | None = Field(default=None, alias="highPriorityIncidentCount")
|
|
||||||
mediumPriorityIncidentCount: int | None = Field(default=None, alias="mediumPriorityIncidentCount")
|
|
||||||
lowPriorityIncidentCount: int | None = Field(default=None, alias="lowPriorityIncidentCount")
|
|
||||||
activeAttacksCount: int | None = Field(default=None, alias="activeAttacksCount")
|
|
||||||
license: dict[str, Any] | None = Field(default=None, alias="license")
|
|
||||||
protectedMailboxes: bool | None = Field(default=None, alias="protectedMailboxes")
|
|
||||||
activeMailboxes: bool | None = Field(default=None, alias="activeMailboxes")
|
|
||||||
lastMailboxSyncDate: datetime | None = Field(default=None, alias="lastMailboxSyncDate")
|
|
||||||
|
|
||||||
class EscalatedEmails(IronscalesModel):
|
|
||||||
arrival_date: datetime | None = Field(default=None, alias="ArrivalDate")
|
|
||||||
incident_id: int | None = Field(default=None, alias="IncidentId")
|
|
||||||
subject: str | None = Field(default=None, alias="Subject")
|
|
||||||
sender_email: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
recipient_name: str | None = Field(default=None, alias="RecipientName")
|
|
||||||
recipient_email: str | None = Field(default=None, alias="RecipientEmail")
|
|
||||||
primary_threat_type: str | None = Field(default=None, alias="PrimaryThreatType")
|
|
||||||
is_scanback: bool | None = Field(default=None, alias="IsScanback")
|
|
||||||
classification: str | None = Field(default=None, alias="Classification")
|
|
||||||
incident_state: str | None = Field(default=None, alias="IncidentState")
|
|
||||||
resolution: str | None = Field(default=None, alias="Resolution")
|
|
||||||
sender_ip: str | None = Field(default=None, alias="SenderIp")
|
|
||||||
reported_by: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
mailbox_id: int | None = Field(default=None, alias="MailboxId")
|
|
||||||
department: str | None = Field(default=None, alias="Department")
|
|
||||||
remediated_time: datetime | None = Field(default=None, alias="RemediatedTime")
|
|
||||||
mitigation_id: int | None = Field(default=None, alias="MitigationId")
|
|
||||||
|
|
||||||
class IncidentDetails(IronscalesModel):
|
|
||||||
company_id: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
company_name: str | None = Field(default=None, alias="CompanyName")
|
|
||||||
incident_id: int | None = Field(default=None, alias="IncidentId")
|
|
||||||
classification: str | None = Field(default=None, alias="Classification")
|
|
||||||
first_reported_by: str | None = Field(default=None, alias="FirstReportedBy")
|
|
||||||
first_reported_date: datetime | None = Field(default=None, alias="FirstReportedDate")
|
|
||||||
affected_mailbox_count: int | None = Field(default=None, alias="AffectedMailboxCount")
|
|
||||||
sender_reputation: str | None = Field(default=None, alias="SenderReputation")
|
|
||||||
banner_displayed: bool | None = Field(default=None, alias="BannerDisplayed")
|
|
||||||
sender_email: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
reply_to: str | None = Field(default=None, alias="ReplyTo")
|
|
||||||
spf_result: str | None = Field(default=None, alias="SPFResult")
|
|
||||||
sender_is_internal: bool | None = Field(default=None, alias="SenderIsInternal")
|
|
||||||
themis_proba: float | None = Field(default=None, alias="ThemisProba")
|
|
||||||
themis_verdict: str | None = Field(default=None, alias="ThemisVerdict")
|
|
||||||
mail_server: dict[str, str] | None = Field(default=None, alias="MailServer")
|
|
||||||
federation: dict[str, int | float] | None = Field(default=None, alias="Federation")
|
|
||||||
reports: dict[str, str | dict[str, str]] | None = Field(default=None, alias="Reports")
|
|
||||||
links: dict[str, str] | None = Field(default=None, alias="Links")
|
|
||||||
attachments: dict[str, str | int] | None = Field(default=None, alias="Attachments")
|
|
||||||
original_email_body: str | None = Field(default=None, alias="OriginalEmailBody")
|
|
||||||
email_body_text: str | None = Field(default=None, alias="EmailBodyText")
|
|
||||||
reported_by_end_user: bool | None = Field(default=None, alias="ReportedByEndUser")
|
|
||||||
reporter_name: str | None = Field(default=None, alias="ReporterName")
|
|
||||||
|
|
||||||
class Incidents(IronscalesModel):
|
|
||||||
incidentID: int | None = Field(default=None, alias="ArrivalDate")
|
|
||||||
emailSubject: str | None = Field(default=None, alias="EmailSubject")
|
|
||||||
linksCount: int | None = Field(default=None, alias="LinksCount")
|
|
||||||
attachmentsCount: int | None = Field(default=None, alias="AttachmentsCount")
|
|
||||||
recipientEmail: str | None = Field(default=None, alias="RecipientEmail")
|
|
||||||
recipientName: str | None = Field(default=None, alias="RecipientName")
|
|
||||||
classification: str | None = Field(default=None, alias="Classification")
|
|
||||||
assignee: str | None = Field(default=None, alias="Assignee")
|
|
||||||
senderName: str | None = Field(default=None, alias="SenderName")
|
|
||||||
senderEmail: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
affectedMailboxesCount: int | None = Field(default=None, alias="AffectedMailboxesCount")
|
|
||||||
created: str | None = Field(default=None, alias="Created")
|
|
||||||
reportedBy: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
resolvedBy: str | None = Field(default=None, alias="ResolvedBy")
|
|
||||||
incidentType: str | None = Field(default=None, alias="IncidentsType")
|
|
||||||
commentsCount: int | None = Field(default=None, alias="CommentsCount")
|
|
||||||
releaseRequestCount: int | None = Field(default=None, alias="ReleaseRequestCount")
|
|
||||||
latestEmailDate: datetime | None = Field(default=None, alias="LatestEmailDate")
|
|
||||||
|
|
||||||
class IncidentClassify(IronscalesModel):
|
|
||||||
classification: int | None = Field(default=None, alias="Classification")
|
|
||||||
prev_classification: str | None = Field(default=None, alias="PrevClassification")
|
|
||||||
classifying_user_email: int | None = Field(default=None, alias="ClassifyingUserEmail")
|
|
||||||
|
|
||||||
class ScanbackIncidents(IronscalesModel):
|
|
||||||
incidentID: int | None = Field(default=None, alias="ArrivalDate")
|
|
||||||
emailSubject: str | None = Field(default=None, alias="EmailSubject")
|
|
||||||
linksCount: int | None = Field(default=None, alias="LinksCount")
|
|
||||||
attachmentsCount: int | None = Field(default=None, alias="AttachmentsCount")
|
|
||||||
recipientEmail: str | None = Field(default=None, alias="RecipientEmail")
|
|
||||||
recipientName: str | None = Field(default=None, alias="RecipientName")
|
|
||||||
classification: str | None = Field(default=None, alias="Classification")
|
|
||||||
assignee: str | None = Field(default=None, alias="Assignee")
|
|
||||||
senderName: str | None = Field(default=None, alias="SenderName")
|
|
||||||
senderEmail: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
affectedMailboxesCount: int | None = Field(default=None, alias="AffectedMailboxesCount")
|
|
||||||
created: str | None = Field(default=None, alias="Created")
|
|
||||||
reportedBy: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
resolvedBy: str | None = Field(default=None, alias="ResolvedBy")
|
|
||||||
|
|
||||||
class RemediationStatusesStats(IronscalesModel):
|
|
||||||
phishing: dict[str, int] | None = Field(default=None, alias="Phishing")
|
|
||||||
spam: dict[str, int] | None = Field(default=None, alias="Spam")
|
|
||||||
safe: dict[str, int] | None = Field(default=None, alias="Safe")
|
|
||||||
unclassified: dict[str, int] | None = Field(default=None, alias="Unclassified")
|
|
||||||
|
|
||||||
class UnclassifiedIncidentIDs(IronscalesModel):
|
|
||||||
incident_ids: list[int] | None = Field(default=None, alias="IncidentIds")
|
|
||||||
|
|
||||||
class IntegrationStatus(IronscalesModel):
|
|
||||||
company_id: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
integration_type: str | None = Field(default=None, alias="IntegrationType")
|
|
||||||
is_integrated: bool | None = Field(default=None, alias="IsIntegrated")
|
|
||||||
|
|
||||||
class IntegrationO365Authorize(IronscalesModel):
|
|
||||||
admin_consent: bool | None = Field(default=None, alias="AdminConsent")
|
|
||||||
state: str | None = Field(default=None, alias="State")
|
|
||||||
tenant: str | None = Field(default=None, alias="Tenant")
|
|
||||||
error: str | None = Field(default=None, alias="Error")
|
|
||||||
error_description: str | None = Field(default=None, alias="ErrorDescription")
|
|
||||||
|
|
||||||
class IntegrationO365AuthorizeResponse(IronscalesModel):
|
|
||||||
additional_data: Any | None = Field(default=None, alias="AdditionalData")
|
|
||||||
|
|
||||||
class IntegrationGWSAuthorizeResponse(IronscalesModel):
|
|
||||||
error_message: Any | None = Field(default=None, alias="AdditionalData")
|
|
||||||
|
|
||||||
class IntegrationDisableIntegration(IronscalesModel):
|
|
||||||
company_id: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
integration_type: str | None = Field(default=None, alias="IntegrationType")
|
|
||||||
integration_status: str | None = Field(default=None, alias="IntegrationStatus")
|
|
||||||
|
|
||||||
class IntegrationsGWSConsentRedirectURL(IronscalesModel):
|
|
||||||
oauth_full_url: str | None = Field(default=None, alias="OAuthFullUrl")
|
|
||||||
|
|
||||||
class IntegrationsO365ConsentRedirectURL(IronscalesModel):
|
|
||||||
azure_redirect_uri: str | None = Field(default=None, alias="AzureRedirectURI")
|
|
||||||
additional_data: Any | None = Field(default=None, alias="AdditionalData")
|
|
||||||
|
|
||||||
class IntegrationsO365ConsentRedirectURLResponse(IronscalesModel):
|
|
||||||
oauth_full_url: str | None = Field(default=None, alias="OAuthFullUrl")
|
|
||||||
|
|
||||||
class ComplianceReport(IronscalesModel):
|
|
||||||
id: int | None = Field(default=None, alias="Id")
|
|
||||||
firstName: str | None = Field(default=None, alias="FirstName")
|
|
||||||
lastName: str | None = Field(default=None, alias="LastName")
|
|
||||||
country: str | None = Field(default=None, alias="Country")
|
|
||||||
department: str | None = Field(default=None, alias="Department")
|
|
||||||
title: str | None = Field(default=None, alias="Title")
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
language: str | None = Field(default=None, alias="Language")
|
|
||||||
simulationCampaignsCompletionsCount: int | None = Field(default=None, alias="SimulationCampaignsCompletionsCount")
|
|
||||||
lastSimulationCampaignDate: datetime | None = Field(default=None, alias="LastSimulationCampaignDate")
|
|
||||||
trainingCampaignsCompletionsCount: int | None = Field(default=None, alias="TrainingCampaignsCompletionCount")
|
|
||||||
lastTrainingCampaignDate: datetime | None = Field(default=None, alias="LastTrainingCampaignDate")
|
|
||||||
riskLevel: str | None = Field(default=None, alias="RiskLevel")
|
|
||||||
awarenessLevel: str | None = Field(default=None, alias="AwarenessLevel")
|
|
||||||
|
|
||||||
class CompanyMailboxes(IronscalesModel):
|
|
||||||
id: int | None = Field(default=None, alias="Id")
|
|
||||||
firstName: str | None = Field(default=None, alias="FirstName")
|
|
||||||
lastName: str | None = Field(default=None, alias="LastName")
|
|
||||||
title: str | None = Field(default=None, alias="Title")
|
|
||||||
department: str | None = Field(default=None, alias="Department")
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
phoneNumber: str | None = Field(default=None, alias="PhoneNumber")
|
|
||||||
tags: list[str] | None = Field(default=None, alias="Tags")
|
|
||||||
language: str | None = Field(default=None, alias="Language")
|
|
||||||
enabled: bool | None = Field(default=None, alias="Enabled")
|
|
||||||
riskLevel: str | None = Field(default=None, alias="RiskLevel")
|
|
||||||
awarenessLevel: str | None = Field(default=None, alias="AwarenessLevel")
|
|
||||||
protected: bool | None = Field(default=None, alias="Protected")
|
|
||||||
unprotectedReason: str | None = Field(default=None, alias="UnprotectedReason")
|
|
||||||
|
|
||||||
class CompanyMailboxesPutResponse(IronscalesModel):
|
|
||||||
mailbox_ids: list[int] | None = Field(default=None, alias="MailboxIds")
|
|
||||||
error_message: str | None = Field(default=None, alias="ErrorMessage")
|
|
||||||
|
|
||||||
class UserCampaignPerformance(IronscalesModel):
|
|
||||||
id: int | None = Field(default=None, alias="Id")
|
|
||||||
userId: int | None = Field(default=None, alias="UserId")
|
|
||||||
firstName: str | None = Field(default=None, alias="FirstName")
|
|
||||||
lastName: str | None = Field(default=None, alias="LastName")
|
|
||||||
country: str | None = Field(default=None, alias="Country")
|
|
||||||
department: str | None = Field(default=None, alias="Department")
|
|
||||||
title: str | None = Field(default=None, alias="Title")
|
|
||||||
email: str | None = Field(default=None, alias="Email")
|
|
||||||
campaignId: int | None = Field(default=None, alias="CampaignId")
|
|
||||||
campaignName: str | None = Field(default=None, alias="CampaignName")
|
|
||||||
campaignType: str | None = Field(default=None, alias="CampaignType")
|
|
||||||
campaignSimulationResult: str | None = Field(default=None, alias="CampaignSimulationResult")
|
|
||||||
campaignTrainingStatus: str | None = Field(default=None, alias="CampaignTrainingStatus")
|
|
||||||
campaignTrainingName: str | None = Field(default=None, alias="CampaignTrainingName")
|
|
||||||
campaignCollectingEndDate: datetime | None = Field(default=None, alias="CampaignCollectingEndDate")
|
|
||||||
campaignScore: int | None = Field(default=None, alias="CampaignScore")
|
|
||||||
campaignLocale: str | None = Field(default=None, alias="CampaignLocale")
|
|
||||||
campaignTemplateName: str | None = Field(default=None, alias="CampaignTemplateName")
|
|
||||||
|
|
||||||
class CompanyImpersonationIncidents(IronscalesModel):
|
|
||||||
incidentID: int | None = Field(default=None, alias="IncidentId")
|
|
||||||
mailboxId: int | None = Field(default=None, alias="MailboxId")
|
|
||||||
remediatedTime: datetime | None = Field(default=None, alias="RemediatedTime")
|
|
||||||
mailboxEmail: str | None = Field(default=None, alias="MailboxEmail")
|
|
||||||
senderEmail: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
subject: str | None = Field(default=None, alias="Subject")
|
|
||||||
reportedBy: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
incidentType: str | None = Field(default=None, alias="IncidentType")
|
|
||||||
resolution: str | None = Field(default=None, alias="Resolution")
|
|
||||||
remediations: int | None = Field(default=None, alias="Remediations")
|
|
||||||
|
|
||||||
class CompanyMitigationDetails(IronscalesModel):
|
|
||||||
incidentID: int | None = Field(default=None, alias="IncidentId")
|
|
||||||
incidentState: int | None = Field(default=None, alias="IncidentState")
|
|
||||||
remediatedTime: datetime | None = Field(default=None, alias="RemediatedTime")
|
|
||||||
affectedMailboxCount: int | None = Field(default=None, alias="AffectedMailboxCount")
|
|
||||||
mailboxId: str | None = Field(default=None, alias="MailboxId")
|
|
||||||
mailboxEmail: str | None = Field(default=None, alias="MailboxEmail")
|
|
||||||
senderEmail: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
subject: str | None = Field(default=None, alias="Subject")
|
|
||||||
threatType: str | None = Field(default=None, alias="ThreatType")
|
|
||||||
detectionType: str | None = Field(default=None, alias="DetectionType")
|
|
||||||
reportedBy: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
|
|
||||||
class CompanyMitigationDetailsPostResponse(IronscalesModel):
|
|
||||||
incidentID: int | None = Field(default=None, alias="IncidentId")
|
|
||||||
mitigationID: int | None = Field(default=None, alias="MitigationID")
|
|
||||||
incidentState: int | None = Field(default=None, alias="IncidentState")
|
|
||||||
remediatedTime: datetime | None = Field(default=None, alias="RemediatedTime")
|
|
||||||
mailboxId: str | None = Field(default=None, alias="MailboxId")
|
|
||||||
mailboxEmail: str | None = Field(default=None, alias="MailboxEmail")
|
|
||||||
subject: str | None = Field(default=None, alias="Subject")
|
|
||||||
senderEmail: str | None = Field(default=None, alias="SenderEmail")
|
|
||||||
senderIP: str | None = Field(default=None, alias="SenderIP")
|
|
||||||
reportedBy: str | None = Field(default=None, alias="ReportedBy")
|
|
||||||
resolution: str | None = Field(default=None, alias="Resolution")
|
|
||||||
spfResult: str | None = Field(default=None, alias="SPFResult")
|
|
||||||
|
|
||||||
class CompanyMitigationStatistics(IronscalesModel):
|
|
||||||
openIncidentCount: int | None = Field(default=None, alias="OpenIncidentCount")
|
|
||||||
resolvedIncidentCount: int | None = Field(default=None, alias="ResolvedIncidentCount")
|
|
||||||
phishingCount: int | None = Field(default=None, alias="PhishingCount")
|
|
||||||
remediationCount: int | None = Field(default=None, alias="RemediationCount")
|
|
||||||
maliciousAttachmentsCount: int | None = Field(default=None, alias="MaliciousAttachmentsCount")
|
|
||||||
maliciousLinksCount: int | None = Field(default=None, alias="MaliciousLinksCount")
|
|
||||||
impersonationCount: int | None = Field(default=None, alias="ImpersonationCount")
|
|
||||||
reportedByEmployeesCount: int | None = Field(default=None, alias="ReportedByEmployeesCount")
|
|
||||||
|
|
||||||
class CompanyEmailStatistics(IronscalesModel):
|
|
||||||
inspected_count: int | None = Field(default=None, alias="InspectedCount")
|
|
||||||
phishing_count: int | None = Field(default=None, alias="PhishingCount")
|
|
||||||
spam_count: int | None = Field(default=None, alias="SpamCount")
|
|
||||||
impersonations_count: int | None = Field(default=None, alias="ImpersonationsCount")
|
|
||||||
phishing_threat_types: dict[str, int] | None = Field(default=None, alias="PhishingThreatTypes")
|
|
||||||
|
|
||||||
class MostTargetedDepartments(IronscalesModel):
|
|
||||||
name: int | None = Field(default=None, alias="Name")
|
|
||||||
emails_count: int | None = Field(default=None, alias="EmailsCount")
|
|
||||||
|
|
||||||
class MostTargetedEmployees(IronscalesModel):
|
|
||||||
mailbox: int | None = Field(default=None, alias="Mailbox")
|
|
||||||
emails_count: int | None = Field(default=None, alias="EmailsCount")
|
|
||||||
|
|
||||||
class CompanyMitigationStatisticsV2(IronscalesModel):
|
|
||||||
resolved_by_analyst: dict[str, int | float] | None = Field(default=None, alias="ResolvedByAnalyst")
|
|
||||||
inspected_emails: dict[str, int] | None = Field(default=None, alias="InspectedEmails")
|
|
||||||
resolved_automatically: dict[str, int | float] | None = Field(default=None, alias="ResolvedAutomatically")
|
|
||||||
malicious_content_incidents: dict[str, int] | None = Field(default=None, alias="MaliciousContectIncidents")
|
|
||||||
|
|
||||||
class CompanyLicensedDomains(IronscalesModel):
|
|
||||||
company_id: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
licensed_domains: list[str] | None = Field(default=None, alias="LicensedDomains")
|
|
||||||
|
|
||||||
class CompanyLicensedDomainsPutResponse(IronscalesModel):
|
|
||||||
company_id: int | None = Field(default=None, alias="CompanyId")
|
|
||||||
domains_added: list[str] | None = Field(default=None, alias="DomainsAdded")
|
|
||||||
existing_domains: list[str] | None = Field(default=None, alias="ExistingDomains")
|
|
||||||
|
|
||||||
class CompanyLicense(IronscalesModel):
|
|
||||||
id: int | None = Field(default=None, alias="Id")
|
|
||||||
trialExpiration: datetime | None = Field(default=None, alias="TrialExpiration")
|
|
||||||
trialPlanType: str | None = Field(default=None, alias="TrialPlanType")
|
|
||||||
premiumContentType: str | None = Field(default=None, alias="PremiumContentType")
|
|
||||||
planType: str | None = Field(default=None, alias="PlanType")
|
|
||||||
planExpiration: str | None = Field(default=None, alias="PlanExpiration")
|
|
||||||
mailboxLimit: int | None = Field(default=None, alias="MailboxLimit")
|
|
||||||
is_partner: bool | None = Field(default=None, alias="IsPartner")
|
|
||||||
testMode: bool | None = Field(default=None, alias="TestMode")
|
|
||||||
|
|
||||||
class AccountTakeoverSensitivySettings(IronscalesModel):
|
|
||||||
sensitivity: int | None = Field(default=None, alias="Sensitivity")
|
|
||||||
|
|
||||||
class AllowListSettings(IronscalesModel):
|
|
||||||
allow_list: dict[str, Any] | None = Field(default=None, alias="AllowList")
|
|
||||||
internal_active: bool | None = Field(default=None, alias="InternalActive")
|
|
||||||
external_active: bool | None = Field(default=None, alias="ExternalActive")
|
|
||||||
|
|
||||||
class ChallengedAlerts(IronscalesModel):
|
|
||||||
recipients: list[str] | None = Field(default=None, alias="Recipients")
|
|
||||||
|
|
||||||
class CompanyNotificationSettings(IronscalesModel):
|
|
||||||
recipients: list[str] | None = Field(default=None, alias="Recipients")
|
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
endpointmodel: IPaginateable,
|
endpointmodel: IPaginateable,
|
||||||
endpoint: str,
|
endpoint: str,
|
||||||
page: int,
|
page: int,
|
||||||
|
limit: int,
|
||||||
params: RequestParams | None = None,
|
params: RequestParams | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
@ -57,7 +58,7 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
expected model type for the response data. This allows for type-safe handling
|
expected model type for the response data. This allows for type-safe handling
|
||||||
of model instances throughout the class.
|
of model instances throughout the class.
|
||||||
"""
|
"""
|
||||||
self._initialize(response, response_model, endpointmodel, endpoint, page, params)
|
self._initialize(response, response_model, endpointmodel, endpoint, page, limit, params)
|
||||||
|
|
||||||
def _initialize(
|
def _initialize(
|
||||||
self,
|
self,
|
||||||
@ -66,6 +67,7 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
endpointmodel: IPaginateable,
|
endpointmodel: IPaginateable,
|
||||||
endpoint: str,
|
endpoint: str,
|
||||||
page: int,
|
page: int,
|
||||||
|
limit: int,
|
||||||
params: RequestParams | None = None,
|
params: RequestParams | None = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@ -75,36 +77,35 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
response: The raw response object from the API.
|
response: The raw response object from the API.
|
||||||
endpointmodel (IronscalesEndpoint[TModel]): The endpointmodel associated with the response.
|
endpointmodel (IronscalesEndpoint[TModel]): The endpointmodel associated with the response.
|
||||||
endpoint: The endpoint url to extract the data
|
endpoint: The endpoint url to extract the data
|
||||||
|
limit (int): The number of items per page.
|
||||||
"""
|
"""
|
||||||
self.response = response
|
self.response = response
|
||||||
self.response_model = response_model
|
self.response_model = response_model
|
||||||
self.endpointmodel = endpointmodel
|
self.endpointmodel = endpointmodel
|
||||||
self.endpoint = endpoint
|
self.endpoint = endpoint
|
||||||
|
self.limit = limit
|
||||||
# Get page data from the response body
|
# Get page data from the response body
|
||||||
try:
|
try:
|
||||||
self.parsed_pagination_response = parse_response_body(json.loads(response.content.decode('utf-8')))
|
self.parsed_pagination_response = parse_response_body(json.loads(response.content.decode('utf-8')).get('pagination', {}))
|
||||||
except:
|
except:
|
||||||
pass
|
self.parsed_pagination_response = parse_response_body(json.loads(response.content.decode('utf-8')).get('meta.page', {}))
|
||||||
self.params = params
|
self.params = params
|
||||||
try:
|
if self.parsed_pagination_response is not None:
|
||||||
if self.parsed_pagination_response is not None:
|
# Ironscales API gives us a handy response to parse for Pagination
|
||||||
# Ironscales API gives us a handy response to parse for Pagination
|
self.has_next_page: bool = self.parsed_pagination_response.get("has_next_page", False)
|
||||||
self.has_next_page: bool = self.parsed_pagination_response.get("has_next_page", False)
|
self.has_prev_page: bool = self.parsed_pagination_response.get("has_prev_page", False)
|
||||||
self.has_prev_page: bool = self.parsed_pagination_response.get("has_prev_page", False)
|
self.first_page: int = self.parsed_pagination_response.get("first_page", None)
|
||||||
self.first_page: int = self.parsed_pagination_response.get("first_page", None)
|
self.prev_page: int = self.parsed_pagination_response.get("prev_page", None)
|
||||||
self.prev_page: int = self.parsed_pagination_response.get("prev_page", None)
|
self.next_page: int = self.parsed_pagination_response.get("next_page", None)
|
||||||
self.next_page: int = self.parsed_pagination_response.get("next_page", None)
|
self.last_page: int = self.parsed_pagination_response.get("last_page", None)
|
||||||
self.last_page: int = self.parsed_pagination_response.get("last_page", None)
|
else:
|
||||||
else:
|
# Haven't worked on this yet
|
||||||
# Haven't worked on this yet
|
self.has_next_page: bool = True
|
||||||
self.has_next_page: bool = True
|
self.has_prev_page: bool = page > 1
|
||||||
self.has_prev_page: bool = page > 1
|
self.first_page: int = 1
|
||||||
self.first_page: int = 1
|
self.prev_page = page - 1 if page > 1 else 1
|
||||||
self.prev_page = page - 1 if page > 1 else 1
|
self.next_page = page + 1
|
||||||
self.next_page = page + 1
|
self.last_page = 999999
|
||||||
self.last_page = 999999
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
self.data: list[TModel] = [response_model.model_validate(d) for d in response.json().get(endpoint, {})]
|
self.data: list[TModel] = [response_model.model_validate(d) for d in response.json().get(endpoint, {})]
|
||||||
self.has_data = self.data and len(self.data) > 0
|
self.has_data = self.data and len(self.data) > 0
|
||||||
self.index = 0
|
self.index = 0
|
||||||
@ -121,13 +122,14 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
self.has_data = False
|
self.has_data = False
|
||||||
return self
|
return self
|
||||||
|
|
||||||
next_response = self.endpointmodel.paginated(self.next_page, self.params)
|
next_response = self.endpointmodel.paginated(self.next_page, self.limit, self.params)
|
||||||
self._initialize(
|
self._initialize(
|
||||||
next_response.response,
|
next_response.response,
|
||||||
next_response.response_model,
|
next_response.response_model,
|
||||||
next_response.endpointmodel,
|
next_response.endpointmodel,
|
||||||
next_response.endpoint,
|
next_response.endpoint,
|
||||||
self.next_page,
|
self.next_page,
|
||||||
|
next_response.limit,
|
||||||
self.params,
|
self.params,
|
||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
@ -144,12 +146,13 @@ class PaginatedResponse(Generic[TModel]):
|
|||||||
self.has_data = False
|
self.has_data = False
|
||||||
return self
|
return self
|
||||||
|
|
||||||
prev_response = self.endpointmodel.paginated(self.prev_page, self.params)
|
prev_response = self.endpointmodel.paginated(self.prev_page, self.limit, self.params)
|
||||||
self._initialize(
|
self._initialize(
|
||||||
prev_response.response,
|
prev_response.response,
|
||||||
prev_response.response_model,
|
prev_response.response_model,
|
||||||
prev_response.endpointmodel,
|
prev_response.endpointmodel,
|
||||||
self.prev_page,
|
self.prev_page,
|
||||||
|
prev_response.limit,
|
||||||
self.params,
|
self.params,
|
||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
|
|||||||
@ -52,20 +52,20 @@ def parse_response_body(
|
|||||||
print(pagination_info)
|
print(pagination_info)
|
||||||
# Output: {'first_page': 1, 'next_page': 2, 'has_next_page': True}
|
# Output: {'first_page': 1, 'next_page': 2, 'has_next_page': True}
|
||||||
"""
|
"""
|
||||||
if body.get("page") is None:
|
if body.get("current_page") is None:
|
||||||
return None
|
return None
|
||||||
has_next_page: bool = False
|
has_next_page: bool = False
|
||||||
has_prev_page: bool = False
|
has_prev_page: bool = False
|
||||||
first_page: int | None = None
|
first_page: int | None = None
|
||||||
prev_page: int | None = None
|
prev_page: int | None = None
|
||||||
page: int | None = None
|
current_page: int | None = None
|
||||||
current_page_count: int | None = None
|
current_page_count: int | None = None
|
||||||
limit: int | None = None
|
limit: int | None = None
|
||||||
total_count: int | None = None
|
total_count: int | None = None
|
||||||
next_page: int | None = None
|
next_page: int | None = None
|
||||||
next_page_url: str | None = None
|
next_page_url: str | None = None
|
||||||
next_page_token: str | None = None
|
next_page_token: str | None = None
|
||||||
total_pages: int | None = None
|
last_page: int | None = None
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
@ -74,25 +74,41 @@ def parse_response_body(
|
|||||||
|
|
||||||
if body.get("prev_page") is not None:
|
if body.get("prev_page") is not None:
|
||||||
result["prev_page"] = body.get("prev_page")
|
result["prev_page"] = body.get("prev_page")
|
||||||
elif body.get("page") is not None:
|
elif body.get("current_page") is not None:
|
||||||
if body.get("page") > 1:
|
if body.get("current_page") > 1:
|
||||||
result["prev_page"] = body.get("page") - 1
|
result["prev_page"] = body.get("current_page") - 1
|
||||||
|
elif body.get("currentPage") is not None:
|
||||||
|
if body.get("currentPage") > 1:
|
||||||
|
result["prev_page"] = body.get("currentPage") - 1
|
||||||
|
|
||||||
if body.get("next_page") is not None:
|
if body.get("next_page") is not None:
|
||||||
result["next_page"] = body.get("next_page")
|
result["next_page"] = body.get("next_page")
|
||||||
elif body.get("currentPage") is not None and body.get("currentPage") < body.get("lastPage"):
|
elif body.get("currentPage") is not None and body.get("currentPage") < body.get("lastPage"):
|
||||||
result["next_page"] = body.get("currentPage") + 1
|
result["next_page"] = body.get("currentPage") + 1
|
||||||
|
|
||||||
if body.get("total_pages") is not None:
|
if body.get("last_page") is not None:
|
||||||
result["last_page"] = body.get("total_pages")
|
result["last_page"] = body.get("last_page")
|
||||||
|
elif body.get("lastPage") is not None:
|
||||||
|
result["last_page"] = body.get("lastPage")
|
||||||
|
elif body.get("last_page") is None and body.get("current_page") is not None:
|
||||||
|
result["last_page"] = math.ceil(body.get("total_count")/body.get("limit"))
|
||||||
|
|
||||||
if body.get("page") is not None and body.get("page") == body.get("total_pages"):
|
if body.get("has_next_page"):
|
||||||
|
result["has_next_page"] = body.get("has_next_page")
|
||||||
|
elif body.get("current_page") is not None and body.get("next_page") is not None:
|
||||||
|
result["has_next_page"] = True
|
||||||
|
elif body.get("current_page") is not None and body.get("next_page") is None:
|
||||||
result["has_next_page"] = False
|
result["has_next_page"] = False
|
||||||
elif body.get("page") is not None and body.get("page") < body.get("total_pages"):
|
elif body.get("currentPage") is not None and body.get("currentPage") < body.get("lastPage"):
|
||||||
result["has_next_page"] = True
|
result["has_next_page"] = True
|
||||||
|
|
||||||
if body.get("page") is not None:
|
if body.get("has_prev_page"):
|
||||||
if body.get("page") > 1:
|
result["has_prev_page"] = body.get("has_prev_page")
|
||||||
|
elif body.get("current_page") is not None:
|
||||||
|
if body.get("current_page") > 1:
|
||||||
|
result["has_prev_page"] = True
|
||||||
|
elif body.get("currentPage") is not None:
|
||||||
|
if body.get("currentPage") > 1:
|
||||||
result["has_prev_page"] = True
|
result["has_prev_page"] = True
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user