Connector Endpoint API
api_create_endpoint(name, connector_type, uri, token, max_calls_per_second, max_concurrency, params)
Creates a new connector endpoint.
This function creates a new connector endpoint with the specified parameters. It initializes a ConnectorEndpointArguments instance and then uses the ConnectorEndpoint class to create the endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the endpoint. |
required |
connector_type |
str
|
The type of the connector. |
required |
uri |
str
|
The URI for the connector. |
required |
token |
str
|
The token for authentication with the connector. |
required |
max_calls_per_second |
int
|
The maximum number of calls allowed per second. |
required |
max_concurrency |
int
|
The maximum number of concurrent calls allowed. |
required |
params |
dict
|
Additional parameters for the connector. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ID of the newly created connector endpoint. |
Source code in moonshot/src/api/api_connector_endpoint.py
api_delete_endpoint(ep_id)
Deletes an endpoint from the connector manager.
This function deletes an endpoint from the connector manager using the provided endpoint ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ep_id |
str
|
The ID of the endpoint to delete. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the deletion was successful. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the endpoint with the given ID does not exist or the deletion failed. |
Source code in moonshot/src/api/api_connector_endpoint.py
api_get_all_endpoint()
Retrieves a list of all available endpoints.
This function calls the ConnectorManager's get_available_endpoints method to retrieve a list of all available endpoints and their details. It then converts each ConnectorEndpointArguments object into a dictionary for easier consumption by the caller.
Returns:
Type | Description |
---|---|
list[dict]
|
list[dict]: A list of dictionaries, each representing an endpoint's details. |
Source code in moonshot/src/api/api_connector_endpoint.py
api_get_all_endpoint_name()
Retrieves a list of all endpoint names.
This function calls the ConnectorManager's get_available_endpoints method to retrieve a list of all available endpoint names. It extracts the names from the tuple returned by get_available_endpoints, which contains a list of endpoint names and a list of ConnectorEndpointArguments objects.
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A list of endpoint names. |
Source code in moonshot/src/api/api_connector_endpoint.py
api_read_endpoint(ep_id)
Reads an endpoint from the connector manager.
This function reads an endpoint from the connector manager using the provided endpoint ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ep_id |
str
|
The ID of the endpoint to read. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary containing the endpoint information. |
Source code in moonshot/src/api/api_connector_endpoint.py
api_update_endpoint(ep_id, **kwargs)
Updates an existing endpoint with new values.
This function updates an existing endpoint in the connector manager using the provided endpoint ID and keyword arguments.
Each keyword argument corresponds to an attribute of the endpoint that should be updated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ep_id |
str
|
The ID of the endpoint to update. |
required |
**kwargs |
Arbitrary keyword arguments representing the attributes to update. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the update was successful. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the endpoint with the given ID does not exist or the update failed. |