Skip to content

Commit

Permalink
Annofab v0.136.0対応 (#418)
Browse files Browse the repository at this point in the history
* version up

* 不要な関数を削除

* comment

* versbose削除

* deprecation情報を付与

* comment

* update models.py

* inspectio status
  • Loading branch information
yuji38kwmt committed Mar 3, 2022
1 parent d7be7bb commit 32d6c7c
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 824 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ init:

format:
poetry run autoflake --in-place --remove-all-unused-imports --ignore-init-module-imports --recursive annofabapi tests
poetry run isort --verbose annofabapi tests
poetry run isort annofabapi tests
poetry run black annofabapi tests

lint:
Expand Down
9 changes: 7 additions & 2 deletions annofabapi/dataclass/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
annofabapiのmodelをDataClassで定義したクラス
Note:
このファイルはopenapi-generatorで自動生成される。詳細は generate/README.mdを参照.
oneOf, allOfなどは正しく表現できない可能性がある
Inspection Commmentに関するWebAPIは 2022-08-23以降に廃止される予定です。
廃止予定日などの情報をdecoratorで設定するため、このファイルは自動生成ではなく手動で生成しています
"""

import warnings # pylint: disable=unused-import
Expand All @@ -15,15 +15,20 @@

from dataclasses_json import DataClassJsonMixin

from annofabapi._utils import deprecated_class
from annofabapi.models import InspectionStatus, TaskPhase

InspectionData = Dict[str, Any]


@deprecated_class(deprecated_date="2022-08-23")
@dataclass
class Inspection(DataClassJsonMixin):
"""
検査コメント
.. deprecated:: 2022-08-23以降に廃止する予定です。
"""

project_id: str
Expand Down
183 changes: 28 additions & 155 deletions annofabapi/generated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,13 @@ def put_annotation_specs(
#########################################

def batch_update_comments(
self, project_id: str, task_id: str, input_data_id: str, request_body: Optional[Any] = None, **kwargs
self,
project_id: str,
task_id: str,
input_data_id: str,
query_params: Optional[Dict[str, Any]] = None,
request_body: Optional[Any] = None,
**kwargs,
) -> Tuple[Any, requests.Response]:
"""コメント一括更新
https://annofab.com/docs/api/#operation/batchUpdateComments
Expand All @@ -619,12 +625,14 @@ def batch_update_comments(
authorizations: AllProjectMember
コメントを一括更新します。 タスクの現在の担当者でない場合、またはタスクの状態が「作業中」でない場合は409エラーになります。 リクエストボディは、1個以上の「操作」オブジェクトを含むJSON配列になります。 操作オブジェクトには、「更新(作成含む)」と「削除」の2通りがあり、それぞれJSONオブジェクト構造が異なります。 これら操作オブジェクトを複数含めることで、1リクエストで複数の更新や削除ができます。 既に作成済みのコメントのうち、リクエストボディの配列に含まれないものは更新されません。 複数の操作のうち、1つでも失敗するとAPIのレスポンス全体としては失敗になります。 成功した部分までは反映されます。 **このAPIでは検査コメントのデータは更新できません(今後対応予定)。**
コメントを一括更新します。 タスクの現在の担当者でない場合、またはタスクの状態が「作業中」でない場合は409エラーになります。 リクエストボディは、1個以上の「操作」オブジェクトを含むJSON配列になります。 操作オブジェクトには、「更新(作成含む)」と「削除」の2通りがあり、それぞれJSONオブジェクト構造が異なります。 これら操作オブジェクトを複数含めることで、1リクエストで複数の更新や削除ができます。 既に作成済みのコメントのうち、リクエストボディの配列に含まれないものは更新されません。 複数の操作のうち、1つでも失敗するとAPIのレスポンス全体としては失敗になります。 成功した部分までは反映されます。
Args:
project_id (str): プロジェクトID (required)
task_id (str): タスクID (required)
input_data_id (str): 入力データID (required)
query_params (Dict[str, Any]): Query Parameters
v (str): 2 を指定した場合、検査コメントのデータも含めたコメントデータを返します。 パラメーターの指定がない、あるいは値が 2 以外の場合は検査コメントを除いたコメントデータを返します。
request_body (Any): Request Body
batch_comment_request_item (List[BatchCommentRequestItem]): (required)
Expand All @@ -636,13 +644,14 @@ def batch_update_comments(
url_path = f"/projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/comments"
http_method = "POST"
keyword_params: Dict[str, Any] = {
"query_params": query_params,
"request_body": request_body,
}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_comments(
self, project_id: str, task_id: str, input_data_id: str, **kwargs
self, project_id: str, task_id: str, input_data_id: str, query_params: Optional[Dict[str, Any]] = None, **kwargs
) -> Tuple[Any, requests.Response]:
"""コメント一括取得
https://annofab.com/docs/api/#operation/getComments
Expand All @@ -651,12 +660,14 @@ def get_comments(
authorizations: AllProjectMember
指定されたタスクで、指定された入力データにつけられたコメントをすべて取得します。 **このAPIでは検査コメントのデータは取得できません(今後対応予定)。**
指定されたタスクで、指定された入力データにつけられたコメントをすべて取得します。
Args:
project_id (str): プロジェクトID (required)
task_id (str): タスクID (required)
input_data_id (str): 入力データID (required)
query_params (Dict[str, Any]): Query Parameters
v (str): 2 を指定した場合、検査コメントのデータも含めたコメントデータを返します。 パラメーターの指定がない、あるいは値が 2 以外の場合は検査コメントを除いたコメントデータを返します。
Returns:
Tuple[List[Comment], requests.Response]
Expand All @@ -665,7 +676,9 @@ def get_comments(
"""
url_path = f"/projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/comments"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params: Dict[str, Any] = {
"query_params": query_params,
}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

Expand Down Expand Up @@ -863,6 +876,7 @@ def batch_update_inspections(
"""検査コメント一括更新
https://annofab.com/docs/api/#operation/batchUpdateInspections
.. deprecated:: X
authorizations: AllProjectMember
Expand All @@ -881,6 +895,11 @@ def batch_update_inspections(
"""
warnings.warn(
"annofabapi.AnnofabApi.batch_update_inspections() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/inspections"
http_method = "POST"
keyword_params: Dict[str, Any] = {
Expand All @@ -895,6 +914,7 @@ def get_inspections(
"""検査コメント一括取得
https://annofab.com/docs/api/#operation/getInspections
.. deprecated:: X
authorizations: AllProjectMember
Expand All @@ -911,6 +931,9 @@ def get_inspections(
"""
warnings.warn(
"annofabapi.AnnofabApi.get_inspections() is deprecated and will be removed.", FutureWarning, stacklevel=2
)
url_path = f"/projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/inspections"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
Expand Down Expand Up @@ -2525,36 +2548,6 @@ def get_account_daily_statistics(
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_account_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""ユーザー別タスク集計ファイルへのURL取得
https://annofab.com/docs/api/#operation/getAccountStatistics
.. deprecated:: X
authorizations: AllProjectMember
[ユーザー別タスク集計データ](#section/ArrayOfProjectAccountStatistics) を取得するための認証済み一時URLを取得します。
Args:
project_id (str): プロジェクトID (required)
Returns:
Tuple[TemporaryUrl, requests.Response]
"""
warnings.warn(
"annofabapi.AnnofabApi.get_account_statistics() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/statistics/accounts"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_inspection_daily_statistics(
self, project_id: str, query_params: Optional[Dict[str, Any]] = None, **kwargs
) -> Tuple[Any, requests.Response]:
Expand Down Expand Up @@ -2586,36 +2579,6 @@ def get_inspection_daily_statistics(
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_inspection_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""検査コメント集計ファイルへのURL取得
https://annofab.com/docs/api/#operation/getInspectionStatistics
.. deprecated:: X
authorizations: AllProjectMember
[検査コメント集計データ](#section/ArrayOfInspectionStatistics) を取得するための認証済み一時URLを取得します。
Args:
project_id (str): プロジェクトID (required)
Returns:
Tuple[TemporaryUrl, requests.Response]
"""
warnings.warn(
"annofabapi.AnnofabApi.get_inspection_statistics() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/statistics/inspections"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_label_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""ラベル別アノテーション数集計取得
https://annofab.com/docs/api/#operation/getLabelStatistics
Expand Down Expand Up @@ -2750,66 +2713,6 @@ def get_task_daily_statistics(
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_task_phase_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""フェーズ別タスク集計ファイルへのURL取得
https://annofab.com/docs/api/#operation/getTaskPhaseStatistics
.. deprecated:: X
authorizations: AllProjectMember
[フェーズ別タスク集計データ](#section/ArrayOfTaskPhaseStatistics) を取得するための認証済み一時URLを取得します。
Args:
project_id (str): プロジェクトID (required)
Returns:
Tuple[TemporaryUrl, requests.Response]
"""
warnings.warn(
"annofabapi.AnnofabApi.get_task_phase_statistics() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/statistics/task-phases"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_task_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""タスク集計ファイルへのURL取得
https://annofab.com/docs/api/#operation/getTaskStatistics
.. deprecated:: X
authorizations: AllProjectMember
[タスク集計データ](#section/ArrayOfProjectTaskStatisticsHistory) を取得するための認証済み一時URLを取得します。
Args:
project_id (str): プロジェクトID (required)
Returns:
Tuple[TemporaryUrl, requests.Response]
"""
warnings.warn(
"annofabapi.AnnofabApi.get_task_statistics() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/statistics/tasks"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_worktime_daily_statistics(
self, project_id: str, query_params: Optional[Dict[str, Any]] = None, **kwargs
) -> Tuple[Any, requests.Response]:
Expand Down Expand Up @@ -2873,36 +2776,6 @@ def get_worktime_daily_statistics_by_account(
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def get_worktime_statistics(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]:
"""タスク作業時間集計ファイルへのURL取得
https://annofab.com/docs/api/#operation/getWorktimeStatistics
.. deprecated:: X
authorizations: AllProjectMember
[タスク作業時間集計データ](#section/ArrayOfWorktimeStatistics) を取得するための認証済み一時URLを取得します。
Args:
project_id (str): プロジェクトID (required)
Returns:
Tuple[TemporaryUrl, requests.Response]
"""
warnings.warn(
"annofabapi.AnnofabApi.get_worktime_statistics() is deprecated and will be removed.",
FutureWarning,
stacklevel=2,
)
url_path = f"/projects/{project_id}/statistics/worktimes"
http_method = "GET"
keyword_params: Dict[str, Any] = {}
keyword_params.update(**kwargs)
return self._request_wrapper(http_method, url_path, **keyword_params)

def put_markers(
self, project_id: str, request_body: Optional[Any] = None, **kwargs
) -> Tuple[Any, requests.Response]:
Expand Down

0 comments on commit 32d6c7c

Please sign in to comment.