@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
79 lines • 3.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeploymentRuns = void 0;
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const headers_1 = require("../../internal/headers.js");
const tracing_1 = require("../../internal/tracing.js");
const path_1 = require("../../internal/utils/path.js");
class DeploymentRuns extends resource_1.APIResource {
/**
* Get Deployment Run
*
* @example
* ```ts
* const betaManagedAgentsDeploymentRun =
* await client.beta.deploymentRuns.retrieve(
* 'deployment_run_id',
* );
* ```
*/
retrieve(deploymentRunID, params = {}, options) {
const { betas, workspace_id } = params ?? {};
return this._client.get((0, path_1.path) `/v1/deployment_runs/${deploymentRunID}?beta=true`, {
...options,
headers: (0, headers_1.buildHeaders)([
{
'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString(),
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
},
options?.headers,
]),
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.deployment_runs.retrieve', options, {
route: '/v1/deployment_runs/{deployment_run_id}',
attributes: { 'anthropic.deployment_run.id': deploymentRunID },
}),
});
}
/**
* List Deployment Runs
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const betaManagedAgentsDeploymentRun of client.beta.deploymentRuns.list()) {
* // ...
* }
* ```
*/
list(params = {}, options) {
const { betas, workspace_id, ...query } = params ?? {};
return this._client.getAPIList('/v1/deployment_runs?beta=true', (pagination_1.PageCursor), {
query,
...options,
headers: (0, headers_1.buildHeaders)([
{
'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString(),
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
},
options?.headers,
]),
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.deployment_runs.list', options, {
route: '/v1/deployment_runs',
queryParams: [
'created_at[gt]',
'created_at[gte]',
'created_at[lt]',
'created_at[lte]',
'deployment_id',
'has_error',
'limit',
'page',
'trigger_type',
],
}),
});
}
}
exports.DeploymentRuns = DeploymentRuns;
//# sourceMappingURL=deployment-runs.js.map