Skip to content

Add add_subjects_to_subjectgroup to AsyncERClient#49

Merged
chrisdoehring merged 4 commits intomainfrom
feat/add-subjects-to-subjectgroup
Mar 17, 2026
Merged

Add add_subjects_to_subjectgroup to AsyncERClient#49
chrisdoehring merged 4 commits intomainfrom
feat/add-subjects-to-subjectgroup

Conversation

@victorlujanearthranger
Copy link
Copy Markdown
Contributor

@victorlujanearthranger victorlujanearthranger commented Mar 13, 2026

Adds three new methods to AsyncERClient:

add_subjects_to_subjectgroup posts to /subjectgroup/{id}/subjects/ to add a list of subjects to a subject group.

delete_subject and delete_source send DELETE requests to /subject/{id}/ and /source/{id}/ respectively. Both are irreversible — deleted records lose all linked observation history in EarthRanger.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
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

This PR adds a new add_subjects_to_subjectgroup method to the AsyncERClient class, enabling users to add subjects to a subject group via a POST request to the subjectgroup/{group_id}/subjects/ endpoint.

Changes:

  • Added add_subjects_to_subjectgroup(group_id, subjects) async method to AsyncERClient in client.py
  • Added comprehensive test coverage for the new method, including success and error-handling scenarios (404, 401, 403, 500)

Reviewed changes

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

File Description
erclient/client.py New add_subjects_to_subjectgroup async method that POSTs subjects to a subject group endpoint
tests/async_client/test_add_subjects_to_subjectgroup.py New test file with 5 tests covering success and HTTP error responses

💡 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.

Copy link
Copy Markdown
Contributor

@chrisdoehring chrisdoehring left a comment

Choose a reason for hiding this comment

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

@victorlujanearthranger I added a remove function and added to the sync version for parity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@victorlujanearthranger victorlujanearthranger marked this pull request as ready for review March 17, 2026 21:43
@victorlujanearthranger victorlujanearthranger requested a review from a team as a code owner March 17, 2026 21:43
@chrisdoehring chrisdoehring merged commit f84f4a0 into main Mar 17, 2026
4 checks passed
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.

3 participants