Connections
Connections
toothfairyai@latest…Manager for connections (Hosting) operations.
This manager provides methods to create, update, and manage connections (Hostings). Note: In the API, /connection/* endpoints map to Hosting entities.
Example:
>>> client = ToothFairyClient(api_key="...", workspace_id="...")
>>> connection = client.connections.create(
... name="OpenAI Connection",
... type="openai",
... endpoint="https://api.openai.com",
... )
Accessed via client.connections.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /connection/create |
update | POST | POST /connection/update |
delete | DELETE | DELETE /connection/delete/{connection_id} |
get | GET | GET /connection/get/{connection_id} |
list | GET | GET /connection/list |
get_by_type | — | derived |
search | — | derived |
create
Create a new connection (Hosting).
def create(
name: str,
type: HostingTypeRequest,
endpoint: Optional[str] = None,
model_name: Optional[str] = None,
base_model: Optional[str] = None,
custom_model: bool = False,
api_version: Optional[str] = None,
token_secret: Optional[str] = None,
description: Optional[str] = None
) -> Hosting
Endpoint: POST /connection/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier for the connection |
workspaceid | string | yes | Your workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually. |
name | string | yes | Name of the resource |
description | string | no | Connection description |
type | string | yes | Connection type (database, API, etc.) |
Allowed: sql, oracle, mysql, postgressql |
| host | string | yes | Database host address |
| port | integer | yes | Database port number (1-65535) |
| username | string | yes | Connection username |
| passwordSecret | string | yes | Encrypted password reference |
| database | string | no | Database name |
| schema | string | no | Database schema name |
| ssl | boolean | no | Whether to use SSL connection |
| ssh | boolean | no | Whether to use SSH tunnel |
| sshHost | string | no | SSH host address |
| sshPort | integer | no | SSH tunnel port number (1-65535) |
| sshUsername | string | no | SSH tunnel username |
| sshPasswordSecret | string | no | SSH password reference |
The Python SDK accepts
snake_casekeyword arguments and converts them to thecamelCasewire fields shown above.
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the connection |
name | string | Name of the resource |
description | string | Connection description |
type | string | Connection type (database, API, etc.) |
host | string | Database host address |
port | string | Database port number (1-65535) |
username | string | Connection username |
passwordSecret | string | Encrypted password reference |
database | string | Database name |
schema | string | Database schema name |
ssl | boolean | Whether to use SSL connection |
ssh | boolean | Whether to use SSH tunnel |
sshHost | string | SSH host address |
sshPort | string | SSH tunnel port number (1-65535) |
sshUsername | string | SSH tunnel username |
sshPasswordSecret | string | SSH password reference |
workspaceID | string | Unique workspace identifier (UUID v4) |
createdBy | string | User ID who created the connection |
updatedBy | string | User ID who last updated the connection |
createdAt | string | Timestamp when this resource was created |
updatedAt | string | Timestamp when this resource was last updated |
Example
client.connections.create(name="…", type=…)
update
Update a connection (Hosting).
def update(connection_id: str) -> Hosting
Endpoint: POST /connection/update
Field-level schema not available in the API spec for this endpoint.
Example
client.connections.update(connection_id="agent-id")
delete
Delete a connection.
def delete(connection_id: str) -> Dict[str, bool]
Endpoint: DELETE /connection/delete/{connection_id} · API service
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Operation success status |
data | object | Response data |
message | string | Optional success message |
Example
client.connections.delete(connection_id="agent-id")
get
Get a connection by ID.
def get(connection_id: str) -> Hosting
Endpoint: GET /connection/get/{connection_id} · API service
Response
Returns the Connection object — fields documented in the create section above.
Example
client.connections.get(connection_id="agent-id")
list
List all connections.
def list(
limit: Optional[int] = None,
offset: Optional[int] = None
) -> ListResponse
Endpoint: GET /connection/list · API service
Example
client.connections.list()
get_by_type
Get connections by hosting type.
def get_by_type(hosting_type: HostingType) -> List[Hosting]
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
client.connections.get_by_type(hosting_type=…)
search
Search connections by name.
def search(search_term: str) -> List[Hosting]
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
client.connections.search(search_term="…")