A TypeScript SDK for the Spectro Cloud Palette API. This package provides a comprehensive set of functions to manage Kubernetes clusters, applications, and cloud resources through the Palette API.
[!WARNING] This is an experimental SDK and subject to change.
- Complete API Coverage: All Palette API endpoints are supported
- Comprehensive TypeScript Support: Full type definitions for all API requests and responses.
-
No Type Casting Required: Clean, typed API calls without
any
casting - Fetch-based: Built on the modern Fetch API
- Tree-shakable: Import only the functions you need
npm install palette-sdk-typescript
[!IMPORTANT] This package is published as TypeScript source code. You'll need TypeScript in your project to use it. If you're using JavaScript, you may need to configure your build tools to handle TypeScript files.
- Node.js 22 or higher
- TypeScript 5.5 or higher
- A Palette API key and project UID
To use the Palette API, you need an API key. Check the Create API Key guide for more information.
Set the API key as an environment variable:
export PALETTE_API_KEY="your-api-key-here"
export PROJECT_UID="your-project-uid-here"
Import the specific API functions and types you need.
import {
spectroClustersMetadataGet,
setPaletteBaseUrl,
getPaletteBaseUrl,
type SpectroClustersMetadata,
} from "palette-sdk-typescript";
// Configure custom base URL (optional)
// By default, the SDK uses https://api.spectrocloud.com
// Set a custom URL if you have a different Palette instance
setPaletteBaseUrl("https://your-palette-host.com");
// Configure authentication
const config = {
headers: {
ApiKey: process.env.PALETTE_API_KEY,
"Content-Type": "application/json",
ProjectUID: process.env.PROJECT_UID, // Optional, for project-scoped requests
},
};
// Get all clusters
const response: SpectroClustersMetadata = await spectroClustersMetadataGet(
{}, // no filter params provided in this example
config
);
if (response.items && response.items.length > 0) {
console.log("First cluster metadata:", response.items[0]);
}
If a project UID is not specified, then the Palette API will use the tenant scope. Keep this in mind when using the SDK. There may be some cases where you want to use the tenant scope.
By default, the PaletteSDK targets https://api.spectrocloud.com
. If you have a different Palette instance, such as a self-hosted Palette instance, you can configure the base URL.
import { setPaletteBaseUrl, getPaletteBaseUrl } from "palette-sdk-typescript";
// Set custom base URL
setPaletteBaseUrl("https://your-palette-host.com");
The SDK will now use your custom URL for all API calls.
You can also check what the current base URL is by calling getPaletteBaseUrl()
.
const currentUrl = getPaletteBaseUrl();
console.log("Current base URL:", currentUrl);
This SDK is generated from the Palette OpenAPI specification. To contribute:
- Fork the repository
- Make your changes
- Run tests:
npm test
- Submit a pull request
- Node.js 22 or higher
- Python 3.10 or higher
- Make
- Copywrite
- Docker
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
For issues and questions:
- SDK Issues: Open an issue on GitHub
- API Documentation: Visit the Palette API Documentation
- Palette Support: Contact Spectro Cloud support