# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Spatio.Api.Tasks do
@moduledoc """
API calls for all endpoints tagged `Tasks`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Delete multiple tasks in one call.
Replaces the legacy BFF that looped DELETE /v1/tasks/:id. Per-id errors are collected in `failed` rather than failing the whole call — partial success is the norm.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `bulk_delete_tasks_request` (BulkDeleteTasksRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.BulkDeleteTasksResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec bulk_delete_tasks(Tesla.Env.client, Spatio.Model.BulkDeleteTasksRequest.t, keyword()) :: {:ok, Spatio.Model.BulkDeleteTasksResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def bulk_delete_tasks(connection, bulk_delete_tasks_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/tasks/delete")
|> add_param(:body, :body, bulk_delete_tasks_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.BulkDeleteTasksResponse},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError}
])
end
@doc """
Apply the same update to multiple tasks.
Same `updates` payload applied to every id in `taskIds`. As with bulk delete, per-id failures collect in `failed`.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `bulk_update_tasks_request` (BulkUpdateTasksRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.BulkUpdateTasksResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec bulk_update_tasks(Tesla.Env.client, Spatio.Model.BulkUpdateTasksRequest.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.BulkUpdateTasksResponse.t} | {:error, Tesla.Env.t}
def bulk_update_tasks(connection, bulk_update_tasks_request, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/tasks/bulk-update")
|> add_param(:body, :body, bulk_update_tasks_request)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.BulkUpdateTasksResponse},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError}
])
end
@doc """
Mark a task complete.
Idempotent — completing an already-completed task is a no-op that still returns success. The legacy `POST /v1/tasks/complete/task` endpoint accepts the same operation with the task id in the JSON body instead of the URL; that variant is a renderer-compat shim and is not modeled in the spec.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec complete_task(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def complete_task(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/tasks/#{id}/complete")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Create a task.
Creates a new task under the target account. Target resolution mirrors `POST /v1/notes`: body `accountId` → `?accountId=` → body `provider` → `?provider=` → caller's single connected account (errors `ambiguous_account` if more than one and no selector).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `create_task_request` (CreateTaskRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:provider` (String.t): Provider id (e.g. `native-notes`, `notion`). Selects every connected account for the provider. Mutually exclusive with `accountId`.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Task.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_task(Tesla.Env.client, Spatio.Model.CreateTaskRequest.t, keyword()) :: {:ok, Spatio.Model.Task.t} | {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.CreateNote400Response.t} | {:error, Tesla.Env.t}
def create_task(connection, create_task_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:provider => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/tasks")
|> add_param(:body, :body, create_task_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, Spatio.Model.Task},
{400, Spatio.Model.CreateNote400Response},
{401, Spatio.Model.ApiError},
{500, Spatio.Model.ApiError}
])
end
@doc """
Create a comment.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `task_comment_request` (TaskCommentRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.TaskCommentMutationResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_task_comment(Tesla.Env.client, String.t, Spatio.Model.TaskCommentRequest.t, keyword()) :: {:ok, Spatio.Model.TaskCommentMutationResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def create_task_comment(connection, id, task_comment_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:post)
|> url("/v1/tasks/#{id}/comments")
|> add_param(:body, :body, task_comment_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.TaskCommentMutationResponse},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError}
])
end
@doc """
Delete a task.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_task(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def delete_task(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/tasks/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Delete a task comment.
Allowed for the comment author and (for native comments) for the task owner.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `comment_id` (String.t): Comment id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.SuccessFlag.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_task_comment(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.SuccessFlag.t} | {:error, Tesla.Env.t}
def delete_task_comment(connection, id, comment_id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:delete)
|> url("/v1/tasks/#{id}/comments/#{comment_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.SuccessFlag},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Fetch one task.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Task.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_task(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.Task.t} | {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.CreateNote400Response.t} | {:error, Tesla.Env.t}
def get_task(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/tasks/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Task},
{400, Spatio.Model.CreateNote400Response},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
List comments on a task.
Returns active comments. When `?accountId=` targets an external provider that supports comments (e.g. Linear), the provider is queried directly; otherwise the native `TaskComment` table is used.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.TaskCommentList.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_task_comments(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.TaskCommentList.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_task_comments(connection, id, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:get)
|> url("/v1/tasks/#{id}/comments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.TaskCommentList},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError}
])
end
@doc """
List supported task providers.
Returns the registered task-provider ids and the platform's own metadata. Useful for clients that need to render provider-specific UI (icons, capability flags) before committing to a particular `provider`.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.TaskProvidersInfo.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_task_providers(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.ApiError.t} | {:ok, Spatio.Model.TaskProvidersInfo.t} | {:error, Tesla.Env.t}
def list_task_providers(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/tasks/providers")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.TaskProvidersInfo},
{401, Spatio.Model.ApiError}
])
end
@doc """
List tasks across connected accounts.
Fan-out list. Returns every task visible to the caller across every connected tasks provider. Pass `?accountId=` or `?provider=` to scope to a single source.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:provider` (String.t): Provider id (e.g. `native-notes`, `notion`). Selects every connected account for the provider. Mutually exclusive with `accountId`.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
- `:completed` (boolean()): Include completed tasks. Default `false` (active tasks only).
- `:labels` ([String.t]): Repeatable. Filter to tasks carrying every label listed.
- `:parentTaskId` (String.t): Filter to subtasks of this parent.
- `:type` (String.t): Discriminator filter (`todo`, `reminder`, `issue`).
- `:sourcePlatform` (String.t): Filter to tasks linked to a given source platform.
- `:sourceId` (String.t): Filter to tasks linked to a specific source artifact id. Pair with `sourcePlatform` for an exact match.
- `:limit` (integer()):
- `:offset` (integer()):
### Returns
- `{:ok, Spatio.Model.TaskListEnvelope.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_tasks(Tesla.Env.client, keyword()) :: {:ok, Spatio.Model.TaskListEnvelope.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def list_tasks(connection, opts \\ []) do
optional_params = %{
:accountId => :query,
:provider => :query,
:"X-Workspace-ID" => :headers,
:completed => :query,
:labels => :query,
:parentTaskId => :query,
:type => :query,
:sourcePlatform => :query,
:sourceId => :query,
:limit => :query,
:offset => :query
}
request =
%{}
|> method(:get)
|> url("/v1/tasks")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.TaskListEnvelope},
{401, Spatio.Model.ApiError},
{500, Spatio.Model.ApiError}
])
end
@doc """
Update a task (partial).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `update_task_request` (UpdateTaskRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.Task.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_task(Tesla.Env.client, String.t, Spatio.Model.UpdateTaskRequest.t, keyword()) :: {:ok, Spatio.Model.Task.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_task(connection, id, update_task_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:patch)
|> url("/v1/tasks/#{id}")
|> add_param(:body, :body, update_task_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.Task},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
Edit a task comment.
Only the comment author can edit.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `id` (String.t): Task id.
- `comment_id` (String.t): Comment id.
- `task_comment_request` (TaskCommentRequest):
- `opts` (keyword): Optional parameters
- `:accountId` (String.t): Connected-account row id. Selects which provider account this request targets when more than one is connected. Mutually exclusive with `provider`. If omitted on a list endpoint the call fans out across every connected account.
- `:"X-Workspace-ID"` (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
### Returns
- `{:ok, Spatio.Model.TaskCommentMutationResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_task_comment(Tesla.Env.client, String.t, String.t, Spatio.Model.TaskCommentRequest.t, keyword()) :: {:ok, Spatio.Model.TaskCommentMutationResponse.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def update_task_comment(connection, id, comment_id, task_comment_request, opts \\ []) do
optional_params = %{
:accountId => :query,
:"X-Workspace-ID" => :headers
}
request =
%{}
|> method(:patch)
|> url("/v1/tasks/#{id}/comments/#{comment_id}")
|> add_param(:body, :body, task_comment_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.TaskCommentMutationResponse},
{400, Spatio.Model.ApiError},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_complete_task(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_complete_task(connection, org, workspace, id, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/#{id}/complete")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Renderer-compat alias for /tasks/{id}/complete.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_complete_task_alias(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_complete_task_alias(connection, org, workspace, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/complete/task")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_create_task(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_create_task(connection, org, workspace, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Renderer-compat alias for POST /tasks.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_create_task_alias(Tesla.Env.client, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_create_task_alias(connection, org, workspace, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/task")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_delete_task(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_delete_task(connection, org, workspace, id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `id` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_get_task(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_get_task(connection, org, workspace, id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError},
{404, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_task_providers(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_task_providers(connection, org, workspace, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/providers")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_tasks(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_tasks(connection, org, workspace, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Renderer-compat alias for /tasks.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_list_tasks_alias(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_list_tasks_alias(connection, org, workspace, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/tasks")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_update_task(Tesla.Env.client, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_update_task(connection, org, workspace, id, request_body, _opts \\ []) do
request =
%{}
|> method(:patch)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/#{id}")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
@doc """
Renderer-compat alias for PATCH /tasks/{id}.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `org` (String.t):
- `workspace` (String.t):
- `id` (String.t):
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_update_task_alias(Tesla.Env.client, String.t, String.t, String.t, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def workspace_update_task_alias(connection, org, workspace, id, request_body, _opts \\ []) do
request =
%{}
|> method(:put)
|> url("/v1/organizations/#{org}/workspaces/#{workspace}/tasks/task/#{id}")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError},
{403, Spatio.Model.ApiError}
])
end
end