# Patch Action API

API for managing patch actions

**Version:** 1.0.0

## Overview

### Base URLs

- **Production server**: `https://sv.api.repzo.me`

- **Staging server**: `https://staging.sv.api.repzo.me`

### API Categories

- **Patch Action**: Operations related to patch action management

## Authentication

This API uses the following authentication methods:

- **ApiKeyAuth**

## Endpoints

### `/patch-action`

#### GET /patch-action

**Summary:** Get all patch action records

**Description:** Retrieve a list of all patch action records with optional filtering and pagination

**Tags:** Patch Action

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `limit` | query | integer | No | Maximum number of records to return |

| `offset` | query | integer | No | Number of records to skip for pagination |

| `sort` | query | string | No | Field to sort by |

| `order` | query | string | No | Sort order (asc or desc) |

| `filter` | query | string | No | Filter conditions in JSON format |

| `search` | query | string | No | Search term for text fields |

##### Responses

**200** - List of patch action records retrieved successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

#### POST /patch-action

**Summary:** Create a new patch action

**Description:** Create a new patch action with the provided data

**Tags:** Patch Action

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**201** - Patch action created successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

### `/patch-action/{id}`

#### GET /patch-action/{id}

**Summary:** Get patch action by ID

**Description:** Retrieve a specific patch action by its ID

**Tags:** Patch Action

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Patch action ID |

##### Responses

**200** - Patch action retrieved successfully

Content-Type: `application/json`

**404** - Patch action not found

**401** - Unauthorized

**500** - Internal server error

---

#### PUT /patch-action/{id}

**Summary:** Update patch action

**Description:** Update an existing patch action with new data

**Tags:** Patch Action

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Patch action ID |

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**200** - Patch action updated successfully

Content-Type: `application/json`

**400** - Bad request

**404** - Patch action not found

**401** - Unauthorized

**500** - Internal server error

---

#### DELETE /patch-action/{id}

**Summary:** Delete patch action

**Description:** Delete an existing patch action

**Tags:** Patch Action

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Patch action ID |

##### Responses

**200** - Patch action deleted successfully

Content-Type: `application/json`

**404** - Patch action not found

**401** - Unauthorized

**500** - Internal server error

---

### `/patch-action/execute/{id}`

#### POST /patch-action/execute/{id}

**Summary:** Execute patch action

**Description:** Execute a specific patch action by its ID

**Tags:** Patch Action

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Patch action ID |

##### Responses

**200** - Patch action executed successfully

Content-Type: `application/json`

**404** - Patch action not found

**401** - Unauthorized

**500** - Internal server error

---

## Data Models

### PatchAction

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `_id` | string | No | Unique identifier for the patch action |

| `name` | string | Yes | Name of the patch action |

| `description` | string | No | Description of what the patch action does |

| `targetEntity` | string | Yes | The entity type this patch targets |

| `conditions` | object | No | Conditions that must be met for the patch to apply |

| `patches` | array | Yes | No description |

| `batchSize` | integer | No | Number of records to process in each batch |

| `status` | string | No | Status of the patch action |

| `executionHistory` | array | No | No description |

| `metadata` | object | No | Additional metadata |

| `createdAt` | string | No | Record creation timestamp |

| `updatedAt` | string | No | Record last update timestamp |

### PatchActionInput

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `name` | string | Yes | Name of the patch action |

| `description` | string | No | Description of what the patch action does |

| `targetEntity` | string | Yes | The entity type this patch targets |

| `conditions` | object | No | Conditions that must be met for the patch to apply |

| `patches` | array | Yes | No description |

| `batchSize` | integer | No | Number of records to process in each batch |

| `status` | string | No | Status of the patch action |

| `metadata` | object | No | Additional metadata |

## TypeScript Usage

See [patch-action-examples.md](./patch-action-examples.md) for detailed TypeScript usage examples.
