Skip to content

Enhance DSpaceClient with DSpace Item API Functions #43

@mdwRepository

Description

@mdwRepository

The DSpaceClient class can be extended to include several new methods to interact with the DSpace Item API as documented in https://github.com/DSpace/RestContract/blob/main/items.md. These methods provide functionality for managing item relationships, access status, metrics, owning collections, and mapped collections.

Functions:

  1. get_item_metrics
  • Fetches metrics for a specified item.
  • Handles network errors and API response status codes.
  1. get_item_thumbnail
  • Retrieves the thumbnail of an item, if available.
  • Handles the following status codes:
    - 200 OK: Returns the thumbnail.
    - 204 No Content: Indicates no thumbnail is available.
    - 401 Unauthorized: Logs insufficient authentication.
    - 403 Forbidden: Logs insufficient permissions.
    - 404 Not Found: Logs that the item or thumbnail is missing.
  1. get_item_owning_collection
  • Retrieves the owning collection for a specified item.
  • Handles errors when the item or owning collection cannot be retrieved.
  1. update_item_owning_collection
  • Updates the owning collection of a specified item.
  • Handles the following status codes:
    - 204 No Content: Indicates success.
    - 403 Forbidden: Logs insufficient permissions or CSRF token issues.
    - Other: Logs any unexpected response.
  1. get_item_mapped_collections
  • Retrieves all mapped collections for a specified item.
  • Handles error codes like 401, 403, 405, and 422.
  1. add_item_mapped_collection
  • Adds a new mapping between an item and a collection.
  • Handles appropriate API response codes and errors.
  1. delete_item_mapped_collection
  • Removes a mapping between an item and a collection.
  • Handles response codes for authentication, permissions, and entity processing.
  1. get_item_relationships
  • Retrieves relationships of an item.
  • Handles response parsing and error logging.
  1. get_item_access_status
  • Fetches the access status of an item.
  • Manages API responses for invalid parameters, missing items, and more.

Benefits:

  • Provides a comprehensive interface for interacting with DSpace items.
  • Improves error handling and robustness in API interactions.
  • Aligns the client with the latest DSpace REST API specifications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions