Page: unichat API tasks
2019-11-21 11:11
Tasks
In organizations, you can create tasks. Tasks can only belong to yourself, or to any group. A task is assigned to one performer, they may also have comments and attachments. When creating a task and specifying the executor, a chat is created with this user and this task is attached to this chat. If the task sets the group and the executor, then the executor must be in this group. Anyone who belongs to the group to which the task belongs can make changes.
Create task
create_task(organization_id:<opt_long>, title:<string>, description:<opt_string>, group_id:<opt_long>, executor_id:<opt_long>, uploads_id:<opt_long>)
-> { task: <<task_record> }
with parameters:
organization_id
: organization IDtitle
: task titledescription
: task descriptiongroup_id
: If present, then attached to the groupexecutor_id
: If present, then it is attached to the group and if thegroup_id
is specified, then the user must be in this groupuploads_id
: are identifiers of attachments made through theattachment_by_chunks
method. If the string is empty, all attachments will be destroyed. Available: nil, empty string, array, number
Update task
update_task(task_id:<integer>, title:<opt_string>, description:<opt_string>, group_id:<opt_integer>, executor_id:<opt_integer>, uploads_id:<opt_integer>, organization_id: <opt_long>, done: <opt_boolean>)
-> { task: <<task_record> }
with parameters:
task_id
: task IDtitle
: task titledescription
: task descriptiongroup_id
: If present, then attached to the group. If the group was previously specified, then you cannot change it.executor_id
: If present, then it is attached to the group and if thegroup_id
is specified, then the user must be in this groupuploads_id
: are identifiers of attachments made through theattachment_by_chunks
method. If the string is empty, all attachments will be destroyed. Available: nil, empty string, array, numberorganization_id
: organization IDdone
: if TRUE, then the task is completed.
Destroy task attachment
To destroy an attachment, you can call the method:
destroy_task_attachment(task_id:<long>, signed_id:<string>)
-> {<task_record>}
with parameters:
task_id
: task IDsigned_id
: special attachment identifier, attribute of attachment record in task
Destroy task
Destroy task with all comments and attachments.
destroy_task(task_id:<long>)
-> {}
with parameters:
task_id
: task ID
When the task was deleted, all attached messages to this task will change the text to To-Do was deleted
.
List of organization tasks
organization_tasks(organization_id:<long>)
-> { tasks: [<<task_record>,...] }
organization_id
: Organization ID
List of group tasks
group_tasks(subscription_id:<long>)
-> { tasks: [<<task_record>,...] }
subscription_id
: Subscription ID
List of user tasks
user_tasks(organization_id:<opt_long>, user_id:<opt_long>)
-> { tasks: [<<task_record>,...] }
organization_id
: Organization ID; if specified, used within this organizationuser_id
: User ID; if not specified, the current user is used
Create sub-task
A task may contain subtasks in the form of a checklist with statuses done/undone.
create_subtask(task_id:<long>, text:<string>)
-> { subtask: <<subtask_record> }
with parameters:
task_id
: task IDtext
: sub-task title
Update sub-task
A task may contain subtasks in the form of a list.
update_subtask(subtask_id:<long>, text:<string>, done:<opt_boolean>)
-> { subtask: <<subtask_record> }
with parameters:
subtask_id
: task IDtext
: sub-task titledone
: status of sub-task (true/false)
Destroy sub-task
A task may contain subtasks in the form of a list.
delete_subtask(subtask_id:<long>)
-> {}
with parameters:
subtask_id
: sub-task ID
Sort order of sub-tasks
subtasks_ordering(task_id:<long>, subtasks:<long>)
-> { task: <<task_record> }
with parameters:
task_id
: task IDsubtasks
: array of identifiers of sub-tasks, example: [6, 3, 5, 4, 1, 2]
Add comment
create_task_comment(task_id:<long>, text:<string>)
-> { task_comment: <<task_comment_record> }
with parameters:
task_id
: task IDtext
: sub-task title
Load comments
task_comments(task_id:<long>, limit:<opt_integer>, offset:<opt_integer>, before_id:<opt_long>)
-> { comments: [<<task_comment_record>,...] }
with parameters:
task_id
: task IDlimit
andoffset
allow paging in usual sense. Defaultlimit
is 50, defaultoffset
is 0.before_id
if present, select comments that are older than a given id, in most recent first.
Destroy comment
A task may contain subtasks in the form of a list.
delete_task_comment(comment_id:<long>)
-> {}
with parameters:
comment_id
: comment ID