QlikElixir.REST.Items (qlik_elixir v0.3.5)

View Source

REST API client for Qlik Cloud Items (Unified Resources).

Items represent a unified view of all resources in Qlik Cloud (apps, spaces, data files, etc.). This API provides a consistent way to query and manage resources across different types.

Examples

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

# Filter by resource type
{:ok, %{"data" => apps}} = Items.list(config: config, resource_type: "app")

# Get item details
{:ok, item} = Items.get("item-123", config: config)

# Get collections containing an item
{:ok, %{"data" => collections}} = Items.get_collections("item-123", config: config)

Summary

Functions

Deletes an item.

Finds an item by its resource ID and type.

Gets an item by ID.

Gets collections containing this item.

Gets published items for a resource.

Lists all items.

Functions

delete(item_id, opts \\ [])

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

Deletes an item.

find_by_resource(resource_id, resource_type, opts \\ [])

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

Finds an item by its resource ID and type.

Parameters

  • resource_id - The resource ID (e.g., app ID, datafile ID).
  • resource_type - The resource type (e.g., "app", "datafile").

Examples

iex> Items.find_by_resource("app-123", "app", config: config)
{:ok, %{"id" => "item-456", "resourceId" => "app-123"}}

get(item_id, opts \\ [])

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

Gets an item by ID.

get_collections(item_id, opts \\ [])

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

Gets collections containing this item.

get_published_items(item_id, opts \\ [])

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

Gets published items for a resource.

Returns all spaces where this item has been published.

list(opts \\ [])

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

Lists all items.

Options

  • :config - Required. The configuration struct.
  • :limit - Maximum number of results per page.
  • :next - Cursor for pagination.
  • :resource_type - Filter by resource type (e.g., "app", "space", "datafile").
  • :resource_id - Filter by resource ID (requires resource_type).
  • :space_id - Filter by space ID.
  • :name - Filter by name (partial match).
  • :owner_id - Filter by owner ID.
  • :shared - Filter by shared status.
  • :sort - Sort order (e.g., "-updatedAt" for descending).

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

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

Updates an item.

Parameters

  • item_id - The item ID.
  • params - Map with fields to update:
    • :name - New name.
    • :description - New description.