diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst index 4b9a86922..0badbf4f6 100644 --- a/docs/source/plugins.rst +++ b/docs/source/plugins.rst @@ -306,11 +306,11 @@ The below template provides a minimal example (let's call the file ``mycooledrda self.covjson = {...} - def get_instances(self): + def instances(self): return ['foo', 'bar'] - def get_instance(self, instance): - return instance in get_instances() + def instance(self, instance): + return instance in instances() def position(self, **kwargs): return self.covjson @@ -320,8 +320,8 @@ The below template provides a minimal example (let's call the file ``mycooledrda For brevity, the ``position`` function returns ``self.covjson`` which is a -dictionary of a CoverageJSON representation. ``get_instances`` returns a list -of instances associated with the collection/plugin, and ``get_instance`` returns +dictionary of a CoverageJSON representation. ``instances`` returns a list +of instances associated with the collection/plugin, and ``instance`` returns a boolean of whether a given instance exists/is valid. EDR query types are subject to the query functions defined in the plugin. In the example above, the plugin implements ``position`` and ``trajectory`` queries, which will be advertised as diff --git a/pygeoapi/api/environmental_data_retrieval.py b/pygeoapi/api/environmental_data_retrieval.py index 6f2ed36bb..98a77cc2a 100644 --- a/pygeoapi/api/environmental_data_retrieval.py +++ b/pygeoapi/api/environmental_data_retrieval.py @@ -113,14 +113,14 @@ def get_collection_edr_instances(api: API, request: APIRequest, if instance_id is not None: try: - if p.get_instance(instance_id): + if p.instance(instance_id): instances = [instance_id] except ProviderItemNotFoundError: msg = 'Instance not found' return api.get_exception( HTTPStatus.NOT_FOUND, headers, request.format, 'NotFound', msg) else: - instances = p.get_instances() + instances = p.instances() for instance in instances: instance_dict = { @@ -281,7 +281,7 @@ def get_collection_edr_query(api: API, request: APIRequest, err.http_status_code, headers, request.format, err.ogc_exception_code, err.message) - if instance is not None and not p.get_instance(instance): + if instance is not None and not p.instance(instance): msg = 'Invalid instance identifier' return api.get_exception( HTTPStatus.BAD_REQUEST, headers, diff --git a/pygeoapi/provider/base_edr.py b/pygeoapi/provider/base_edr.py index 01b1602b6..08c30df9b 100644 --- a/pygeoapi/provider/base_edr.py +++ b/pygeoapi/provider/base_edr.py @@ -78,7 +78,7 @@ def __init_subclass__(cls, **kwargs): 'but requests will be routed to a feature provider' ) - def get_instances(self): + def instances(self): """ Get a list of instance identifiers @@ -87,7 +87,7 @@ def get_instances(self): return NotImplementedError() - def get_instance(self, instance): + def instance(self, instance): """ Validate instance identifier