Skip to content

任务 (task)

任务管理,支持获取任务列表,支持获取执行下的任务、创建任务、获取任务详情、修改任务、删除任务、激活任务、关闭任务、完成任务、启动任务

动作概览

SDK 动作说明方法路径
list获取任务列表,支持获取执行下的任务GET/{scope}/{scopeID}/tasks
create创建任务POST/tasks
get获取任务详情GET/tasks/{taskID}
update修改任务PUT/tasks/{taskID}
delete删除任务DELETE/tasks/{taskID}
activate激活任务PUT/tasks/{taskID}/activate
close关闭任务PUT/tasks/{taskID}/close
finish完成任务PUT/tasks/{taskID}/finish
start启动任务PUT/tasks/{taskID}/start

获取任务列表,支持获取执行下的任务

  • SDK 调用:request("task/list", params)
  • HTTP:GET /{scope}/{scopeID}/tasks
  • 动作类型:list

路径参数

参数说明
scope任务范围
scopeID范围ID

查询参数

参数类型必填默认值说明
statusstringunclosed状态,默认是unclosed
all 全部
unclosed 未关闭
assignedtome 指派给我
assignedtome 指派给我
myinvolved 由我参与
assignedbyme 由我指派
orderBystring排序
id_asc ID 升序
id_desc ID 降序
name_asc 名称 升序
name_desc 名称 降序
status_asc 状态 升序
status_desc 状态 降序
recPerPagenumber每页数量,不超过1000
pageIDnumber页码,从第1页开始

请求体

无请求体。

返回值

  • 返回形态:list
  • 结果字段:tasks
  • 分页字段:pager

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/list", {
  "scope": "<string>",
  "scopeID": 1,
  "status": "unclosed",
  "orderBy": "id_asc",
  "recPerPage": 1,
  "pageID": 1
});

创建任务

  • SDK 调用:request("task/create", params)
  • HTTP:POST /tasks
  • 动作类型:create

路径参数

无路径参数。

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "任务名称"
    },
    "executionID": {
      "type": "integer",
      "description": "所属执行",
      "format": "int32"
    },
    "type": {
      "type": "string",
      "description": "任务类型"
    },
    "assignedTo": {
      "type": "string",
      "description": "指派给"
    },
    "estStarted": {
      "type": "string",
      "description": "预计开始"
    },
    "deadline": {
      "type": "string",
      "description": "截止日期"
    },
    "pri": {
      "type": "integer",
      "description": "优先级",
      "format": "int32"
    },
    "estimate": {
      "type": "number",
      "description": "预计工时",
      "format": "float"
    },
    "module": {
      "type": "integer",
      "description": "所属模块",
      "format": "int32"
    },
    "story": {
      "type": "integer",
      "description": "相关需求",
      "format": "int32"
    },
    "desc": {
      "type": "string",
      "description": "任务描述"
    }
  },
  "required": [
    "name",
    "executionID"
  ]
}

示例:

json
{
  "name": "<string>",
  "executionID": 1,
  "type": "<string>",
  "assignedTo": "<string>",
  "estStarted": "<string>",
  "deadline": "<string>",
  "pri": 1,
  "estimate": 1,
  "module": 1,
  "story": 1,
  "desc": "<string>"
}

返回值

  • 返回形态:object

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/create", {
  "name": "<string>",
  "executionID": 1,
  "type": "<string>",
  "assignedTo": "<string>",
  "estStarted": "<string>",
  "deadline": "<string>",
  "pri": 1,
  "estimate": 1,
  "module": 1,
  "story": 1,
  "desc": "<string>"
});

获取任务详情

  • SDK 调用:request("task/get", params)
  • HTTP:GET /tasks/{taskID}
  • 动作类型:get

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

无请求体。

返回值

  • 返回形态:object

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/get", {
  "taskID": 1
});

修改任务

  • SDK 调用:request("task/update", params)
  • HTTP:PUT /tasks/{taskID}
  • 动作类型:update

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "任务名称"
    },
    "type": {
      "type": "string",
      "description": "任务类型"
    },
    "assignedTo": {
      "type": "string",
      "description": "指派给"
    },
    "estStarted": {
      "type": "string",
      "description": "预计开始"
    },
    "deadline": {
      "type": "string",
      "description": "截止日期"
    },
    "pri": {
      "type": "integer",
      "description": "优先级",
      "format": "int32"
    },
    "estimate": {
      "type": "number",
      "description": "预计工时",
      "format": "float"
    },
    "module": {
      "type": "integer",
      "description": "所属模块",
      "format": "int32"
    },
    "story": {
      "type": "integer",
      "description": "相关需求",
      "format": "int32"
    },
    "desc": {
      "type": "string",
      "description": "任务描述"
    }
  }
}

示例:

json
{
  "name": "<string>",
  "type": "<string>",
  "assignedTo": "<string>",
  "estStarted": "<string>",
  "deadline": "<string>",
  "pri": 1,
  "estimate": 1,
  "module": 1,
  "story": 1,
  "desc": "<string>"
}

返回值

  • 返回形态:object

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/update", {
  "taskID": 1,
  "name": "<string>",
  "type": "<string>",
  "assignedTo": "<string>",
  "estStarted": "<string>",
  "deadline": "<string>",
  "pri": 1,
  "estimate": 1,
  "module": 1,
  "story": 1,
  "desc": "<string>"
});

删除任务

  • SDK 调用:request("task/delete", params)
  • HTTP:DELETE /tasks/{taskID}
  • 动作类型:delete

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

无请求体。

返回值

  • 返回形态:text

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/delete", {
  "taskID": 1
});

激活任务

  • SDK 调用:request("task/activate", params)
  • HTTP:PUT /tasks/{taskID}/activate
  • 动作类型:action

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "left": {
      "type": "number",
      "description": "预计剩余",
      "format": "float"
    },
    "assignedTo": {
      "type": "string",
      "description": "指派给"
    },
    "comment": {
      "type": "string",
      "description": "备注"
    }
  }
}

示例:

json
{
  "left": 1,
  "assignedTo": "<string>",
  "comment": "<string>"
}

返回值

  • 返回形态:text

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/activate", {
  "taskID": 1,
  "left": 1,
  "assignedTo": "<string>",
  "comment": "<string>"
});

关闭任务

  • SDK 调用:request("task/close", params)
  • HTTP:PUT /tasks/{taskID}/close
  • 动作类型:action

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "comment": {
      "type": "string",
      "description": "备注"
    }
  }
}

示例:

json
{
  "comment": "<string>"
}

返回值

  • 返回形态:text

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/close", {
  "taskID": 1,
  "comment": "<string>"
});

完成任务

  • SDK 调用:request("task/finish", params)
  • HTTP:PUT /tasks/{taskID}/finish
  • 动作类型:action

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "currentConsumed": {
      "type": "number",
      "description": "本次消耗",
      "format": "float"
    },
    "assignedTo": {
      "type": "string",
      "description": "任务名称"
    },
    "consumed": {
      "type": "number",
      "description": "总计消耗",
      "format": "float"
    },
    "realStarted": {
      "type": "string",
      "description": "实际开始"
    },
    "finishedDate": {
      "type": "string",
      "description": "实际完成"
    },
    "comment": {
      "type": "string",
      "description": "备注"
    }
  },
  "required": [
    "currentConsumed",
    "realStarted",
    "finishedDate"
  ]
}

示例:

json
{
  "currentConsumed": 1,
  "assignedTo": "<string>",
  "consumed": 1,
  "realStarted": "<string>",
  "finishedDate": "<string>",
  "comment": "<string>"
}

返回值

  • 返回形态:text

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/finish", {
  "taskID": 1,
  "currentConsumed": 1,
  "assignedTo": "<string>",
  "consumed": 1,
  "realStarted": "<string>",
  "finishedDate": "<string>",
  "comment": "<string>"
});

启动任务

  • SDK 调用:request("task/start", params)
  • HTTP:PUT /tasks/{taskID}/start
  • 动作类型:action

路径参数

参数说明
taskID任务ID

查询参数

无查询参数。

请求体

请求体必填:是

Schema:

json
{
  "type": "object",
  "properties": {
    "assignedTo": {
      "type": "string",
      "description": "任务名称"
    },
    "realStarted": {
      "type": "string",
      "description": "实际开始"
    },
    "consumed": {
      "type": "number",
      "description": "总计消耗",
      "format": "float"
    },
    "left": {
      "type": "number",
      "description": "预计剩余",
      "format": "float"
    },
    "comment": {
      "type": "string",
      "description": "备注"
    }
  },
  "required": [
    "realStarted"
  ]
}

示例:

json
{
  "assignedTo": "<string>",
  "realStarted": "<string>",
  "consumed": 1,
  "left": 1,
  "comment": "<string>"
}

返回值

  • 返回形态:text

SDK 示例

ts
import { request } from 'zentao-api';

const result = await request("task/start", {
  "taskID": 1,
  "assignedTo": "<string>",
  "realStarted": "<string>",
  "consumed": 1,
  "left": 1,
  "comment": "<string>"
});

Released under the MIT License.