QlikElixir.REST.Spaces (qlik_elixir v0.3.5)

View Source

Qlik Cloud Spaces REST API client.

Provides functions to manage spaces including listing, creating, updating, deleting spaces, and managing space assignments.

API Reference: https://qlik.dev/apis/rest/spaces/

Summary

Functions

Creates a new space.

Creates an assignment (adds a user or group to a space).

Deletes a space.

Deletes an assignment from a space.

Gets details for a specific space.

Lists spaces accessible to the current user.

Lists assignments for a space.

Lists available space types.

Updates an existing space using JSON Patch format.

Functions

create(params, opts \\ [])

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

Creates a new space.

Parameters

  • params - Map with space attributes:
    • :name - Space name (required)
    • :type - Space type (shared, managed, data)
    • :description - Space description

Examples

iex> QlikElixir.REST.Spaces.create(%{name: "Dev Space", type: "shared"})
{:ok, %{"id" => "new-id", "name" => "Dev Space"}}

create_assignment(space_id, params, opts \\ [])

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

Creates an assignment (adds a user or group to a space).

Parameters

  • space_id - The space ID
  • params - Map with assignment attributes:
    • :type - Assignment type (user, group)
    • :assignee_id - User or group ID
    • :roles - List of roles (consumer, contributor, producer, etc.)

Examples

iex> QlikElixir.REST.Spaces.create_assignment("space-123", %{type: "user", assignee_id: "user-456", roles: ["consumer"]})
{:ok, %{"id" => "assign-id"}}

delete(space_id, opts \\ [])

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

Deletes a space.

Examples

iex> QlikElixir.REST.Spaces.delete("space-123")
:ok

delete_assignment(space_id, assignment_id, opts \\ [])

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

Deletes an assignment from a space.

Examples

iex> QlikElixir.REST.Spaces.delete_assignment("space-123", "assign-456")
:ok

get(space_id, opts \\ [])

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

Gets details for a specific space.

Examples

iex> QlikElixir.REST.Spaces.get("space-123")
{:ok, %{"id" => "space-123", "name" => "My Space"}}

list(opts \\ [])

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

Lists spaces accessible to the current user.

Options

  • :limit - Maximum number of spaces to return
  • :next - Cursor for pagination
  • :type - Filter by space type (shared, managed, data)
  • :config - Custom configuration

Examples

iex> QlikElixir.REST.Spaces.list(type: "shared")
{:ok, %{"data" => [...]}}

list_assignments(space_id, opts \\ [])

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

Lists assignments for a space.

Examples

iex> QlikElixir.REST.Spaces.list_assignments("space-123")
{:ok, %{"data" => [...]}}

list_types(opts \\ [])

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

Lists available space types.

Examples

iex> QlikElixir.REST.Spaces.list_types()
{:ok, %{"data" => [%{"name" => "shared"}, %{"name" => "managed"}]}}

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

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

Updates an existing space using JSON Patch format.

Examples

iex> QlikElixir.REST.Spaces.update("space-123", %{description: "Updated"})
{:ok, %{"id" => "space-123", "description" => "Updated"}}