Merge pull request #31 from microsoft/jasper/list_work_items_and_query_by_id

Add support for listing work items and executing query by id
This commit is contained in:
guojiubo 2024-01-05 15:50:45 +08:00 коммит произвёл GitHub
Родитель 4f7423b560 c2bf9b1b81
Коммит f4421d50dd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 36 добавлений и 0 удалений

Просмотреть файл

@ -124,6 +124,25 @@ class ADOWorkItemsClient(ADOBaseClient):
response = self.http_client.get(request_url)
return self.http_client.decode_response(response)
def list(self, identifiers: List[int], project_id: str) -> ADOResponse:
"""Get a list of work items.
:param identifiers: The list of requested work item ids
:param str project_id: The ID of the project
:returns: The ADO response with the data in it
"""
ids = ",".join(map(str, identifiers))
self.log.debug(f"Getting work items: {ids}")
request_url = (
self.http_client.api_endpoint(project_id=project_id)
+ f"/wit/workitems?api-version=4.1&ids={ids}&$expand=all"
)
response = self.http_client.get(request_url)
return self.http_client.decode_response(response)
def get_work_item_types(self, project_id: str) -> ADOResponse:
"""Get the types of work items supported by the project.
@ -460,6 +479,23 @@ class ADOWorkItemsClient(ADOBaseClient):
return self.http_client.decode_response(response)
def execute_query_by_id(self, query_id: str, project_id: str) -> ADOResponse:
"""Gets the results of the query given the query ID.
:param query_id: The query id to execute
:param str project_id: The ID of the project
:returns: The ADO response with the data in it
"""
self.log.debug(f"Executing query with id: {query_id}")
request_url = f"{self.http_client.api_endpoint(project_id=project_id)}/wit/wiql/{query_id}?api-version=4.1"
response = self.http_client.get(request_url)
return self.http_client.decode_response(response)
def delete(
self,
*,