From cebd52c1cebefef9d5eb59df55990c9dbc380650 Mon Sep 17 00:00:00 2001 From: Matthieu Quantin Date: Tue, 19 Mar 2024 15:00:11 +0100 Subject: [PATCH 1/2] get template id feature --- api.ipynb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api.ipynb b/api.ipynb index 74a9d3f..f58d878 100644 --- a/api.ipynb +++ b/api.ipynb @@ -206,6 +206,20 @@ " if resource:\n", " return resource['o:id']\n", "\n", + " def get_template_id(self, label):\n", + " '''\n", + " Get the numeric identifier associated with the supplied template label.\n", + "\n", + " Parameters:\n", + " * `label` - template label used in the omeka instance (eg: 'creation')\n", + "\n", + " Returns:\n", + " * numeric identifier\n", + " '''\n", + " resource = self.get_template_by_label(label)\n", + " if resource:\n", + " return resource['o:id']\n", + "\n", " def filter_items(self, params, **extra_filters):\n", " for filter_type in ['resource_template_id', 'resource_class_id', 'item_set_id', 'is_public']:\n", " filter_value = extra_filters.get(filter_type)\n", From 1b63c8249dbb1f6ce0e0e2aef64a615523dc9ba3 Mon Sep 17 00:00:00 2001 From: Matthieu Quantin Date: Tue, 19 Mar 2024 15:01:47 +0100 Subject: [PATCH 2/2] get template id --- omeka_s_tools/api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/omeka_s_tools/api.py b/omeka_s_tools/api.py index bb56cbe..1fe23eb 100644 --- a/omeka_s_tools/api.py +++ b/omeka_s_tools/api.py @@ -167,6 +167,20 @@ def get_property_id(self, term): resource = self.get_resource_by_term(term=term) if resource: return resource['o:id'] + + def get_template_id(self, label): + ''' + Get the numeric identifier associated with the supplied template label. + + Parameters: + * `label` - template label used in the omeka instance (eg: 'creation') + + Returns: + * numeric identifier + ''' + resource = self.get_template_by_label(label) + if resource: + return resource['o:id'] def filter_items(self, params, **extra_filters): for filter_type in ['resource_template_id', 'resource_class_id', 'item_set_id', 'is_public']: