Tools API.¶
The DeepOriginClient can be used to access the tools API using:
from deeporigin.platform.client import DeepOriginClient
client = DeepOriginClient()
Then, the following methods can be used, for example:
tools = client.tools.list() # every version of every tool
enabled_tools = client.tools.list(enabled=True) # enabled versions only
src.platform.tools.Tools
¶
Tools API wrapper.
Provides access to tools-related endpoints through the DeepOriginClient.
Methods:¶
exists
¶
exists(*, tool_key: str, tool_version: str) -> bool
Return whether a tool version pin resolves to an enabled definition.
The platform resolves tool_version at request time: exact semver
("3.2.3"), major-only ("1" → latest 1.x.x), or "latest".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_key
|
str
|
Tool identifier. |
required |
tool_version
|
str
|
Version pin accepted by the platform tools API. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
get
¶
get(*, tool_key: str, tool_version: str) -> dict
Return a single tool definition for the given key and version.
Uses GET /tools/protected/tools/{toolKey}/{toolVersion}/definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_key
|
str
|
Tool identifier. |
required |
tool_version
|
str
|
Exact version string to match. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Tool definition dict (includes |
get_by_key
¶
get_by_key(*, tool_key: str) -> list[dict]
Get all versions of a tool definition by tool key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_key
|
str
|
The key of the tool to get the definitions for. |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of tool definition dictionaries for all versions of the tool. |
list
¶
list(*, enabled: bool | None = None) -> list[dict]
List tool definitions, every version of every tool by default.
Reads the v2 list (Accept: application/json;v=2.0), which answers
{"count": n, "data": [...]} one page at a time, and follows the pages
until count rows are read. A platform without the v2 list answers with
the whole registry as a bare array and ignores paging and filters; that
array is used as is, so the result is the same on either platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of tool definition dictionaries from the API. |