Skip to content

feat(items): wrap GET totalusercopyrights endpoint#192

Closed
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:feat/item-user-copyrights
Closed

feat(items): wrap GET totalusercopyrights endpoint#192
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:feat/item-user-copyrights

Conversation

@Valyrian-Code

@Valyrian-Code Valyrian-Code commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Refs #52.

Adds Items.item_user_copyrights() for GET /uploads/{id}/item/{itemId}/totalusercopyrights, mirroring the existing item_copyrights().

Closed: this endpoint is API 1.6.2 / master-only and does not exist in fossology 4.4.0 (the version CI pins), so it 404s there. Will revisit when the CI target includes it.

Refs fossology#52.

Adds Items.item_user_copyrights() for
GET /uploads/{id}/item/{itemId}/totalusercopyrights, the user-findings
counterpart to the existing item_copyrights() (totalcopyrights). It mirrors
that method exactly, including the {active,inactive} status query param and
the int return type.

Validated against the OpenAPI spec (API 1.6.2 / Fossology 4.4.0). Tests
mirror the existing totalcopyrights coverage: live happy path, unknown-item
404, and a mocked 500 error path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
Copilot AI review requested due to automatic review settings July 1, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support in the Python wrapper for the Fossology REST API endpoint that returns the total user copyright findings for an upload-tree item (GET /uploads/{id}/item/{itemId}/totalusercopyrights), mirroring the existing totalcopyrights wrapper.

Changes:

  • Add Items.item_user_copyrights() wrapper method (including status={active,inactive} query param) returning an int.
  • Add integration + mocked error-path tests mirroring existing item_copyrights() coverage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
fossology/items.py Adds the new item_user_copyrights() API wrapper alongside item_copyrights().
tests/test_items.py Adds tests for happy path, 404 handling, and a mocked 500 error for the new endpoint.

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

Comment thread fossology/items.py
Comment on lines +100 to +104
:param status: the status of the copyrights
:type upload: Upload
:type item_id: int,
:type status: CopyrightStatus
:return: the total number of user copyright findings for the uploadtree item
@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Closing this after verifying against the fossology 4.4.0 container that CI pins (API 1.6.1): GET /uploads/{id}/item/{itemId}/totalusercopyrights does not exist there — it's an API 1.6.2 (master) endpoint, so the integration test 404s (Unable to find the path). I'll re-open once the CI target includes it. The existing totalcopyrights (item_copyrights()) is unaffected.

@Valyrian-Code Valyrian-Code deleted the feat/item-user-copyrights branch July 1, 2026 17:03
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