Skip to content
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
%: build

.PHONY: test lint lint-fix format format-fix

build: uv.lock pagerduty/* pyproject.toml
rm -f dist/* && uv build

Expand All @@ -16,3 +18,18 @@ publish: build

uv.lock: pyproject.toml
uv sync

lint:
uvx ruff check

lint-fix:
uvx ruff check --fix

format:
uvx ruff format --check

format-fix:
uvx ruff format

test:
./test.sh
2 changes: 1 addition & 1 deletion pagerduty/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def stagger_cooldown(self) -> float:
Setting this to a nonzero number helps avoid the "thundering herd"
effect that can potentially be caused by many API clients making
simultaneous concurrent API requests and consequently waiting for the
same amount of time before retrying. It is currently zero by default
same amount of time before retrying. It is currently zero by default
for consistent behavior with previous versions.
"""
if hasattr(self, "_stagger_cooldown"):
Expand Down
6 changes: 6 additions & 0 deletions pagerduty/jira_cloud_integration_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

CANONICAL_PATHS = ["/accounts_mappings", "/accounts_mappings/{id}"]

CURSOR_BASED_PAGINATION_PATHS = []

ENTITY_WRAPPER_CONFIG = {"GET /accounts_mappings/{id}": None}


Expand Down Expand Up @@ -43,6 +45,10 @@ def __init__(
def canonical_paths(self) -> List[CanonicalPath]:
return CANONICAL_PATHS

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
return CURSOR_BASED_PAGINATION_PATHS

@property
def entity_wrapper_config(self) -> dict:
return ENTITY_WRAPPER_CONFIG
6 changes: 6 additions & 0 deletions pagerduty/jira_server_integration_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

CANONICAL_PATHS = ["/rules"]

CURSOR_BASED_PAGINATION_PATHS = []

ENTITY_WRAPPER_CONFIG = {
# The /rules endpoints follow classic conventions; the wrapper can be inferred.
#
Expand Down Expand Up @@ -66,6 +68,10 @@ def __init__(
def canonical_paths(self) -> List[CanonicalPath]:
return CANONICAL_PATHS

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
return CURSOR_BASED_PAGINATION_PATHS

@property
def entity_wrapper_config(self) -> dict:
return ENTITY_WRAPPER_CONFIG
6 changes: 6 additions & 0 deletions pagerduty/ms_teams_integration_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

CANONICAL_PATHS = ["/incidents/{incident_id}/meeting"]

CURSOR_BASED_PAGINATION_PATHS = []

ENTITY_WRAPPER_CONFIG = {
# The "create a meeting" endpoint follows classic conventions.
#
Expand Down Expand Up @@ -49,6 +51,10 @@ def __init__(self, api_key: str, debug: bool = False, **kw):
def canonical_paths(self) -> List[CanonicalPath]:
return CANONICAL_PATHS

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
return CURSOR_BASED_PAGINATION_PATHS

@property
def entity_wrapper_config(self) -> dict:
return ENTITY_WRAPPER_CONFIG
6 changes: 3 additions & 3 deletions pagerduty/rest_api_v2_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,14 @@ def canonical_paths(self) -> List[CanonicalPath]:
:attr:`pagerduty.rest_api_v2_base_client.canonical_path` from
:attr:`pagerduty.RestApiV2BaseClient.canonical_path`.
"""
return []
raise NotImplementedError

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
"""
List of paths known by the client to support cursor-based pagination.
"""
return []
raise NotImplementedError

def dict_all(self, path: str, by: str = "id", **kw) -> dict:
"""
Expand Down Expand Up @@ -668,7 +668,7 @@ def entity_wrapper_config(self) -> dict:
corresponding API follow orthodox entity wrapping conventions, in which
case the wrapper information can be inferred from the path itself.
"""
return {}
raise NotImplementedError

def entity_wrappers(
self, http_method: str, path: CanonicalPath
Expand Down
6 changes: 6 additions & 0 deletions pagerduty/slack_integration_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"/incidents/{incident_id}/notification_channels"
]

CURSOR_BASED_PAGINATION_PATHS = []

ENTITY_WRAPPER_CONFIG = {
# Slack Dedicated Channels
"* /incidents/{incident_id}/dedicated_channel": "channel",
Expand Down Expand Up @@ -51,6 +53,10 @@ def __init__(
def canonical_paths(self) -> List[CanonicalPath]:
return CANONICAL_PATHS

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
return CURSOR_BASED_PAGINATION_PATHS

@property
def entity_wrapper_config(self) -> dict:
return ENTITY_WRAPPER_CONFIG
6 changes: 6 additions & 0 deletions pagerduty/slack_integration_connections_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"/workspaces/{slack_team_id}/connections/{connection_id}",
]

CURSOR_BASED_PAGINATION_PATHS = []

ENTITY_WRAPPER_CONFIG = {
# Slack Connections
"GET /workspaces/{slack_team_id}/connections": "slack_connections",
Expand Down Expand Up @@ -51,6 +53,10 @@ def __init__(
def canonical_paths(self) -> List[CanonicalPath]:
return CANONICAL_PATHS

@property
def cursor_based_pagination_paths(self) -> List[CanonicalPath]:
return CURSOR_BASED_PAGINATION_PATHS

@property
def entity_wrapper_config(self) -> dict:
return ENTITY_WRAPPER_CONFIG
Loading