10
10
from dataclasses import dataclass
11
11
from typing import Any , Callable , Dict , List , Optional
12
12
13
+ import requests
14
+
13
15
from annofabapi import AnnofabApi
14
16
from annofabapi .exceptions import AnnofabApiException
15
17
from annofabapi .models import (
@@ -623,19 +625,17 @@ def put_input_data_from_file(
623
625
#########################################
624
626
# Public Method : Statistics
625
627
#########################################
626
- def get_worktime_statistics (self , project_id : str ) -> List [ Any ] :
628
+ def _request_location_header_url (self , response : requests . Response ) -> Any :
627
629
"""
628
- タスク作業時間集計取得.
629
- Location Headerに記載されたURLのレスポンスをJSON形式で返す。
630
+ Location headerに記載されているURLの中身を返す。
630
631
631
632
Args:
632
- project_id: プロジェクトID
633
+ response:
633
634
634
635
Returns:
635
- タスク作業時間集計
636
+ Location headerに記載されているURLの中身
636
637
637
638
"""
638
- _ , response = self .api .get_worktime_statistics (project_id )
639
639
url = response .headers ["Location" ]
640
640
641
641
response = self .api .session .get (url )
@@ -646,6 +646,87 @@ def get_worktime_statistics(self, project_id: str) -> List[Any]:
646
646
content = self .api ._response_to_content (response )
647
647
return content
648
648
649
+ def get_task_statistics (self , project_id : str ) -> List [Any ]:
650
+ """
651
+ getTaskStatistics APIのLocation headerの中身を返す。
652
+
653
+ Args:
654
+ project_id: プロジェクトID
655
+
656
+ Returns:
657
+
658
+
659
+ """
660
+ _ , response = self .api .get_task_statistics (project_id )
661
+ return self ._request_location_header_url (response )
662
+
663
+ def get_account_statistics (self , project_id : str ) -> List [Any ]:
664
+ """
665
+ getAccountStatistics APIのLocation headerの中身を返す。
666
+
667
+ Args:
668
+ project_id:
669
+
670
+ Returns:
671
+
672
+ """
673
+ _ , response = self .api .get_account_statistics (project_id )
674
+ return self ._request_location_header_url (response )
675
+
676
+ def get_inspection_statistics (self , project_id : str ) -> List [Any ]:
677
+ """
678
+ getInspectionStatistics APIのLocation headerの中身を返す。
679
+
680
+ Args:
681
+ project_id:
682
+
683
+ Returns:
684
+
685
+ """
686
+ _ , response = self .api .get_inspection_statistics (project_id )
687
+ return self ._request_location_header_url (response )
688
+
689
+ def get_task_phase_statistics (self , project_id : str ) -> List [Any ]:
690
+ """
691
+ getTaskPhaseStatistics APIのLocation headerの中身を返す。
692
+
693
+ Args:
694
+ project_id:
695
+
696
+ Returns:
697
+
698
+ """
699
+ _ , response = self .api .get_task_phase_statistics (project_id )
700
+ return self ._request_location_header_url (response )
701
+
702
+ def get_label_statistics (self , project_id : str ) -> List [Any ]:
703
+ """
704
+ getLabelStatistics APIのLocation headerの中身を返す。
705
+
706
+ Args:
707
+ project_id:
708
+
709
+ Returns:
710
+
711
+ """
712
+ _ , response = self .api .get_label_statistics (project_id )
713
+ return self ._request_location_header_url (response )
714
+
715
+ def get_worktime_statistics (self , project_id : str ) -> List [Any ]:
716
+ """
717
+ タスク作業時間集計取得.
718
+ Location Headerに記載されたURLのレスポンスをJSON形式で返す。
719
+
720
+ Args:
721
+ project_id: プロジェクトID
722
+
723
+ Returns:
724
+ タスク作業時間集計
725
+
726
+ """
727
+ _ , response = self .api .get_worktime_statistics (project_id )
728
+ return self ._request_location_header_url (response )
729
+
649
730
#########################################
650
731
# Public Method : Supplementary
651
732
#########################################
0 commit comments