# `HuggingfaceClient.Hub.Repositories.Repos`
[🔗](https://github.com/huggingface/huggingface_client/blob/v0.1.0/lib/huggingface_client/hub/repositories/repos.ex#L1)

Repository creation, deletion, branch management, and commit history.

# `auth_check`

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

Checks if the given token has access to a repository.

Returns `:ok` if access is granted, or raises an appropriate error.

## Options

- `:write` — if `true`, check for write access (default: false = read access)
- `:type` — repo type (default: `:model`)
- `:access_token`

## Example

    case HuggingfaceClient.auth_check("meta-llama/Llama-3.1-8B", access_token: "hf_...") do
      :ok              -> IO.puts("Access granted!")
      {:error, reason} -> IO.puts("No access: #{Exception.message(reason)}")
    end

# `count_commits`

```elixir
@spec count_commits(
  String.t(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, Exception.t()}
```

Counts total commits on a branch. See `HuggingfaceClient.count_commits/2`.

# `create`

```elixir
@spec create(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}
```

Creates a repository. See `HuggingfaceClient.create_repo/2`.

# `create_branch`

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

Creates a branch. See `HuggingfaceClient.create_branch/3`.

# `delete`

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

Deletes a repository. See `HuggingfaceClient.delete_repo/2`.

# `delete_branch`

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

Deletes a branch. See `HuggingfaceClient.delete_branch/3`.

# `exists?`

```elixir
@spec exists?(
  String.t(),
  keyword()
) :: {:ok, boolean()} | {:error, Exception.t()}
```

Checks if a repository exists. See `HuggingfaceClient.repo_exists/2`.

# `like`

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

Likes a repository on the Hub.

## Example
    :ok = HuggingfaceClient.Hub.Repos.like("gpt2", access_token: token)

# `list_commits`

```elixir
@spec list_commits(
  String.t(),
  keyword()
) :: Enumerable.t()
```

Returns a lazy stream of commits. See `HuggingfaceClient.list_commits/2`.

# `list_liked_repos`

```elixir
@spec list_liked_repos(keyword()) :: {:ok, [map()]} | {:error, Exception.t()}
```

Lists repos liked by a user.

## Options
- `:user` — username (defaults to authenticated user)
- `:type` — `"model"`, `"dataset"`, `"space"` (default: all types)
- `:access_token`

## Example
    {:ok, liked} = HuggingfaceClient.Hub.Repos.list_liked_repos(
      user: "yann-lecun", access_token: token
    )

# `list_space_logs`

```elixir
@spec list_space_logs(
  String.t(),
  keyword()
) :: {:ok, [map()]} | {:error, Exception.t()}
```

Gets the list of logs from a Space (for debugging).

## Example
    {:ok, logs} = HuggingfaceClient.Hub.Repos.list_space_logs("my-org/my-space",
      access_token: token
    )

# `move`

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

Renames a repository or transfers it to a new namespace.

## Options

- `:from_id` — current repo ID (e.g. `"old-user/old-name"`) (required)
- `:to_id` — new repo ID (e.g. `"org/new-name"`) (required)
- `:type` — repo type (default: `:model`)
- `:access_token`

## Example

    {:ok, url} = HuggingfaceClient.move_repo(
      from_id: "my-user/old-model",
      to_id: "my-org/new-model",
      access_token: "hf_..."
    )

# `settings`

```elixir
@spec settings(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}
```

Gets repository settings (gating, private, SDK for spaces, etc.).

## Example
    {:ok, settings} = HuggingfaceClient.Hub.Repos.settings("my-model",
      access_token: token
    )
    IO.puts("Private: #{settings["private"]}")
    IO.puts("Gated: #{settings["gated"]}")

# `super_squash_history`

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

Squashes all commits in a repo into a single commit (history-destructive).

Useful for cleaning up a repo's commit history before releasing.
Requires admin access.

## Example
    :ok = HuggingfaceClient.Hub.Repos.super_squash_history("my-org/my-model",
      branch: "main", access_token: token
    )

# `tag_commit`

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

Tags a specific commit (lightweight tag without a message).

## Options
- `:tag` — tag name (required)
- `:commit` — commit SHA to tag (default: HEAD)
- `:type` — repo type
- `:access_token`

## Example
    :ok = HuggingfaceClient.Hub.Repos.tag_commit("my-model",
      tag: "v1.0.0-checkpoint-500",
      commit: "abc123def456",
      access_token: token
    )

# `unlike`

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

Unlikes a repository on the Hub.

## Example
    :ok = HuggingfaceClient.Hub.Repos.unlike("gpt2", access_token: token)

# `update_settings`

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

Updates repository settings (visibility, gating, etc.).

## Options

- `:private` — `true` to make private, `false` for public
- `:gated` — `"auto"`, `"manual"`, or `false` to disable gating
- `:type` — repo type (default: `:model`)
- `:access_token`

## Example

    :ok = HuggingfaceClient.update_repo_settings("my-org/my-model",
      private: true,
      gated: "auto",
      access_token: "hf_..."
    )

# `upload_folder`

```elixir
@spec upload_folder(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}
```

Uploads a local folder's content to a repository.

Walks the directory tree and uploads all files in a single commit.

## Options

- `:folder_path` — local directory to upload (required)
- `:path_in_repo` — target path prefix in the repo (default: root `""`)
- `:allow_patterns` — glob pattern(s) to include (e.g. `"*.json"`)
- `:ignore_patterns` — glob pattern(s) to exclude
- `:commit_message` — commit message
- `:branch` — target branch (default: `"main"`)
- `:create_pr` — if `true`, open as pull request
- `:type` — repo type
- `:access_token`

## Example

    {:ok, commit} = HuggingfaceClient.upload_folder("my-org/my-model",
      folder_path: "./model_outputs",
      path_in_repo: "checkpoints/step-1000",
      ignore_patterns: ["*.log", "__pycache__/**"],
      access_token: "hf_..."
    )

---

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