Async Version

The async Version module provides functionality for working with versions.

class AsyncVectorLayerVersion(api, uuid, data={})[source]

Bases: AsyncBase

Parameters:
BASE_ENDPOINT = 'vectorLayerVersions/'
__init__(api, uuid, data={})[source]

Initialize a vector layer version instance.

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

  • uuid (str) – The unique identifier for the version.

  • data (Dict) – The data of the version.

async classmethod get_versions(api, **kwargs)[source]

[async] Get list of versions with optional filtering and pagination.

Parameters:

api (AsyncGeoboxClient) – The AsyncGeoboxClient 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[AsyncVectorLayerVersion] | int

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     versions = await AsyncVectorLayerVersion.get_versions(client, q="name LIKE '%My version%'")
or
>>>     versions = await client.get_versions(q="name LIKE '%My version%'")
async classmethod get_version(api, uuid, user_id=None)[source]

[async] Get a version by its UUID.

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient 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:

AsyncVectorLayerVersion

Raises:

NotFoundError – If the version with the specified UUID is not found.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
or
>>>     version = await client.get_version(uuid="12345678-1234-5678-1234-567812345678")
async classmethod get_version_by_name(api, name, user_id=None)[source]

[async] Get a version by name

Parameters:
  • api (AsyncGeoboxClient) – The AsyncGeoboxClient 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:

AsyncVectorLayerVersion | None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await VectorLayerView.get_version_by_name(client, name='test')
or
>>>     version = await client.get_version_by_name(name='test')
async update(**kwargs)[source]

[async] 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.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await version.update_version(display_name="New Display Name")
async delete()[source]

[async] Delete the version.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await version.delete()
async share(users)[source]

[async] 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.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await version.share(users=users)
async unshare(users)[source]

[async] 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.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await version.unshare(users=users)
async get_shared_users(search=None, skip=0, limit=10)[source]

[async] 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[AsyncUser]

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.version import AsyncVectorLayerVersion
>>> async with AsyncGeoboxClient() as client:
>>>     version = await AsyncVectorLayerVersion.get_version(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await version.get_shared_users(search='John', skip=0, limit=10)