A TypeScript library for accessing the Clickhouse Cloud REST API. This library can be used in both Node.js and web browser environments.
npm install @cleverbrush/clickhouse-cloud-api-client
import { ClickhouseCloudApiClient } from "@cleverbrush/clickhouse-cloud-api-client";
const client = new ClickhouseCloudApiClient("your-key-id", "your-key-secret");
Note: Currently, this library supports only a few methods that were personally needed. If you require additional functionality, feel free to contribute by adding more methods from the Clickhouse Cloud API.
Retrieves details of a specific service.
const serviceDetails = await client.getServiceDetails(
"organization-id",
"service-id",
);
Updates the scaling configuration of a specific service.
const updatedService = await client.updateServiceScaling(
"org-id",
"service-id",
{
minTotalMemoryGb: 8,
maxTotalMemoryGb: 16,
},
);
Wakes up a service that is in an idle state.
const awakenedService = await client.wakeUpService("org-123", "service-456");
All methods return a promise that resolves with a ClickhouseCloudApiResponse<T>
object, where T
is the specific type of data returned (e.g., ServiceDetails
).
For detailed type information, please refer to the source code.
The client will throw an error if the HTTP request fails or returns a non-OK status code. Make sure to wrap your calls in try-catch blocks for proper error handling.
try {
const serviceDetails = await client.getServiceDetails(
"org-123",
"service-456",
);
} catch (error) {
console.error("Failed to get service details:", error);
}
Contributions are welcome! If you need additional functionality from the Clickhouse Cloud API, please feel free to submit a Pull Request adding new methods to the client.
This project is licensed under the BSD-3-Clause License.