# Deployment History

## Get Deployment by ID

`client.deploymentHistory.retrieve(stringdeploymentID, RequestOptionsoptions?): DeploymentHistory`

**get** `/deployment-history/{deployment_id}`

Get a deployment record by its unique ID.

### Parameters

- `deploymentID: string`

### Returns

- `DeploymentHistory`

  API schema for deployment history.

  - `id: string`

    The unique identifier of the deployment record

  - `agent_id: string`

    The ID of the agent this deployment belongs to

  - `author_email: string`

    Email of the commit author

  - `author_name: string`

    Name of the commit author

  - `branch_name: string`

    Name of the branch

  - `build_timestamp: string`

    When the build was created

  - `commit_hash: string`

    Git commit hash for this deployment

  - `deployment_timestamp: string`

    When this deployment was first seen in the system

### Example

```typescript
import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const deploymentHistory = await client.deploymentHistory.retrieve('deployment_id');

console.log(deploymentHistory.id);
```

#### Response

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "author_email": "author_email",
  "author_name": "author_name",
  "branch_name": "branch_name",
  "build_timestamp": "2019-12-27T18:11:19.117Z",
  "commit_hash": "commit_hash",
  "deployment_timestamp": "2019-12-27T18:11:19.117Z"
}
```

## List Deployments for an agent

`client.deploymentHistory.list(DeploymentHistoryListParamsquery?, RequestOptionsoptions?): DeploymentHistoryListResponse`

**get** `/deployment-history`

List deployment history for an agent.

### Parameters

- `query: DeploymentHistoryListParams`

  - `agent_id?: string | null`

  - `agent_name?: string | null`

  - `limit?: number`

  - `order_by?: string | null`

  - `order_direction?: string`

  - `page_number?: number`

### Returns

- `DeploymentHistoryListResponse = Array<DeploymentHistory>`

  - `id: string`

    The unique identifier of the deployment record

  - `agent_id: string`

    The ID of the agent this deployment belongs to

  - `author_email: string`

    Email of the commit author

  - `author_name: string`

    Name of the commit author

  - `branch_name: string`

    Name of the branch

  - `build_timestamp: string`

    When the build was created

  - `commit_hash: string`

    Git commit hash for this deployment

  - `deployment_timestamp: string`

    When this deployment was first seen in the system

### Example

```typescript
import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const deploymentHistories = await client.deploymentHistory.list();

console.log(deploymentHistories);
```

#### Response

```json
[
  {
    "id": "id",
    "agent_id": "agent_id",
    "author_email": "author_email",
    "author_name": "author_name",
    "branch_name": "branch_name",
    "build_timestamp": "2019-12-27T18:11:19.117Z",
    "commit_hash": "commit_hash",
    "deployment_timestamp": "2019-12-27T18:11:19.117Z"
  }
]
```

## Domain Types

### Deployment History

- `DeploymentHistory`

  API schema for deployment history.

  - `id: string`

    The unique identifier of the deployment record

  - `agent_id: string`

    The ID of the agent this deployment belongs to

  - `author_email: string`

    Email of the commit author

  - `author_name: string`

    Name of the commit author

  - `branch_name: string`

    Name of the branch

  - `build_timestamp: string`

    When the build was created

  - `commit_hash: string`

    Git commit hash for this deployment

  - `deployment_timestamp: string`

    When this deployment was first seen in the system

### Deployment History List Response

- `DeploymentHistoryListResponse = Array<DeploymentHistory>`

  - `id: string`

    The unique identifier of the deployment record

  - `agent_id: string`

    The ID of the agent this deployment belongs to

  - `author_email: string`

    Email of the commit author

  - `author_name: string`

    Name of the commit author

  - `branch_name: string`

    Name of the branch

  - `build_timestamp: string`

    When the build was created

  - `commit_hash: string`

    Git commit hash for this deployment

  - `deployment_timestamp: string`

    When this deployment was first seen in the system
