Async Dashboard

This module provides functionality for working with async dashboards.

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

Bases: AsyncBase

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

Initialize a Dashboard instance.

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

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

  • data (Dict, optional) – The data of the Dashboard.

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

[async] Get list of Dashboards

Parameters:

api (AsyncGeoboxClient) – The AsyncGeoboxClient instance for making requests.

Keyword Arguments:
  • 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 Dashboards. default is False.

Returns:

A list of Dashboard instances or the total number of Dashboards.

Return type:

List[AsyncDashboard] | int

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboards = await AsyncDashboard.get_dashboards(client)
or
>>>     dashboards = await client.get_dashboards()
async classmethod create_dashboard(api, name, display_name=None, description=None, settings={}, thumbnail=None, user_id=None)[source]

[async] Create a new Dashboard.

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

  • name (str) – The name of the Dashboard.

  • display_name (str, optional) – The display name of the Dashboard.

  • description (str, optional) – The description of the Dashboard.

  • settings (Dict, optional) – The settings of the sceDashboarde.

  • thumbnail (str, optional) – The thumbnail of the Dashboard.

  • user_id (int, optional) – Specific user. privileges required.

Returns:

The newly created Dashboard instance.

Return type:

AsyncDashboard

Raises:

ValidationError – If the Dashboard data is invalid.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.create_dashboard(client, name="my_dashboard")
or
>>>     dashboard = await client.create_dashboard(name="my_dashboard")
async classmethod get_dashboard(api, uuid, user_id=None)[source]

[async] Get a Dashboard by its UUID.

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

  • uuid (str) – The UUID of the Dashboard to get.

  • user_id (int, optional) – Specific user. privileges required.

Returns:

The dashboard object.

Return type:

AsyncDashboard

Raises:

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

Example

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

[async] Get a dashboard by name

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

  • name (str) – the name of the dashboard to get

  • user_id (int, optional) – specific user. privileges required.

Returns:

returns the dashboard if a dashboard matches the given name, else None

Return type:

AsyncDashboard | None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard_by_name(client, name='test')
or
>>>     dashboard = await client.get_dashboard_by_name(name='test')
async update(**kwargs)[source]

[async] Update the Dashboard

Keyword Arguments:
  • name (str) – The name of the Dashboard.

  • display_name (str) – The display name of the Dashboard.

  • description (str) – The description of the Dashboard.

  • settings (Dict) – The settings of the Dashboard.

  • thumbnail (str) – The thumbnail of the Dashboard.

Returns:

The updated Dashboard data.

Return type:

Dict

Raises:

ValidationError – If the Dashboard data is invalid.

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await dashboard.update(display_name="New Display Name")
async delete()[source]

[async] Delete the dashboard.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await dashboard.delete()
property thumbnail: str

Get the thumbnail URL of the dashboard.

Returns:

The thumbnail of the dashboard.

Return type:

str

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     dashboard.thumbnail
async share(users)[source]

[async] Shares the Dashboard with specified users.

Parameters:

users (List[AsyncUser]) – The list of user objects to share the Dashboard with.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await dashboard.share(users=users)
async unshare(users)[source]

[async] Unshares the Dashboard with specified users.

Parameters:

users (List[AsyncUser]) – The list of user objects to unshare the Dashboard with.

Returns:

None

Return type:

None

Example

>>> from geobox.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     users = await client.search_users(search='John')
>>>     await dashboard.unshare(users=users)
async get_shared_users(search=None, skip=0, limit=10)[source]

[async] Retrieves the list of users the dashboard 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.aio import AsyncGeoboxClient
>>> from geobox.aio.dashboard import AsyncDashboard
>>> async with AsyncGeoboxClient() as client:
>>>     dashboard = await AsyncDashboard.get_dashboard(client, uuid="12345678-1234-5678-1234-567812345678")
>>>     await dashboard.get_shared_users(search='John', skip=0, limit=10)