# `Arangox.API.Views`
[🔗](https://github.com/ArangoDB-Community/arangox/blob/v0.8.0/lib/arangox/api/views.ex#L1)

ArangoDB's Views operations.

Every function takes the pool as its first argument and returns the decoded
response body. See `Arangox.API.Client` for the options they all accept and
for what a `404` returns.

# `all`

```elixir
@spec all(
  Arangox.conn(),
  keyword()
) :: {:ok, term()} | {:error, Exception.t()}
```

List all Views

Returns an object containing a listing of all Views in the current database,
regardless of their type.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => [%{
        "globallyUniqueId" => string,
        "id" => string,
        "name" => string,
        "type" => string
      }]
    }

# `all!`

```elixir
@spec all!(
  Arangox.conn(),
  keyword()
) :: term()
```

List all Views. Raises on error.

See `all/1`.

# `create`

```elixir
@spec create(Arangox.conn(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Create an arangosearch View

Creates a new View with a given name and properties if it does not
already exist.

# `create!`

```elixir
@spec create!(Arangox.conn(), term(), keyword()) :: term()
```

Create an arangosearch View. Raises on error.

See `create/2`.

# `delete`

```elixir
@spec delete(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Drop a View

Deletes the View identified by `view-name`.

# `delete!`

```elixir
@spec delete!(Arangox.conn(), binary(), keyword()) :: term()
```

Drop a View. Raises on error.

See `delete/2`.

# `get`

```elixir
@spec get(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Get information about a View

Returns the basic information about a specific View.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "globallyUniqueId" => string,
      "id" => string,
      "name" => string,
      "type" => string
    }

# `get!`

```elixir
@spec get!(Arangox.conn(), binary(), keyword()) :: term()
```

Get information about a View. Raises on error.

See `get/2`.

# `properties`

```elixir
@spec properties(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Get the properties of a View

Returns an object containing the definition of the View identified by `view-name`.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "cleanupIntervalStep" => integer,
      "code" => integer,
      "commitIntervalMsec" => integer,
      "consolidationIntervalMsec" => integer,
      "consolidationPolicy" => %{
        "maxSkewThreshold" => float,
        "minDeletionRatio" => float,
        "segmentsBytesMax" => integer,
        "type" => string
      },
      "error" => boolean,
      "globallyUniqueId" => string,
      "id" => string,
      "links" => %{},
      "name" => string,
      "optimizeTopK" => [],
      "primarySort" => [],
      "primarySortCompression" => string,
      "storedValues" => [],
      "type" => string,
      "writebufferActive" => integer,
      "writebufferIdle" => integer,
      "writebufferSizeMax" => integer
    }

# `properties!`

```elixir
@spec properties!(Arangox.conn(), binary(), keyword()) :: term()
```

Get the properties of a View. Raises on error.

See `properties/2`.

# `rename`

```elixir
@spec rename(Arangox.conn(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Rename a View

Renames a View.

> **INFO:**
Renaming Views is not supported in cluster deployments.

# `rename!`

```elixir
@spec rename!(Arangox.conn(), binary(), term(), keyword()) :: term()
```

Rename a View. Raises on error.

See `rename/3`.

# `replace_properties`

```elixir
@spec replace_properties(Arangox.conn(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Replace the properties of an arangosearch View

Changes all properties of a View by replacing them, except for immutable properties.

# `replace_properties!`

```elixir
@spec replace_properties!(Arangox.conn(), binary(), term(), keyword()) :: term()
```

Replace the properties of an arangosearch View. Raises on error.

See `replace_properties/3`.

# `update_properties`

```elixir
@spec update_properties(Arangox.conn(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Update the properties of an arangosearch View

Partially changes the properties of a View by updating the specified attributes.

# `update_properties!`

```elixir
@spec update_properties!(Arangox.conn(), binary(), term(), keyword()) :: term()
```

Update the properties of an arangosearch View. Raises on error.

See `update_properties/3`.

---

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