Skip to content

ERA-12664: event provider and event source CRUD parity#31

Open
JoshuaVulcan wants to merge 5 commits intomainfrom
ERA-12664/eventprovider-eventsource-crud
Open

ERA-12664: event provider and event source CRUD parity#31
JoshuaVulcan wants to merge 5 commits intomainfrom
ERA-12664/eventprovider-eventsource-crud

Conversation

@JoshuaVulcan
Copy link
Contributor

@JoshuaVulcan JoshuaVulcan commented Feb 11, 2026

Summary

  • Add full CRUD methods for event providers and event sources to both sync (ERClient) and async (AsyncERClient) clients
  • Sync client gains: get_eventproviders(), get_eventprovider(), patch_eventprovider(), get_eventsources(), get_eventsource(), patch_eventsource()
  • Async client gains: post_eventprovider(), post_eventsource(), get_eventproviders(), get_eventprovider(), patch_eventprovider(), get_eventsources(), get_eventsource(), patch_eventsource()
  • 28 new tests covering success and error paths for all methods across both clients

DAS API Endpoints Covered

Endpoint Method Sync Async
activity/eventproviders GET (list) get_eventproviders() get_eventproviders()
activity/eventproviders/ POST post_eventprovider() (existing) post_eventprovider() (new)
activity/eventprovider/{id} GET get_eventprovider() get_eventprovider()
activity/eventprovider/{id} PATCH patch_eventprovider() patch_eventprovider()
activity/eventprovider/{id}/eventsources GET (list) get_eventsources() get_eventsources()
activity/eventprovider/{id}/eventsources POST post_eventsource() (existing) post_eventsource() (new)
activity/eventsource/{id} GET get_eventsource() get_eventsource()
activity/eventsource/{id} PATCH patch_eventsource() patch_eventsource()

Test Plan

  • 14 async tests (POST, GET list/detail, PATCH for providers and sources, plus error cases)
  • 14 sync tests (POST, GET list/detail, PATCH for providers and sources, plus error cases)
  • Full test suite passes (118 tests, 0 failures)

Jira

ERA-12664
[ERA-12664]: https://allenai.atlassian.net/browse/ERA-12664?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

Add full CRUD methods for event providers and event sources to both
sync (ERClient) and async (AsyncERClient) clients for parity:

Sync client:
- get_eventproviders(), get_eventprovider(), patch_eventprovider()
- get_eventsources(), get_eventsource(), patch_eventsource()

Async client:
- post_eventprovider(), post_eventsource()
- get_eventproviders(), get_eventprovider(), patch_eventprovider()
- get_eventsources(), get_eventsource(), patch_eventsource()

Includes 28 new tests covering success and error cases for all methods
across both clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JoshuaVulcan JoshuaVulcan added autoreviewing PR is currently being auto-reviewed and removed autoreviewing PR is currently being auto-reviewed labels Feb 11, 2026
@JoshuaVulcan JoshuaVulcan requested a review from a team as a code owner February 12, 2026 01:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CRUD parity for EarthRanger “event providers” and “event sources” across both ERClient (sync) and AsyncERClient (async), along with new pytest coverage for these endpoints.

Changes:

  • Add sync client methods: get_eventproviders, get_eventprovider, patch_eventprovider, get_eventsources, get_eventsource, patch_eventsource
  • Add async client methods: post_eventprovider, post_eventsource, plus the same GET/PATCH methods as sync
  • Add new async + sync test suites for event provider/source CRUD behaviors

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
erclient/client.py Adds new sync and async client methods for event provider/source GET/PATCH (+ async POST parity).
tests/sync_client/test_eventproviders.py New sync tests for provider/source POST/GET/PATCH flows.
tests/async_client/test_eventproviders.py New async tests for provider/source POST/GET/PATCH flows using respx.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

import pytest

from erclient.client import ERClient
from erclient import ERClientNotFound, ERClientPermissionDenied
Comment on lines +393 to +426
def get_eventproviders(self):
"""
Get a list of event providers.
:return: list of event provider dicts
"""
return self._get('activity/eventproviders')

def get_eventprovider(self, eventprovider_id):
"""
Get a single event provider by ID.
:param eventprovider_id: UUID of the event provider
:return: event provider data dict
"""
return self._get(f'activity/eventprovider/{eventprovider_id}')

def patch_eventprovider(self, eventprovider_id, payload):
"""
Update an event provider with partial data.
:param eventprovider_id: UUID of the event provider
:param payload: dict of fields to update
:return: updated event provider data dict
"""
self.logger.debug('Patching eventprovider %s: %s', eventprovider_id, payload)
result = self._patch(f'activity/eventprovider/{eventprovider_id}', payload=payload)
self.logger.debug('Result of eventprovider patch is: %s', result)
return result

def get_eventsources(self, eventprovider_id):
"""
Get the list of event sources for a given event provider.
:param eventprovider_id: UUID of the event provider
:return: list of event source dicts
"""
return self._get(f'activity/eventprovider/{eventprovider_id}/eventsources')
Comment on lines +1414 to +1448
async def get_eventproviders(self):
"""
Get a list of event providers.
:return: list of event provider dicts
"""
return await self._get('activity/eventproviders')

async def get_eventprovider(self, eventprovider_id):
"""
Get a single event provider by ID.
:param eventprovider_id: UUID of the event provider
:return: event provider data dict
"""
return await self._get(f'activity/eventprovider/{eventprovider_id}')

async def patch_eventprovider(self, eventprovider_id, payload):
"""
Update an event provider with partial data.
:param eventprovider_id: UUID of the event provider
:param payload: dict of fields to update
:return: updated event provider data dict
"""
self.logger.debug(f'Patching eventprovider {eventprovider_id}: {payload}')
result = await self._patch(f'activity/eventprovider/{eventprovider_id}', payload=payload)
self.logger.debug(f'Result of eventprovider patch is: {result}')
return result

async def get_eventsources(self, eventprovider_id):
"""
Get the list of event sources for a given event provider.
:param eventprovider_id: UUID of the event provider
:return: list of event source dicts
"""
return await self._get(f'activity/eventprovider/{eventprovider_id}/eventsources')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants