mirror of
https://github.com/brygphilomena/pyironscales.git
synced 2025-11-04 16:17:28 +00:00
Compare commits
2 Commits
83a238d206
...
c45bf96447
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c45bf96447 | ||
|
|
00aa2fd4fd |
1
.gitignore
vendored
1
.gitignore
vendored
@ -206,3 +206,4 @@ marimo/_static/
|
|||||||
marimo/_lsp/
|
marimo/_lsp/
|
||||||
__marimo__/
|
__marimo__/
|
||||||
src/ironscales_scratchpad.py
|
src/ironscales_scratchpad.py
|
||||||
|
src/pyironscales/endpoints/ironscales/old/
|
||||||
|
|||||||
@ -1,16 +1,20 @@
|
|||||||
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.SurveysEndpoint import SurveysEndpoint
|
from pyironscales.endpoints.ironscales.CampaignsEndpoint import CampaignsEndpoint
|
||||||
from pyironscales.endpoints.ironscales.AnswersEndpoint import AnswersEndpoint
|
from pyironscales.endpoints.ironscales.CompanyEndpoint import CompanyEndpoint
|
||||||
from pyironscales.endpoints.ironscales.CustomersEndpoint import CustomersEndpoint
|
from pyironscales.endpoints.ironscales.EmailsEndpoint import EmailsEndpoint
|
||||||
from pyironscales.endpoints.ironscales.QuestionsEndpoint import QuestionsEndpoint
|
from pyironscales.endpoints.ironscales.IncidentEndpoint import IncidentEndpoint
|
||||||
from pyironscales.endpoints.ironscales.TeamMembersEndpoint import TeamMembersEndpoint
|
from pyironscales.endpoints.ironscales.IntegrationsEndpoint import IntegrationsEndpoint
|
||||||
from pyironscales.endpoints.ironscales.ResponsesEndpoint import ResponsesEndpoint
|
from pyironscales.endpoints.ironscales.MailboxesEndpoint import MailboxesEndpoint
|
||||||
|
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):
|
||||||
@ -22,7 +26,7 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
privatekey: str,
|
privatekey: str,
|
||||||
scope: str,
|
scopes: list,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Initializes the client with the given credentials.
|
Initializes the client with the given credentials.
|
||||||
@ -31,7 +35,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.scope: list = scope
|
self.scopes: list = json.loads(scopes) if isinstance(json.loads(scopes), list) else [json.loads(scopes)]
|
||||||
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
|
||||||
@ -39,10 +43,58 @@ class IronscalesAPIClient(IronscalesClient):
|
|||||||
|
|
||||||
# Initializing endpoints
|
# Initializing endpoints
|
||||||
@property
|
@property
|
||||||
def surveys(self) -> "SurveysEndpoint":
|
def campaigns(self) -> "CampaignsEndpoint":
|
||||||
from pyironscales.endpoints.ironscales.SurveysEndpoint import SurveysEndpoint
|
from pyironscales.endpoints.ironscales.CampaignsEndpoint import CampaignsEndpoint
|
||||||
|
|
||||||
return SurveysEndpoint(self)
|
return CampaignsEndpoint(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:
|
||||||
"""
|
"""
|
||||||
@ -61,17 +113,16 @@ 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.scope
|
"scopes": self.scopes
|
||||||
},
|
},
|
||||||
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 = auth_resp_json["expires_in"]
|
expires_in_sec = 43200
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
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,59 +0,0 @@
|
|||||||
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(),
|
|
||||||
)
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
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', {}))
|
|
||||||
22
src/pyironscales/endpoints/ironscales/CampaignsEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/CampaignsEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
17
src/pyironscales/endpoints/ironscales/CampaignsIdEndpoint.py
Normal file
17
src/pyironscales/endpoints/ironscales/CampaignsIdEndpoint.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -2,30 +2,29 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CustomerBulk
|
from pyironscales.models.ironscales import PartnerCompany
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomersBulkEndpoint(
|
class CompanyCreateEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[CustomerBulk, IronscalesRequestParams],
|
IPostable[PartnerCompany, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "bulk", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "create", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, CustomerBulk)
|
IPostable.__init__(self, PartnerCompany)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CustomerBulk:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> PartnerCompany:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /customers/bulk endpoint.
|
Performs a POST request against the /company/create 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 response data.
|
Survey: The parsed Company data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(CustomerBulk, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(PartnerCompany, super()._make_request("POST", data=data, params=params).json())
|
||||||
26
src/pyironscales/endpoints/ironscales/CompanyEndpoint.py
Normal file
26
src/pyironscales/endpoints/ironscales/CompanyEndpoint.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
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())
|
||||||
@ -2,37 +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 Question
|
from pyironscales.models.ironscales import CompanyAutoSyncGroups
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class QuestionsEndpoint(
|
class CompanyIdAutoSyncGroupsEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[Question, IronscalesRequestParams],
|
IGettable[CompanyAutoSyncGroups, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "questions", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "groups/", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, Question)
|
IGettable.__init__(self, CompanyAutoSyncGroups)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Question:
|
) -> CompanyAutoSyncGroups:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /questions endpoint.
|
Performs a GET request against the /company/{id}/auto-sync/groups/ 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:
|
||||||
Question: The parsed response data.
|
CompanyAutoSyncGroups: The parsed response data.
|
||||||
"""
|
"""
|
||||||
print("get")
|
|
||||||
return self._parse_many(
|
return self._parse_many(
|
||||||
Question,
|
CompanyAutoSyncGroups,
|
||||||
super()._make_request("GET", data=data, params=params).json().get('questions', {}),
|
super()._make_request("GET", data=data, params=params).json().get('groups', {}),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
84
src/pyironscales/endpoints/ironscales/CompanyIdEndpoint.py
Normal file
84
src/pyironscales/endpoints/ironscales/CompanyIdEndpoint.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -2,30 +2,29 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import Response
|
from pyironscales.models.ironscales import CompanyManifest
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResponsesCreateOrUpdateEndpoint(
|
class CompanyIdManifestEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[Response, IronscalesRequestParams],
|
IPostable[CompanyManifest, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "create-or-update", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "manifest/", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, Response)
|
IPostable.__init__(self, CompanyManifest)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> Response:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CompanyManifest:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /responses/create-or-update endpoint.
|
Performs a POST request against the /company/{id}/manifest/ 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 response data.
|
CompanyManifest: The parsed Company data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(Response, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(CompanyManifest, super()._make_request("POST", data=data, params=params).json())
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
40
src/pyironscales/endpoints/ironscales/CompanyListEndpoint.py
Normal file
40
src/pyironscales/endpoints/ironscales/CompanyListEndpoint.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -1,46 +0,0 @@
|
|||||||
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())
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
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(),
|
|
||||||
)
|
|
||||||
22
src/pyironscales/endpoints/ironscales/EmailsEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/EmailsEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
68
src/pyironscales/endpoints/ironscales/EmailsIdEndpoint.py
Normal file
68
src/pyironscales/endpoints/ironscales/EmailsIdEndpoint.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
22
src/pyironscales/endpoints/ironscales/IncidentEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/IncidentEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -2,30 +2,29 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IPostable,
|
IPostable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import CustomerBulk
|
from pyironscales.models.ironscales import IncidentClassify
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomersBulkEndpoint(
|
class IncidentIdClassifyIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPostable[CustomerBulk, IronscalesRequestParams],
|
IPostable[IncidentClassify, IronscalesRequestParams],
|
||||||
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "bulk", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
IPostable.__init__(self, CustomerBulk)
|
IPostable.__init__(self, IncidentClassify)
|
||||||
|
|
||||||
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> CustomerBulk:
|
def post(self, data: JSON | None = None, params: IronscalesRequestParams | None = None) -> IncidentClassify:
|
||||||
"""
|
"""
|
||||||
Performs a POST request against the /customers/bulk endpoint.
|
Performs a POST request against the /incident/{id}/classify/{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:
|
||||||
Survey: The parsed response data.
|
IncidentClassify: The parsed Company data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(CustomerBulk, super()._make_request("POST", data=data, params=params).json())
|
return self._parse_one(IncidentClassify, super()._make_request("POST", data=data, params=params).json())
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -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 Response
|
from pyironscales.models.ironscales import IncidentDetails
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResponsesIdEndpoint(
|
class IncidentIdDetailsIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[Response, IronscalesRequestParams],
|
IGettable[IncidentDetails, 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, Response)
|
IGettable.__init__(self, IncidentDetails)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Response:
|
) -> IncidentDetails:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /responses/{id} endpoint.
|
Performs a GET request against the /incident/{id}/details/{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:
|
||||||
AuthInformation: The parsed response data.
|
IncidentDetails: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
Response,
|
IncidentDetails,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
31
src/pyironscales/endpoints/ironscales/IncidentIdEndpoint.py
Normal file
31
src/pyironscales/endpoints/ironscales/IncidentIdEndpoint.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -2,37 +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 Question
|
from pyironscales.models.ironscales import UnclassifiedIncidentIDs
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class QuestionsEndpoint(
|
class IncidentIdStatusEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[Question, IronscalesRequestParams],
|
IGettable[UnclassifiedIncidentIDs, IronscalesRequestParams],
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
IronscalesEndpoint.__init__(self, client, "questions", parent_endpoint=parent_endpoint)
|
IronscalesEndpoint.__init__(self, client, "{id}/", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, Question)
|
IGettable.__init__(self, UnclassifiedIncidentIDs)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Question:
|
) -> UnclassifiedIncidentIDs:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /questions endpoint.
|
Performs a GET request against the /incident/{id}/{status}/ 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:
|
||||||
Question: The parsed response data.
|
UnclassifiedIncidentIDs: The parsed response data.
|
||||||
"""
|
"""
|
||||||
print("get")
|
return self._parse_one(
|
||||||
return self._parse_many(
|
UnclassifiedIncidentIDs,
|
||||||
Question,
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
super()._make_request("GET", data=data, params=params).json().get('questions', {}),
|
|
||||||
)
|
)
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
22
src/pyironscales/endpoints/ironscales/MailboxesEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/MailboxesEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
13
src/pyironscales/endpoints/ironscales/MailboxesIdEndpoint.py
Normal file
13
src/pyironscales/endpoints/ironscales/MailboxesIdEndpoint.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
22
src/pyironscales/endpoints/ironscales/MitigationEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/MitigationEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
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', {}))
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
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', {}),
|
||||||
|
)
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
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))
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
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(),
|
||||||
|
)
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
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())
|
||||||
22
src/pyironscales/endpoints/ironscales/PlanDetailsEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/PlanDetailsEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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,36 @@ from pyironscales.endpoints.base.base_endpoint import IronscalesEndpoint
|
|||||||
from pyironscales.interfaces import (
|
from pyironscales.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import TeamMember
|
from pyironscales.models.ironscales import CompanyLicense
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TeamMembersIdEndpoint(
|
class PlanDetailsIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[TeamMember, IronscalesRequestParams],
|
IGettable[CompanyLicense, 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, TeamMember)
|
IGettable.__init__(self, CompanyLicense)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> TeamMember:
|
) -> CompanyLicense:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /team-members/{id} endpoint.
|
Performs a GET request against the /emails/{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:
|
||||||
AuthInformation: The parsed response data.
|
CompanyLicense: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
TeamMember,
|
CompanyLicense,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -1,31 +0,0 @@
|
|||||||
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())
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
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
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
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', {}))
|
|
||||||
22
src/pyironscales/endpoints/ironscales/SettingsEndpoint.py
Normal file
22
src/pyironscales/endpoints/ironscales/SettingsEndpoint.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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,41 +1,40 @@
|
|||||||
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 Answer
|
from pyironscales.models.ironscales import AccountTakeoverSensitivySettings
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class SettingsIdAccountTakeoverEndpoint(
|
||||||
class AnswersIdEndpoint(
|
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IGettable[Answer, IronscalesRequestParams],
|
IGettable[AccountTakeoverSensitivySettings, IronscalesRequestParams],
|
||||||
IPuttable[Answer, IronscalesRequestParams],
|
IPuttable[AccountTakeoverSensitivySettings, 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, "account-takeover/", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, Answer)
|
IGettable.__init__(self, AccountTakeoverSensitivySettings)
|
||||||
IPuttable.__init__(self, Answer)
|
IPuttable.__init__(self, AccountTakeoverSensitivySettings)
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Answer:
|
) -> AccountTakeoverSensitivySettings:
|
||||||
"""
|
"""
|
||||||
Performs a GET request against the /answers/{id} endpoint.
|
Performs a GET request against the /settings/{id}/account-takeover/ 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:
|
||||||
AuthInformation: The parsed response data.
|
AccountTakeoverSensitivySettings: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
Answer,
|
AccountTakeoverSensitivySettings,
|
||||||
super()._make_request("GET", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,17 +42,17 @@ class AnswersIdEndpoint(
|
|||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Answer:
|
) -> AccountTakeoverSensitivySettings:
|
||||||
"""
|
"""
|
||||||
Performs a PUT request against the /answers/{id} endpoint.
|
Performs a PUT request against the /settings/{id}/account-takeover/ 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:
|
||||||
Answer: The parsed response data.
|
AccountTakeoverSensitivySettings: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
Answer,
|
AccountTakeoverSensitivySettings,
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
super()._make_request("PUT", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
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())
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
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,37 +1,40 @@
|
|||||||
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 (
|
||||||
IPuttable,
|
IGettable,
|
||||||
)
|
)
|
||||||
from pyironscales.models.ironscales import Response
|
from pyironscales.models.ironscales import CompanyLicense
|
||||||
from pyironscales.types import (
|
from pyironscales.types import (
|
||||||
JSON,
|
JSON,
|
||||||
IronscalesRequestParams,
|
IronscalesRequestParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResponsesIdUpdateEndpoint(
|
class SettingsIdEndpoint(
|
||||||
IronscalesEndpoint,
|
IronscalesEndpoint,
|
||||||
IPuttable[Response, IronscalesRequestParams],
|
IGettable[CompanyLicense, 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)
|
||||||
IPuttable.__init__(self, Response)
|
IGettable.__init__(self, CompanyLicense)
|
||||||
|
self.account_takeover = self._register_child_endpoint(SettingsIdAccountTakeoverEndpoint(client, parent_endpoint=self))
|
||||||
|
|
||||||
def put(
|
def get(
|
||||||
self,
|
self,
|
||||||
data: JSON | None = None,
|
data: JSON | None = None,
|
||||||
params: IronscalesRequestParams | None = None,
|
params: IronscalesRequestParams | None = None,
|
||||||
) -> Response:
|
) -> CompanyLicense:
|
||||||
"""
|
"""
|
||||||
Performs a PUT request against the /responses/{id}/update endpoint.
|
Performs a GET request against the /emails/{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:
|
||||||
Response: The parsed response data.
|
CompanyLicense: The parsed response data.
|
||||||
"""
|
"""
|
||||||
return self._parse_one(
|
return self._parse_one(
|
||||||
Response,
|
CompanyLicense,
|
||||||
super()._make_request("PUT", data=data, params=params).json(),
|
super()._make_request("GET", data=data, params=params).json(),
|
||||||
)
|
)
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
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())
|
||||||
@ -1,52 +0,0 @@
|
|||||||
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', {}),
|
|
||||||
)
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
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())
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
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))
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
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())
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
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(),
|
|
||||||
)
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
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,59 +0,0 @@
|
|||||||
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,37 +0,0 @@
|
|||||||
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(),
|
|
||||||
)
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
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(),
|
|
||||||
)
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
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', {}))
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
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())
|
|
||||||
@ -16,61 +16,429 @@ 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 Answer(IronscalesModel):
|
class Campaigns(IronscalesModel):
|
||||||
id: int | None = Field(default=None, alias="Id")
|
campaignID: int | None = Field(default=None, alias="CampaignId")
|
||||||
created: datetime | None = Field(default=None, alias="Created")
|
campaignName: str | None = Field(default=None, alias="CampaignName")
|
||||||
modified: datetime | None = Field(default=None, alias="Modified")
|
campaignStatus: str | None = Field(default=None, alias="CampaignStatus")
|
||||||
question: dict[str, Any] | None = Field(default=None, alias="Question")
|
flowType: str | None = Field(default=None, alias="FlowType")
|
||||||
choice: str | None = Field(default=None, alias="Choice")
|
language: str | None = Field(default=None, alias="Language")
|
||||||
choice_label: str | None = Field(default=None, alias="ChoiceLabel")
|
maxEmailPerDay: int | None = Field(default=None, alias="MaxEmailPerDay")
|
||||||
choices: list | None = Field(default=None, alias="Choices")
|
endDate: datetime | None = Field(default=None, alias="Modified")
|
||||||
sentiment: str | None = Field(default=None, alias="Sentiment")
|
launchDate: datetime | None = Field(default=None, alias="Modified")
|
||||||
comment: str | None = Field(default=None, alias="Comment")
|
emailsSent: int | None = Field(default=None, alias="EmailsSent")
|
||||||
follow_up_answer: str | None = Field(default=None, alias="FollowUpAnswer")
|
participants: int | None = Field(default=None, alias="Participants")
|
||||||
follow_up_answer_choice: str | None = Field(default=None, alias="FollowUpAnswerChoice")
|
emailsBounced: int | None = Field(default=None, alias="EmailsBounced")
|
||||||
follow_up_answer_choices: list | None = Field(default=None, alias="FollowUpAnswerChoices")
|
numberOfClickedParticipants: int | None = Field(default=None, alias="NumberOfClickedParticipants")
|
||||||
survey: dict[str, str | int] | None = Field(default=None, alias="Survey")
|
numberOfTrainedParticipants: int | None = Field(default=None, alias="NumberOfTrainedParticipants")
|
||||||
published_as_testimonial: bool | None = Field(default=None, alias="PublishedAsTestimonial")
|
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
|
||||||
response_id: int | None = Field(default=None, alias="ResponseId")
|
numberOfReportedParticipants: int | None = Field(default=None, alias="NumberOfReportedParticipants")
|
||||||
|
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 Customer(IronscalesModel):
|
class CampaignParticipants(IronscalesModel):
|
||||||
id: int | None = Field(default=None, alias="Id")
|
internalID: int | None = Field(default=None, alias="InternalID")
|
||||||
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")
|
||||||
email: str | None = Field(default=None, alias="Email")
|
displayName: str | None = Field(default=None, alias="DisplayName")
|
||||||
|
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")
|
||||||
custom_attributes: dict[str, str | int] | None = Field(default=None, alias="CustomAttributes")
|
manager: str | None = Field(default=None, alias="Manager")
|
||||||
|
office: str | None = Field(default=None, alias="Office")
|
||||||
class TeamMember(IronscalesModel):
|
country: str | None = Field(default=None, alias="Country")
|
||||||
id: int | None = Field(default=None, alias="Id")
|
city: str | None = Field(default=None, alias="City")
|
||||||
external_id: str | None = Field(default=None, alias="ExternalId")
|
sentAt: datetime | None = Field(default=None, alias="SentAt")
|
||||||
created: datetime | None = Field(default=None, alias="Created")
|
opened: str | None = Field(default=None, alias="Opened")
|
||||||
modified: datetime | None = Field(default=None, alias="Modified")
|
openedAt: datetime | None = Field(default=None, alias="OpenedAt")
|
||||||
name: str | None = Field(default=None, alias="Name")
|
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")
|
email: str | None = Field(default=None, alias="Email")
|
||||||
custom_attributes: dict[str, str | int] | None = Field(default=None, alias="CustomAttributes")
|
template: str | None = Field(default=None, alias="Template")
|
||||||
|
userIp: str | None = Field(default=None, alias="UserIp")
|
||||||
|
|
||||||
class Response(IronscalesModel):
|
class PartnerCompany(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")
|
||||||
metric: str | None = Field(default=None, alias="Metric")
|
domain: str | None = Field(default=None, alias="Domain")
|
||||||
survey_token: str | None = Field(default=None, alias="SurveyToken")
|
ownerEmail: str | None = Field(default=None, alias="OwnerEmail")
|
||||||
survey_type: str | None = Field(default=None, alias="SurveyType")
|
ownerName: str | None = Field(default=None, alias="OwnerName")
|
||||||
brand_name: str | None = Field(default=None, alias="BrandName")
|
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")
|
||||||
|
|
||||||
class CustomerBulk(IronscalesModel):
|
class PartnerCompanyV2(IronscalesModel):
|
||||||
request_id: str | None = Field(default=None, alias="RequestId")
|
id: int | None = Field(default=None, alias="Id")
|
||||||
detail: str | None = Field(default=None, alias="Detail")
|
name: str | None = Field(default=None, alias="Name")
|
||||||
|
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):
|
||||||
|
in_progress: bool | None = Field(default=None, alias="InProgress")
|
||||||
|
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")
|
||||||
|
|
||||||
class SurveyEmail(IronscalesModel):
|
|
||||||
detail: str | None = Field(default=None, alias="Detail")
|
|
||||||
|
|||||||
@ -42,7 +42,6 @@ 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:
|
||||||
"""
|
"""
|
||||||
@ -58,7 +57,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, limit, params)
|
self._initialize(response, response_model, endpointmodel, endpoint, page, params)
|
||||||
|
|
||||||
def _initialize(
|
def _initialize(
|
||||||
self,
|
self,
|
||||||
@ -67,7 +66,6 @@ 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,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@ -77,35 +75,36 @@ 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')).get('pagination', {}))
|
self.parsed_pagination_response = parse_response_body(json.loads(response.content.decode('utf-8')))
|
||||||
except:
|
except:
|
||||||
self.parsed_pagination_response = parse_response_body(json.loads(response.content.decode('utf-8')).get('meta.page', {}))
|
pass
|
||||||
self.params = params
|
self.params = params
|
||||||
if self.parsed_pagination_response is not None:
|
try:
|
||||||
# Ironscales API gives us a handy response to parse for Pagination
|
if self.parsed_pagination_response is not None:
|
||||||
self.has_next_page: bool = self.parsed_pagination_response.get("has_next_page", False)
|
# Ironscales API gives us a handy response to parse for Pagination
|
||||||
self.has_prev_page: bool = self.parsed_pagination_response.get("has_prev_page", False)
|
self.has_next_page: bool = self.parsed_pagination_response.get("has_next_page", False)
|
||||||
self.first_page: int = self.parsed_pagination_response.get("first_page", None)
|
self.has_prev_page: bool = self.parsed_pagination_response.get("has_prev_page", False)
|
||||||
self.prev_page: int = self.parsed_pagination_response.get("prev_page", None)
|
self.first_page: int = self.parsed_pagination_response.get("first_page", None)
|
||||||
self.next_page: int = self.parsed_pagination_response.get("next_page", None)
|
self.prev_page: int = self.parsed_pagination_response.get("prev_page", None)
|
||||||
self.last_page: int = self.parsed_pagination_response.get("last_page", None)
|
self.next_page: int = self.parsed_pagination_response.get("next_page", None)
|
||||||
else:
|
self.last_page: int = self.parsed_pagination_response.get("last_page", None)
|
||||||
# Haven't worked on this yet
|
else:
|
||||||
self.has_next_page: bool = True
|
# Haven't worked on this yet
|
||||||
self.has_prev_page: bool = page > 1
|
self.has_next_page: bool = True
|
||||||
self.first_page: int = 1
|
self.has_prev_page: bool = page > 1
|
||||||
self.prev_page = page - 1 if page > 1 else 1
|
self.first_page: int = 1
|
||||||
self.next_page = page + 1
|
self.prev_page = page - 1 if page > 1 else 1
|
||||||
self.last_page = 999999
|
self.next_page = page + 1
|
||||||
|
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
|
||||||
@ -122,14 +121,13 @@ 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.limit, self.params)
|
next_response = self.endpointmodel.paginated(self.next_page, 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
|
||||||
@ -146,13 +144,12 @@ 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.limit, self.params)
|
prev_response = self.endpointmodel.paginated(self.prev_page, 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("current_page") is None:
|
if body.get("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
|
||||||
current_page: int | None = None
|
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
|
||||||
last_page: int | None = None
|
total_pages: int | None = None
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
@ -74,41 +74,25 @@ 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("current_page") is not None:
|
elif body.get("page") is not None:
|
||||||
if body.get("current_page") > 1:
|
if body.get("page") > 1:
|
||||||
result["prev_page"] = body.get("current_page") - 1
|
result["prev_page"] = body.get("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("last_page") is not None:
|
if body.get("total_pages") is not None:
|
||||||
result["last_page"] = body.get("last_page")
|
result["last_page"] = body.get("total_pages")
|
||||||
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("has_next_page"):
|
if body.get("page") is not None and body.get("page") == body.get("total_pages"):
|
||||||
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("currentPage") is not None and body.get("currentPage") < body.get("lastPage"):
|
elif body.get("page") is not None and body.get("page") < body.get("total_pages"):
|
||||||
result["has_next_page"] = True
|
result["has_next_page"] = True
|
||||||
|
|
||||||
if body.get("has_prev_page"):
|
if body.get("page") is not None:
|
||||||
result["has_prev_page"] = body.get("has_prev_page")
|
if body.get("page") > 1:
|
||||||
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