Current section

Files

Jump to
open_xchange_client lib open_xchange_client api tasks.ex
Raw

lib/open_xchange_client/api/tasks.ex

# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule OpenXchangeClient.Api.Tasks do
@moduledoc """
API calls for all endpoints tagged `Tasks`.
"""
alias OpenXchangeClient.Connection
import OpenXchangeClient.RequestBuilder
@doc """
Confirms a task.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the task that shall be confirmed.
- folder (String.t): Object ID of the folder who contains the tasks.
- timestamp (integer()): Timestamp of the last update of the task.
- body (TaskConfirmationBody): A JSON object with the fields `confirmation` and `confirmmessage`.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.CommonResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec confirm_task(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
integer(),
OpenXchangeClient.Model.TaskConfirmationBody.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.CommonResponse.t()} | {:error, Tesla.Env.t()}
def confirm_task(connection, session, id, folder, timestamp, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/tasks?action=confirm")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.CommonResponse{}}
])
end
@doc """
Creates a task.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- body (TaskData): A JSON object containing the task's data.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.TaskUpdateResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec create_task(
Tesla.Env.client(),
String.t(),
OpenXchangeClient.Model.TaskData.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.TaskUpdateResponse.t()} | {:error, Tesla.Env.t()}
def create_task(connection, session, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/tasks?action=new")
|> add_param(:query, :session, session)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TaskUpdateResponse{}}
])
end
@doc """
Deletes tasks.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- timestamp (integer()): Timestamp of the last update of the deleted tasks.
- body ([OpenXchangeClient.Model.TaskListElement.t]): A JSON array of JSON objects with the id and folder of the tasks.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.TaskDeletionsResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec delete_tasks(
Tesla.Env.client(),
String.t(),
integer(),
list(OpenXchangeClient.Model.TaskListElement.t()),
keyword()
) :: {:ok, OpenXchangeClient.Model.TaskDeletionsResponse.t()} | {:error, Tesla.Env.t()}
def delete_tasks(connection, session, timestamp, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/tasks?action=delete")
|> add_param(:query, :session, session)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TaskDeletionsResponse{}}
])
end
@doc """
Gets all tasks.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- folder (String.t): Object ID of the folder who contains the tasks.
- columns (String.t): A comma-separated list of columns to return, like \"1,200\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed task data](#detailed-task-data).
- opts (KeywordList): [optional] Optional parameters
- :sort (String.t): The identifier of a column which determines the sort order of the response. If this parameter is specified, then the parameter order must be also specified.
- :order (String.t): \"asc\" if the response entities should be sorted in the ascending order, \"desc\" if the response entries should be sorted in the descending order. If this parameter is specified, then the parameter sort must be also specified.
## Returns
{:ok, OpenXchangeClient.Model.TasksResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_all_tasks(Tesla.Env.client(), String.t(), String.t(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.TasksResponse.t()} | {:error, Tesla.Env.t()}
def get_all_tasks(connection, session, folder, columns, opts \\ []) do
optional_params = %{
:sort => :query,
:order => :query
}
%{}
|> method(:get)
|> url("/tasks?action=all")
|> add_param(:query, :session, session)
|> add_param(:query, :folder, folder)
|> add_param(:query, :columns, columns)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TasksResponse{}}
])
end
@doc """
Gets a task.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- id (String.t): Object ID of the requested task.
- folder (String.t): Object ID of the folder who contains the tasks.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.TaskResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_task(Tesla.Env.client(), String.t(), String.t(), String.t(), keyword()) ::
{:ok, OpenXchangeClient.Model.TaskResponse.t()} | {:error, Tesla.Env.t()}
def get_task(connection, session, id, folder, _opts \\ []) do
%{}
|> method(:get)
|> url("/tasks?action=get")
|> add_param(:query, :session, session)
|> add_param(:query, :id, id)
|> add_param(:query, :folder, folder)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TaskResponse{}}
])
end
@doc """
Gets a list of tasks.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,200\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed task data](#detailed-task-data).
- body ([OpenXchangeClient.Model.TaskListElement.t]): A JSON array of JSON objects with the id and folder of the tasks.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.TasksResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_task_list(
Tesla.Env.client(),
String.t(),
String.t(),
list(OpenXchangeClient.Model.TaskListElement.t()),
keyword()
) :: {:ok, OpenXchangeClient.Model.TasksResponse.t()} | {:error, Tesla.Env.t()}
def get_task_list(connection, session, columns, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/tasks?action=list")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TasksResponse{}}
])
end
@doc """
Gets the new, modified and deleted tasks.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- folder (String.t): Object ID of the folder who contains the tasks.
- columns (String.t): A comma-separated list of columns to return, like \"1,200\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed task data](#detailed-task-data).
- timestamp (integer()): Timestamp of the last update of the requested tasks.
- opts (KeywordList): [optional] Optional parameters
- :ignore (String.t): Which kinds of updates should be ignored. Omit this parameter or set it to \"deleted\" to not have deleted tasks identifier in the response. Set this parameter to `false` and the response contains deleted tasks identifier.
- :sort (String.t): The identifier of a column which determines the sort order of the response. If this parameter is specified, then the parameter order must be also specified.
- :order (String.t): \"asc\" if the response entities should be sorted in the ascending order, \"desc\" if the response entries should be sorted in the descending order. If this parameter is specified, then the parameter sort must be also specified.
## Returns
{:ok, OpenXchangeClient.Model.TaskUpdatesResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_task_updates(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
integer(),
keyword()
) :: {:ok, OpenXchangeClient.Model.TaskUpdatesResponse.t()} | {:error, Tesla.Env.t()}
def get_task_updates(connection, session, folder, columns, timestamp, opts \\ []) do
optional_params = %{
:ignore => :query,
:sort => :query,
:order => :query
}
%{}
|> method(:get)
|> url("/tasks?action=updates")
|> add_param(:query, :session, session)
|> add_param(:query, :folder, folder)
|> add_param(:query, :columns, columns)
|> add_param(:query, :timestamp, timestamp)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TaskUpdatesResponse{}}
])
end
@doc """
Search for tasks.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- columns (String.t): A comma-separated list of columns to return, like \"1,200\". Each column is specified by a numeric column identifier, see [Common object data](#common-object-data), [Detailed task and appointment data](#detailed-task-and-appointment-data) and [Detailed task data](#detailed-task-data).
- body (TaskSearchBody): A JSON object containing search parameters.
- opts (KeywordList): [optional] Optional parameters
- :sort (String.t): The identifier of a column which determines the sort order of the response. If this parameter is specified , then the parameter order must be also specified.
- :order (String.t): \"asc\" if the response entires should be sorted in the ascending order, \"desc\" if the response entries should be sorted in the descending order. If this parameter is specified, then the parameter sort must be also specified.
## Returns
{:ok, OpenXchangeClient.Model.TasksResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec search_tasks(
Tesla.Env.client(),
String.t(),
String.t(),
OpenXchangeClient.Model.TaskSearchBody.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.TasksResponse.t()} | {:error, Tesla.Env.t()}
def search_tasks(connection, session, columns, body, opts \\ []) do
optional_params = %{
:sort => :query,
:order => :query
}
%{}
|> method(:put)
|> url("/tasks?action=search")
|> add_param(:query, :session, session)
|> add_param(:query, :columns, columns)
|> add_param(:body, :body, body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TasksResponse{}}
])
end
@doc """
Updates a task.
## Parameters
- connection (OpenXchangeClient.Connection): Connection to server
- session (String.t): A session ID previously obtained from the login module.
- folder (String.t): Object ID of the folder who contains the tasks.
- id (String.t): Object ID of the requested task.
- timestamp (integer()): Timestamp of the last update of the requested tasks.
- body (TaskData): A JSON object containing the task's data. Only modified fields are present.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, OpenXchangeClient.Model.TaskUpdateResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec update_task(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
integer(),
OpenXchangeClient.Model.TaskData.t(),
keyword()
) :: {:ok, OpenXchangeClient.Model.TaskUpdateResponse.t()} | {:error, Tesla.Env.t()}
def update_task(connection, session, folder, id, timestamp, body, _opts \\ []) do
%{}
|> method(:put)
|> url("/tasks?action=update")
|> add_param(:query, :session, session)
|> add_param(:query, :folder, folder)
|> add_param(:query, :id, id)
|> add_param(:query, :timestamp, timestamp)
|> add_param(:body, :body, body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %OpenXchangeClient.Model.TaskUpdateResponse{}}
])
end
end