anatools.anaclient.graphs module

Graphs Functions

delete_graph(self, graphId, workspaceId=None)

Delete a graph in a workspace.

Parameters
  • graphId (str) – Graph id to delete.

  • workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.

Returns

A success or error message based on graph’s delete.

Return type

str

download_graph(self, graphId, filepath=None, workspaceId=None)

Downloads a graph and save it to a file. If filepath is provided, the graph will get saved to that location.

Parameters
  • graphId (str) – Graph ID of the graph to download.

  • filepath (str) – Filepath to save the graph to. Optional.

  • workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the default workspace will get used.

Returns

The filepath of the downloaded graph.

Return type

str

edit_graph(self, graphId, name=None, description=None, graph=None, tags=None, workspaceId=None)

Update graph description and name.

Parameters
  • graphId (str) – Graph id to update.

  • name (str) – New name to update.

  • description (str) – New description to update.

  • graph (str) – New graph to update.

  • tags (list[str]) – New tags to update.

  • workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.

Returns

If True, the graph was successfully edited.

Return type

bool

get_default_graph(self, channelId, filepath=None)

Downlaosd the default graph for a channel.

Parameters
  • channelId – Id of channel to get the default graph for.

  • filepath (str) – Filepath to save the graph to. Optional.

Returns

The filepath of the downloaded graph.

Return type

str

get_graphs(self, graphId=None, workspaceId=None, staged=False, cursor=None, limit=None, filters=None, fields=None)

Queries the workspace graphs based off provided parameters. If the workspaceId isn’t specified, the current workspace will get used.

Parameters
  • graphid (str) – GraphID to filter on. Optional.

  • workspaceId (str) – Workspace ID to filter on. If none is provided, the default workspace will get used.

  • staged (bool) – If true, returns only graphs that are staged.

  • cursor (str) – Cursor for pagination.

  • limit (int) – Maximum number of graphs to return.

  • filters (dict) – Filters that limit output to entries that match the filter

  • fields (list) – List of fields to return, leave empty to get all fields.

Returns

A list of graphs based off provided query parameters if any parameters match.

Return type

list[dict]

set_default_graph(self, graphId, workspaceId=None)

Sets the default graph for a channel. User must be in the organization that owns the channel.

Parameters
  • graphId (str) – The ID of the graph that you want to be the default for the channel

  • workspaceId (str) – The ID of the Workspace that the graph is in.

Returns

If True, the graph was successfully set as the default graph for the channel.

Return type

bool

upload_graph(self, graph, channelId, name, description=None, staged=True, workspaceId=None)

Uploads a new graph based off provided parameters.

Parameters
  • graph (str) – The graph as filepath, or python dictionary.

  • channelId (str) – Id of channel to generate the graph with.

  • name (str) – Name for the graph that will get generated.

  • description (str) – Description of graph. Optional.

  • staged (bool) – If true, the graph will get staged (read-only).

  • workspaceId (str) – Workspace ID create the graph in. If none is provided, the default workspace will get used.

Returns

The graphId if it was uploaded sucessfully.

Return type

str