更新时间:2024-03-07 GMT+08:00
分享

高级查询我的待办工作项

功能介绍

高级查询我的待办工作项

调用方法

请参见如何调用API

URI

POST /v4/issues

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表2 请求Body参数

参数

是否必选

参数类型

描述

offset

Integer

偏移量,offset是limit的整数倍,limit=10,offset=0,10,20...

limit

Integer

每页显示数量

最小值:1

最大值:100

subject

String

搜索关键词

created_on

String

工作项创建时间区间

updated_on

String

工作项更新时间区间

closed_on

String

工作项结束时间区间

start_date

String

工作项预计开始日期区间

due_date

String

工作项预计结束日期区间

tracker_id

String

工作项类型

status_id

String

工作项状态

author_id

String

工作项创建人id

developer_id

String

工作项开发人员id

priority_id

String

工作项优先级id

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

issue_list

Array of issue_list objects

工作项信息列表

数组长度:0 - 100

total

Integer

工作项总数

表4 issue_list

参数

参数类型

描述

id

Integer

工作项id

subject

String

工作项标题

parent_issue_id

Integer

父工作项id

parent_issue

parent_issue object

父工作项信息

project

project object

项目信息

release_dev

String

发布版本

find_release_dev

String

发现发布版本

done_ratio

Integer

工作项完成度

expected_work_hours

Double

预计工时

actual_work_hours

Double

实际工时

tracker

tracker object

工作项类型信息

order

order object

优先级顺序信息

severity

severity object

重要程度信息

priority

priority object

工作项优先级信息

domain

domain object

领域信息

position

Double

排序数值

module

module object

模块信息

assigned_to

SimpleUserIn object

author

SimpleUserIn object

developer

SimpleUserIn object

closeder

SimpleUserIn object

status

status object

工作项状态信息

deleted

Boolean

是否删除工作项

is_watcher

Boolean

是否关注工作项

closed_flag

Integer

关闭标志

created_on

String

工作项新建时间戳

updated_on

String

工作项更新时间戳

due_date

String

工作项预计结束时间戳

表5 parent_issue

参数

参数类型

描述

id

Integer

父工作项id

subject

String

父工作项标题

表6 project

参数

参数类型

描述

id

Integer

项目id

identifier

String

项目uuid

name

String

项目名称

type

String

项目类型

表7 tracker

参数

参数类型

描述

id

Integer

工作项类型id

name

String

工作项类型名称

表8 order

参数

参数类型

描述

id

Integer

优先级顺序id

name

String

优先级顺序名称

表9 severity

参数

参数类型

描述

id

Integer

重要程度id

name

String

重要程度名称

表10 priority

参数

参数类型

描述

id

Integer

工作项优先级id

name

String

工作项优先级名称

表11 domain

参数

参数类型

描述

id

Integer

领域id

name

String

领域名称

表12 module

参数

参数类型

描述

id

Integer

模块id

name

String

模块名称

path_name

String

模块路径名称

表13 SimpleUserIn

参数

参数类型

描述

id

Integer

用户id

identifier

String

用户uuid

name

String

用户名称

表14 status

参数

参数类型

描述

id

Integer

工作项状态id

name

String

工作项优先级名称

状态码: 400

表15 响应Body参数

参数

参数类型

描述

error_msg

String

错误描述

error_code

String

错误码

状态码: 401

表16 响应Body参数

参数

参数类型

描述

error_msg

String

错误描述

error_code

String

错误码

请求示例

POST https://{endpoint}/v4/issues

{
  "offset" : "0",
  "limit" : "15",
  "status_id" : "5",
  "due_date" : "1682265600000,1682265600000"
}

响应示例

状态码: 200

OK

{
  "issue_list" : [ {
    "id" : 7220820,
    "subject" : "demo_issue",
    "project" : {
      "name" : "demo_project",
      "id" : 30387805,
      "identifier" : "",
      "type" : "scrum"
    },
    "done_ratio" : 0,
    "expected_work_hours" : 0.0,
    "actual_work_hours" : 0.0,
    "tracker" : {
      "id" : 7,
      "name" : "Story"
    },
    "order" : {
      "id" : 1,
      "name" : "1.0"
    },
    "severity" : {
      "id" : 12,
      "name" : "一般"
    },
    "priority" : {
      "id" : 2,
      "name" : "中"
    },
    "domain" : { },
    "position" : 7220820.0,
    "module" : { },
    "assigned_to" : {
      "id" : 4091,
      "name" : ""
    },
    "author" : {
      "id" : 4091,
      "name" : ""
    },
    "developer" : { },
    "closeder" : { },
    "status" : {
      "id" : 1,
      "name" : "新建"
    },
    "is_watcher" : false,
    "closed_flag" : 0,
    "deleted" : false,
    "created_on" : "1681783846000",
    "updated_on" : "1681783846000",
    "due_date" : "1684252800000"
  } ],
  "total" : 1
}

SDK代码示例

SDK代码示例如下。

Java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.projectman.v4.region.ProjectManRegion;
import com.huaweicloud.sdk.projectman.v4.*;
import com.huaweicloud.sdk.projectman.v4.model.*;


public class SearchIssuesSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        ProjectManClient client = ProjectManClient.newBuilder()
                .withCredential(auth)
                .withRegion(ProjectManRegion.valueOf("<YOUR REGION>"))
                .build();
        SearchIssuesRequest request = new SearchIssuesRequest();
        ListWorkTableIssueRequestV4RequestBody body = new ListWorkTableIssueRequestV4RequestBody();
        body.withStatusId("5");
        body.withDueDate("1682265600000,1682265600000");
        body.withLimit(15);
        body.withOffset(0);
        request.withBody(body);
        try {
            SearchIssuesResponse response = client.searchIssues(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkprojectman.v4 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("CLOUD_SDK_SK")

    credentials = BasicCredentials(ak, sk) \

    client = ProjectManClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ProjectManRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = SearchIssuesRequest()
        request.body = ListWorkTableIssueRequestV4RequestBody(
            status_id="5",
            due_date="1682265600000,1682265600000",
            limit=15,
            offset=0
        )
        response = client.search_issues(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := projectman.NewProjectManClient(
        projectman.ProjectManClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.SearchIssuesRequest{}
	statusIdListWorkTableIssueRequestV4RequestBody:= "5"
	dueDateListWorkTableIssueRequestV4RequestBody:= "1682265600000,1682265600000"
	limitListWorkTableIssueRequestV4RequestBody:= int32(15)
	offsetListWorkTableIssueRequestV4RequestBody:= int32(0)
	request.Body = &model.ListWorkTableIssueRequestV4RequestBody{
		StatusId: &statusIdListWorkTableIssueRequestV4RequestBody,
		DueDate: &dueDateListWorkTableIssueRequestV4RequestBody,
		Limit: &limitListWorkTableIssueRequestV4RequestBody,
		Offset: &offsetListWorkTableIssueRequestV4RequestBody,
	}
	response, err := client.SearchIssues(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

错误码

请参见错误码

分享:

    相关文档

    相关产品