iiif-prezi / iiif-prezi3

IIIF Presentation API 3 Python Library
https://iiif-prezi.github.io/iiif-prezi3/
Apache License 2.0
28 stars 14 forks source link

Allow setting intermediary `id` properties with multi-level helpers #111

Closed digitaldogsbody closed 1 year ago

digitaldogsbody commented 1 year ago

The add_image helper allows passing in ID fields for the intermediate AnnotationPage and Annotation objects.

This is quite a nice pattern and allows avoiding the following:

canvas = manifest.create_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
                               id="https://iiif.io/api/cookbook/recipe/0005-image-service/canvas/p1",
                               label="Canvas with a single IIIF image")
manifest.add_item(canvas)
canvas.items[0].id = "https://iiif.io/api/cookbook/recipe/0005-image-service/page/p1/1"
canvas.items[0].items[0].id = "https://iiif.io/api/cookbook/recipe/0005-image-service/annotation/p0001-image"

We should consider extending this pattern into other helpers that add intermediate objects (such as the create_canvas_from_iiif helper above)

digitaldogsbody commented 1 year ago

Other instance is annotation_helpers.py (which also should probably take **kwargs)