testkube-sdk
v2.3.5
Published
<!-- Start SDK Installation [installation] --> ## SDK Installation
Downloads
8
Readme
testkube-sdk
SDK Installation
NPM
npm add testkube-sdk
Yarn
yarn add testkube-sdk
SDK Example Usage
Example
import { TestkubeSDK } from "testkube-sdk";
async function run() {
const sdk = new TestkubeSDK();
const res = await sdk.api.abortExecution({
executionID: "<value>",
id: "<id>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Available Resources and Operations
api
- abortExecution - Aborts execution
- abortTestExecutions - Abort all executions of a test
- abortTestSuiteExecution - Aborts testsuite execution
- abortTestSuiteExecutionByID - Aborts testsuite execution
- abortTestSuiteExecutions - Abort all executions of a test suite
- bulkUpdateTestTriggers - Bulk update test triggers
- createExecutorJson - Create new executor
- createExecutorString - Create new executor
- createTestSourceJson - Create new test source
- createTestSourceString - Create new test source
- createTestSuiteJson - Create new test suite
- createTestSuiteString - Create new test suite
- createTestTriggerJson - Create new test trigger
- createTestTriggerString - Create new test trigger
- createTestJson - Create new test
- createTestString - Create new test
- createWebhookJson - Create new webhook
- createWebhookString - Create new webhook
- deleteExecutor - Delete executor
- deleteExecutors - Delete executors
- deleteTest - Delete test
- deleteTestSource - Delete test source
- deleteTestSources - Delete test sources
- deleteTestSuite - Delete test suite
- deleteTestSuites - Delete test suites
- deleteTestTrigger - Delete test trigger
- deleteTestTriggers - Delete test triggers
- deleteTests - Delete tests
- deleteWebhook - Delete webhook
- deleteWebhooks - Delete webhooks
- downloadArchive - Download artifact archive
- downloadFile - Download artifact
- executeTest - Starts new test execution
- executeTestSuite - Starts new test suite execution
- executeTestSuites - Starts new test suite executions
- executeTests - Starts new test executions
- getConfig - Get config
- getDebugInfo - Get debug information
- getExecutionArtifacts - Get execution's artifacts by ID
- getExecutionByID - Get test execution by ID
- getExecutionLogs - Get execution's logs by ID
- getExecutor - Get executor details
- getKeyMap - Test triggers keymap
- getTest - Get test
- getTestExecution - Get test execution
- getTestMetrics - Get test metrics
- getTestSource - Get test source data
- getTestSuiteByID - Get test suite by ID
- getTestSuiteByIDWithExecution - Get test suite by ID with execution
- getTestSuiteExecution - Get test suite execution
- getTestSuiteExecutionArtifacts - Get test suite execution artifacts
- getTestSuiteExecutionArtifactsByTestsuite - Get test suite execution artifacts
- getTestSuiteExecutionByID - Get test suite execution by ID
- getTestSuiteMetrics - Get test suite metrics
- getTestTriggerByID - Get test trigger by ID
- getTestWithExecution - Get test with execution
- getWebhook - Get webhook details
- listAllTestSuiteExecutions - Get all test suite executions
- listExecutions - Get all test executions
- listExecutors - List executors
- listTestExecutions - Get all test executions
- listTestSources - List test sources
- listTestSuiteExecutions - Get all test suite executions
- listTestSuiteTests - List tests for test suite
- listTestSuiteWithExecutions - Get all test suite with executions
- listTestSuites - Get all test suites
- listTestTriggers - List test triggers
- listTestWithExecutions - List test with executions
- listTests - List tests
- listWebhooks - List webhooks
- processTestSourceBatch - Process test source batch (create, update, delete)
- updateConfigKey - Update config
- updateExecutorJson - Update executor
- updateExecutorString - Update executor
- updateTestSourceJson - Update test source
- updateTestSourceString - Update test source
- updateTestSuiteJson - Update test suite
- updateTestSuiteString - Update test suite
- updateTestTriggerJson - Update test trigger
- updateTestTriggerString - Update test trigger
- updateTestJson - Update test
- updateTestString - Update test
- uploads - Upload file
- validateRepository - Validate new repository
executions
- abortExecution - Aborts execution
- abortTestSuiteExecution - Aborts testsuite execution
- abortTestSuiteExecutionByID - Aborts testsuite execution
- downloadArchive - Download artifact archive
- downloadFile - Download artifact
- executeTest - Starts new test execution
- executeTestSuite - Starts new test suite execution
- executeTestSuites - Starts new test suite executions
- executeTests - Starts new test executions
- getExecutionArtifacts - Get execution's artifacts by ID
- getExecutionByID - Get test execution by ID
- getExecutionLogs - Get execution's logs by ID
- getTestExecution - Get test execution
- getTestSuiteExecution - Get test suite execution
- getTestSuiteExecutionArtifacts - Get test suite execution artifacts
- getTestSuiteExecutionArtifactsByTestsuite - Get test suite execution artifacts
- getTestSuiteExecutionByID - Get test suite execution by ID
- listAllTestSuiteExecutions - Get all test suite executions
- listExecutions - Get all test executions
- listTestExecutions - Get all test executions
- listTestSuiteExecutions - Get all test suite executions
- uploads - Upload file
tests
- abortExecution - Aborts execution
- abortTestExecutions - Abort all executions of a test
- createTestJson - Create new test
- createTestString - Create new test
- deleteTest - Delete test
- deleteTests - Delete tests
- executeTest - Starts new test execution
- executeTests - Starts new test executions
- getTest - Get test
- getTestExecution - Get test execution
- getTestMetrics - Get test metrics
- getTestSuiteMetrics - Get test suite metrics
- getTestWithExecution - Get test with execution
- listTestExecutions - Get all test executions
- listTestWithExecutions - List test with executions
- listTests - List tests
- updateTestJson - Update test
- updateTestString - Update test
- uploads - Upload file
artifacts
- downloadArchive - Download artifact archive
- downloadFile - Download artifact
- getExecutionArtifacts - Get execution's artifacts by ID
logs
- getExecutionLogs - Get execution's logs by ID
executor
- createExecutorJson - Create new executor
- createExecutorString - Create new executor
- deleteExecutor - Delete executor
- deleteExecutors - Delete executors
- getExecutor - Get executor details
- listExecutors - List executors
- updateExecutorJson - Update executor
- updateExecutorString - Update executor
keymap
- getKeyMap - Test triggers keymap
labels
- listLabels - List labels
repository
- validateRepository - Validate new repository
testSources
- createTestSourceJson - Create new test source
- createTestSourceString - Create new test source
- deleteTestSource - Delete test source
- deleteTestSources - Delete test sources
- getTestSource - Get test source data
- listTestSources - List test sources
- processTestSourceBatch - Process test source batch (create, update, delete)
- updateTestSourceJson - Update test source
- updateTestSourceString - Update test source
testSuites
- abortTestSuiteExecution - Aborts testsuite execution
- abortTestSuiteExecutions - Abort all executions of a test suite
- createTestSuiteJson - Create new test suite
- createTestSuiteString - Create new test suite
- deleteTestSuite - Delete test suite
- deleteTestSuites - Delete test suites
- executeTestSuite - Starts new test suite execution
- executeTestSuites - Starts new test suite executions
- getTestSuiteByID - Get test suite by ID
- getTestSuiteByIDWithExecution - Get test suite by ID with execution
- getTestSuiteExecution - Get test suite execution
- getTestSuiteExecutionArtifacts - Get test suite execution artifacts
- getTestSuiteExecutionArtifactsByTestsuite - Get test suite execution artifacts
- listTestSuiteExecutions - Get all test suite executions
- listTestSuiteTests - List tests for test suite
- listTestSuiteWithExecutions - Get all test suite with executions
- listTestSuites - Get all test suites
- updateTestSuiteJson - Update test suite
- updateTestSuiteString - Update test suite
testTriggers
- bulkUpdateTestTriggers - Bulk update test triggers
- createTestTriggerJson - Create new test trigger
- createTestTriggerString - Create new test trigger
- deleteTestTrigger - Delete test trigger
- deleteTestTriggers - Delete test triggers
- getTestTriggerByID - Get test trigger by ID
- listTestTriggers - List test triggers
- updateTestTriggerJson - Update test trigger
- updateTestTriggerString - Update test trigger
webhook
- createWebhookJson - Create new webhook
- createWebhookString - Create new webhook
- deleteWebhook - Delete webhook
- deleteWebhooks - Delete webhooks
- getWebhook - Get webhook details
- listWebhooks - List webhooks
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
| Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | / |
Example
import { TestkubeSDK } from "testkube-sdk";
async function run() {
const sdk = new TestkubeSDK();
let res;
try {
res = await sdk.api.abortExecution({
executionID: "<value>",
id: "<id>",
});
} catch (err) {
if (err instanceof errors.SDKError) {
console.error(err); // handle exception
throw err;
}
}
if (res.statusCode == 200) {
// handle response
}
}
run();
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the serverIdx: number
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
| - | ------ | --------- |
| 0 | https://demo.testkube.io/results/v1
| None |
Example
import { TestkubeSDK } from "testkube-sdk";
async function run() {
const sdk = new TestkubeSDK({
serverIdx: 0,
});
const res = await sdk.api.abortExecution({
executionID: "<value>",
id: "<id>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverURL: str
optional parameter when initializing the SDK client instance. For example:
import { TestkubeSDK } from "testkube-sdk";
async function run() {
const sdk = new TestkubeSDK({
serverURL: "https://demo.testkube.io/results/v1",
});
const res = await sdk.api.abortExecution({
executionID: "<value>",
id: "<id>",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Custom HTTP Client
The Typescript SDK makes API calls using the axios HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom AxiosInstance
object.
For example, you could specify a header for every request that your sdk makes as follows:
import { testkube-sdk } from "TestkubeSDK";
import axios from "axios";
const httpClient = axios.create({
headers: {'x-custom-header': 'someValue'}
})
const sdk = new TestkubeSDK({defaultClient: httpClient});
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!