# EditOperation

A single edit operation to perform on a file. Supports multiple edit types: find/replace, line-range replacement, insert, and delete.

**Kind:** an object, used in requests.

## Fields

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | `string` |  | Operation type: "replace" (find/replace), "replaceLines", "insertAfter", "deleteLines". |
| `find` | `string \| null` |  | String to find (for a `replace` operation). |
| `replace` | `string \| null` |  | String to replace with (for a `replace` operation). |
| `replaceAll` | `boolean` |  | Replace all occurrences, not just first (for a `replace` operation). Default false. |
| `startLine` | `integer \| null` |  | Start line number, 1-based (for a `replaceLines` operation). |
| `endLine` | `integer \| null` |  | End line number, 1-based, inclusive (for a `replaceLines` operation). |
| `content` | `string \| null` |  | New content to replace lines with (for a `replaceLines` or `insertAfter` operation). |
| `insertAfterLine` | `integer \| null` |  | Insert new content after this line number, 1-based (for an `insertAfter` operation). Use 0 to insert at the beginning of the file. |
| `deleteLines` | `integer[] \| null` |  | Line numbers to delete, 1-based (for a `deleteLines` operation). |

## Example

```json
{
  "type": "...",
  "find": "...",
  "replace": "...",
  "replaceAll": false,
  "startLine": 0,
  "endLine": 0,
  "content": "...",
  "insertAfterLine": 0,
  "deleteLines": [
    0
  ]
}
```

## Where it's used

- Inside [`BatchEditFileRequest`](https://docs.maitento.com/reference/types/batch-edit-file-request.md)
- Inside [`EditRequest`](https://docs.maitento.com/reference/types/edit-request.md)
