# client.system_kept_repos

> client.system_kept_repos — the systemKeptRepos operations.

`client.system_kept_repos` — the `systemKeptRepos` operations.

On `AsyncKindgi` every method is the same, awaited.

## `client.system_kept_repos.rulings()`

```python signature
rulings(
    body: KeptRepoRulingsBody | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> KeptRepoRulings
```

Rule on the kept repos a store holds. `POST /v1/system/kept-repos/rulings`

For a store keeping repos for the runtime's projects without a GitHub repo: one ruling for each id it names, in order. `keep`, with the mark the store sets on the repo, or `purge`, for `reason`. An unfinished erasure rules `purge` first, then a purge already recorded (with `recorded: true`), then a purged tenant; a project deleted, or a repo moved to GitHub, 90 days ago or more (its kept window) is `retention`, and a repo the runtime has no project for is `no-record`, unless something holds it (`keep`, marked `held`). Ids may span tenants. An id not in form, or more than 500, refuses the whole request. Takes `system:kept-repos`, on a runtime serving many tenants.

## `client.system_kept_repos.erasures()`

```python signature
erasures(
    *,
    limit: int | None = None,
    cursor: str | None = None,
    timeout: float | None = None,
) -> KeptRepoErasurePage
```

List the unfinished erasures of kept repos. `GET /v1/system/kept-repos/erasures`

Every unfinished erasure of a project's kept repo, across tenants, by tenant id then project id: what the store purges, whether or not it holds the repo, and reports. Ids and the time of the request only. Takes `system:kept-repos`, on a runtime serving many tenants.

## `client.system_kept_repos.report_purged()`

```python signature
report_purged(
    tenant_id: str | UUID,
    project_id: str | UUID,
    body: KeptRepoPurgedBody | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> None
```

Report a kept repo's purge done. `POST /v1/system/tenants/{tenantId}/projects/{projectId}/kept-repo/purged`

The store's purge of a kept repo is done, for the ruling's `reason`. For `erasure` or `retention` the runtime records it, which completes an unfinished erasure of the repo; a second report changes nothing. It answers `204` whatever the tenant's state: a purged tenant's report, or one for a tenant the runtime doesn't know (a restore older than the tenant), is kept in the operator's access record alone. Takes `system:kept-repos`, on a runtime serving many tenants.

## `client.system_kept_repos.state()`

```python signature
state(
    tenant_id: str | UUID,
    project_id: str | UUID,
    /,
    *,
    timeout: float | None = None,
) -> KeptRepoState
```

Read a kept repo's state. `GET /v1/system/tenants/{tenantId}/projects/{projectId}/kept-repo`

A project's kept repo, as the runtime records it: `live`, `deleted`, `moved`, `held`, `erasure-requested` or `purged`, and since when. Takes `system:kept-repos:erase`, on a runtime serving many tenants.

## `client.system_kept_repos.request_erasure()`

```python signature
request_erasure(
    tenant_id: str | UUID,
    project_id: str | UUID,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
) -> KeptRepoState
```

Request a kept repo's erasure. `POST /v1/system/tenants/{tenantId}/projects/{projectId}/kept-repo/erasure`

Requests the erasure of a project's kept repo: the store purges it at its next pass, and reports it, which completes the erasure. A second request while one is unfinished answers that one, and one for a repo whose erasure is done already answers `200` with no new request. A repo purged when its kept window ended is requested still, so its erasure is recorded too. Turning `KINDGI_KEPT_REPOS` off erases nothing and holds an unfinished erasure, which completes once it's on again. Takes `system:kept-repos:erase`, which no other scope includes, or `kindgi:system`, on a runtime serving many tenants.
