QlikElixir.REST.Collections (qlik_elixir v0.3.5)

View Source

REST API client for Qlik Cloud Collections.

Collections allow users to organize and group items (apps, data files, etc.) for easier access and sharing.

Examples

# List all collections
{:ok, %{"data" => collections}} = Collections.list(config: config)

# Create a collection
{:ok, collection} = Collections.create(%{name: "My Reports", type: "private"}, config: config)

# Add items to a collection
{:ok, _} = Collections.add_items("coll-123", ["item-1", "item-2"], config: config)

# Get favorites collection
{:ok, favorites} = Collections.get_favorites(config: config)

Summary

Functions

Adds an item to a collection.

Adds multiple items to a collection.

Creates a new collection.

Deletes a collection.

Gets a collection by ID.

Gets the user's favorites collection.

Lists all collections.

Lists items in a collection.

Removes an item from a collection.

Functions

add_item(collection_id, item_id, opts \\ [])

@spec add_item(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Adds an item to a collection.

Parameters

  • collection_id - The collection ID.
  • item_id - The item ID to add.

add_items(collection_id, item_ids, opts \\ [])

@spec add_items(String.t(), [String.t()], keyword()) :: [
  ok: map(),
  error: QlikElixir.Error.t()
]

Adds multiple items to a collection.

Parameters

  • collection_id - The collection ID.
  • item_ids - List of item IDs to add.

Returns list of results for each item.

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Creates a new collection.

Parameters

  • params - Map with collection details:
    • :name - Required. Collection name.
    • :type - Collection type ("private" or "public").
    • :description - Optional description.

delete(collection_id, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, QlikElixir.Error.t()}

Deletes a collection.

get(collection_id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Gets a collection by ID.

get_favorites(opts \\ [])

@spec get_favorites(keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Gets the user's favorites collection.

list(opts \\ [])

@spec list(keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Lists all collections.

Options

  • :config - Required. The configuration struct.
  • :limit - Maximum number of results per page.
  • :next - Cursor for pagination.
  • :name - Filter by name (partial match).
  • :type - Filter by type ("private", "public", "favorite").
  • :sort - Sort order (e.g., "-createdAt").

list_items(collection_id, opts \\ [])

@spec list_items(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Lists items in a collection.

Options

  • :limit - Maximum number of results per page.
  • :next - Cursor for pagination.

remove_item(collection_id, item_id, opts \\ [])

@spec remove_item(String.t(), String.t(), keyword()) ::
  :ok | {:error, QlikElixir.Error.t()}

Removes an item from a collection.

Parameters

  • collection_id - The collection ID.
  • item_id - The item ID to remove.

update(collection_id, params, opts \\ [])

@spec update(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Updates a collection.

Parameters

  • collection_id - The collection ID.
  • params - Map with fields to update.