# `OpenCode.Generated.Sync`
[🔗](https://github.com/UtkarshUsername/opencode-sdk-elixir/blob/v0.1.84/lib/opencode/generated/sync.ex#L1)

Provides API endpoints related to sync

# `sync_history_list_200_json_resp`

```elixir
@type sync_history_list_200_json_resp() :: %{
  aggregate_id: String.t(),
  data: map(),
  id: String.t(),
  seq: integer(),
  type: String.t()
}
```

# `sync_replay_200_json_resp`

```elixir
@type sync_replay_200_json_resp() :: %{session_id: String.t()}
```

# `sync_steal_200_json_resp`

```elixir
@type sync_steal_200_json_resp() :: %{session_id: String.t()}
```

# `sync_history_list`

```elixir
@spec sync_history_list(body :: map(), opts :: keyword()) ::
  {:ok, [sync_history_list_200_json_resp()]}
  | {:error,
     OpenCode.Generated.EffectHttpApiErrorBadRequest.t()
     | OpenCode.Generated.InvalidRequestError.t()}
```

List sync events

List sync events for all aggregates. Keys are aggregate IDs the client already knows about, values are the last known sequence ID. Events with seq > value are returned for those aggregates. Aggregates not listed in the input get their full history.

## Options

  * `directory`
  * `workspace`

## Request Body

**Content Types**: `application/json`

# `sync_replay`

```elixir
@spec sync_replay(body :: map(), opts :: keyword()) ::
  {:ok, sync_replay_200_json_resp()}
  | {:error,
     OpenCode.Generated.EffectHttpApiErrorBadRequest.t()
     | OpenCode.Generated.InvalidRequestError.t()}
```

Replay sync events

Validate and replay a complete sync event history.

## Options

  * `directory`
  * `workspace`

## Request Body

**Content Types**: `application/json`

# `sync_start`

```elixir
@spec sync_start(opts :: keyword()) ::
  {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
```

Start workspace sync

Start sync loops for workspaces in the current project that have active sessions.

## Options

  * `directory`
  * `workspace`

# `sync_steal`

```elixir
@spec sync_steal(body :: map(), opts :: keyword()) ::
  {:ok, sync_steal_200_json_resp()}
  | {:error,
     OpenCode.Generated.EffectHttpApiErrorBadRequest.t()
     | OpenCode.Generated.InvalidRequestError.t()}
```

Steal session into workspace

Update a session to belong to the current workspace through the sync event system.

## Options

  * `directory`
  * `workspace`

## Request Body

**Content Types**: `application/json`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
