Version
The Version module provides functionality for working with versions.
- class VectorLayerVersion(api, uuid, data={})[source]
Bases:
Base- Parameters:
api (GeoboxClient)
uuid (str)
data (Dict | None)
- BASE_ENDPOINT = 'vectorLayerVersions/'
- __init__(api, uuid, data={})[source]
Initialize a vector layer version instance.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
uuid (str) – The unique identifier for the version.
data (Dict) – The data of the version.
- classmethod get_versions(api, **kwargs)[source]
Get list of versions with optional filtering and pagination.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
- Keyword Arguments:
layer_id (str) – the id of the vector layer.
q (str) – query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01’”
search (str) – search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
search_fields (str) – comma separated list of fields for searching.
order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: “A” denotes ascending order and “D” denotes descending order.
return_count (bool) – Whether to return total count. default is False.
skip (int) – Number of items to skip. default is 0.
limit (int) – Number of items to return. default is 10.
user_id (int) – Specific user. privileges required.
shared (bool) – Whether to return shared versions. default is False.
- Returns:
A list of vector layer version instances or the total number of versions.
- Return type:
List[VectorLayerVersion] | int
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> versions = VectorLayerVersion.get_versions(client, q="name LIKE '%My version%'") or >>> versions = client.get_versions(q="name LIKE '%My version%'")
- classmethod get_version(api, uuid, user_id=None)[source]
Get a version by its UUID.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
uuid (str) – The UUID of the version to get.
user_id (int, optional) – Specific user. privileges required.
- Returns:
The vector layer version object.
- Return type:
- Raises:
NotFoundError – If the version with the specified UUID is not found.
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") or >>> version = client.get_version(uuid="12345678-1234-5678-1234-567812345678")
- classmethod get_version_by_name(api, name, user_id=None)[source]
Get a version by name
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
name (str) – the name of the version to get
user_id (int, optional) – specific user. privileges required.
- Returns:
returns the version if a version matches the given name, else None
- Return type:
VectorLayerVersion | None
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerView.get_version_by_name(client, name='test') or >>> version = client.get_version_by_name(name='test')
- update(**kwargs)[source]
Update the version.
- Parameters:
name (str) – The name of the version.
display_name (str) – The display name of the version.
description (str) – The description of the version.
- Returns:
The updated version data.
- Return type:
Dict
- Raises:
ValidationError – If the version data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") >>> version.update_version(display_name="New Display Name")
- delete()[source]
Delete the version.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") >>> version.delete()
Shares the version with specified users.
- Parameters:
users (List[User]) – The list of user objects to share the version with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> version.share(users=users)
Unshares the version with specified users.
- Parameters:
users (List[User]) – The list of user objects to unshare the version with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> version.unshare(users=users)
Retrieves the list of users the version is shared with.
- Parameters:
search (str, optional) – The search query.
skip (int, optional) – The number of users to skip.
limit (int, optional) – The maximum number of users to retrieve.
- Returns:
The list of shared users.
- Return type:
List[User]
Example
>>> from geobox import GeoboxClient >>> from geobox.version import VectorLayerVersion >>> client = GeoboxClient() >>> version = VectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678") >>> version.get_shared_users(search='John', skip=0, limit=10)