Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 3.6.3

### Fixed: `settings.integration_events()` requested the wrong path

- `settings.integration_events()` now calls
`GET orgs/{org_slug}/settings/integrations/{integration_id}/events`. It
previously requested the integration's own path, which has no `GET` route,
so the method always failed. It needs the `integration:list` scope.
- Its return annotation is now `list`, matching the JSON array the endpoint
returns.

## 3.6.2

### Fixed: reject retired API credentials before use
Expand Down
9 changes: 6 additions & 3 deletions socketdev/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,25 @@ def get(
)
return {}

def integration_events(self, org_slug: str, integration_id: str) -> dict:
def integration_events(self, org_slug: str, integration_id: str) -> list:
"""Get integration events for a specific integration.

Args:
org_slug: Organization slug
integration_id: Integration ID

Returns:
The integration's events, as the list the API returns.
"""
path = f"orgs/{org_slug}/settings/integrations/{integration_id}"
path = f"orgs/{org_slug}/settings/integrations/{integration_id}/events"
response = self.api.do_request(path=path)

if response.status_code == 200:
return response.json()

error_message = response.json().get("error", {}).get("message", "Unknown error")
log.error(f"Error getting integration events: {response.status_code}, message: {error_message}")
return {}
return []

def get_license_policy(self, org_slug: str) -> dict:
"""Get license policy settings for an organization.
Expand Down
2 changes: 1 addition & 1 deletion socketdev/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.6.2"
__version__ = "3.6.3"
27 changes: 27 additions & 0 deletions tests/unit/test_all_endpoints_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,33 @@ def test_settings_get_unit(self):
self.assertEqual(call_args[0][0], "GET")
self.assertIn("/orgs/test-org/settings", call_args[0][1])

def test_settings_integration_events_unit(self):
"""Test integration events retrieval."""
expected_data = [
{
"id": "event-1",
"integration_id": "integration-1",
"type": "alert",
"payload": {},
"status_code": 200,
"error": "",
"sent_at": "2026-01-01T00:00:00.000Z",
"retry_info": [],
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
}
]
self._mock_response(expected_data)

result = self.sdk.settings.integration_events("test-org", "integration-1")

self.assertEqual(result, expected_data)
call_args = self.mock_requests.request.call_args
self.assertEqual(call_args[0][0], "GET")
self.assertTrue(
call_args[0][1].endswith("/orgs/test-org/settings/integrations/integration-1/events")
)

# Triage endpoints
def test_triage_list_alert_triage_unit(self):
"""Test alert triage listing."""
Expand Down