# `HfHub.Repo`
[🔗](https://github.com/North-Shore-AI/hf_hub_ex/blob/v0.3.1/lib/hf_hub/repo.ex#L1)

Repository management operations for HuggingFace Hub.

Provides create, delete, update, and move operations for repositories
(models, datasets, and spaces).

## Examples

    # Create a new model repository
    {:ok, url} = HfHub.Repo.create("my-org/my-model", private: true)

    # Create a space with Gradio
    {:ok, url} = HfHub.Repo.create("my-space",
      repo_type: :space,
      space_sdk: "gradio"
    )

    # Delete a repository
    :ok = HfHub.Repo.delete("my-org/old-model")

    # Update settings
    :ok = HfHub.Repo.update_settings("my-model", private: true, gated: :auto)

    # Move/rename a repository
    {:ok, url} = HfHub.Repo.move("old-name", "new-org/new-name")

# `gated`

```elixir
@type gated() :: :auto | :manual | false
```

# `repo_type`

```elixir
@type repo_type() :: :model | :dataset | :space
```

# `space_hardware`

```elixir
@type space_hardware() :: String.t()
```

# `space_sdk`

```elixir
@type space_sdk() :: String.t()
```

# `create`

```elixir
@spec create(
  String.t(),
  keyword()
) :: {:ok, HfHub.Repo.RepoUrl.t()} | {:error, term()}
```

Creates a new repository on the Hugging Face Hub.

## Options

  * `:token` - Authentication token
  * `:repo_type` - Type of repository (:model, :dataset, :space). Defaults to :model.
  * `:private` - Whether the repository should be private. Defaults to false.
  * `:exist_ok` - If true, do not error if repo already exists. Defaults to false.
  * `:space_sdk` - SDK to use for spaces ("gradio", "streamlit", "docker", "static").
  * `:space_hardware` - Hardware to use for spaces.

## Examples

    {:ok, url} = HfHub.Repo.create("my-model")
    {:ok, url} = HfHub.Repo.create("my-dataset", repo_type: :dataset)

# `delete`

```elixir
@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, term()}
```

Deletes a repository.

## Options

  * `:token` - Authentication token
  * `:repo_type` - Type of repository. Defaults to :model.
  * `:missing_ok` - If true, do not error if repo does not exist. Defaults to false.

# `exists?`

```elixir
@spec exists?(
  String.t(),
  keyword()
) :: boolean()
```

Checks if a repository exists.

Using HEAD request to check existence.
For models: /repo_id
For datasets: /datasets/repo_id
For spaces: /spaces/repo_id

# `file_exists?`

```elixir
@spec file_exists?(String.t(), String.t(), keyword()) :: boolean()
```

Checks if a file exists in a repository.

# `move`

```elixir
@spec move(String.t(), String.t(), keyword()) ::
  {:ok, HfHub.Repo.RepoUrl.t()} | {:error, term()}
```

Moves (renames) a repository.

## Options

  * `:token` - Authentication token
  * `:repo_type` - Type of repository. Defaults to :model.

# `revision_exists?`

```elixir
@spec revision_exists?(String.t(), String.t(), keyword()) :: boolean()
```

Checks if a revision exists.

Uses the repo info endpoint to check for valid revision.
This is effectively checking if we can get info about a specific revision.

# `update_settings`

```elixir
@spec update_settings(
  String.t(),
  keyword()
) :: :ok | {:error, term()}
```

Updates repository settings.

## Options

  * `:token` - Authentication token
  * `:repo_type` - Type of repository. Defaults to :model.
  * `:private` - Set visibility
  * `:gated` - Set gated status (:auto, :manual, false)

---

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