Tapi 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. tapi/__init__.py +2 -0
  2. tapi/api/__init__.py +46 -0
  3. tapi/api/action/__init__.py +7 -0
  4. tapi/api/action/actions.py +106 -0
  5. tapi/api/action/events.py +33 -0
  6. tapi/api/action/logs.py +34 -0
  7. tapi/api/admin/__init__.py +12 -0
  8. tapi/api/admin/action_egress_control_rules.py +87 -0
  9. tapi/api/admin/admin.py +43 -0
  10. tapi/api/admin/ip_access_control.py +76 -0
  11. tapi/api/admin/job.py +42 -0
  12. tapi/api/admin/scim.py +27 -0
  13. tapi/api/admin/template.py +86 -0
  14. tapi/api/admin/user.py +104 -0
  15. tapi/api/audit_log/__init__.py +5 -0
  16. tapi/api/audit_log/audit_logs.py +24 -0
  17. tapi/api/case/__init__.py +20 -0
  18. tapi/api/case/actions.py +90 -0
  19. tapi/api/case/activities.py +35 -0
  20. tapi/api/case/assignees.py +21 -0
  21. tapi/api/case/blocks.py +112 -0
  22. tapi/api/case/cases.py +132 -0
  23. tapi/api/case/comments.py +102 -0
  24. tapi/api/case/fields.py +69 -0
  25. tapi/api/case/files.py +77 -0
  26. tapi/api/case/inputs.py +64 -0
  27. tapi/api/case/linked_cases.py +57 -0
  28. tapi/api/case/metadata.py +65 -0
  29. tapi/api/case/notes.py +78 -0
  30. tapi/api/case/records.py +54 -0
  31. tapi/api/case/subscribers.py +56 -0
  32. tapi/api/credential/__init__.py +1 -0
  33. tapi/api/credential/credentials.py +240 -0
  34. tapi/api/event/__init__.py +1 -0
  35. tapi/api/event/events.py +44 -0
  36. tapi/api/folder/__init__.py +1 -0
  37. tapi/api/folder/folders.py +71 -0
  38. tapi/api/note/__init__.py +5 -0
  39. tapi/api/note/notes.py +76 -0
  40. tapi/api/record/__init__.py +7 -0
  41. tapi/api/record/artifacts.py +17 -0
  42. tapi/api/record/records.py +85 -0
  43. tapi/api/record/types.py +52 -0
  44. tapi/api/report/__init__.py +5 -0
  45. tapi/api/report/reporting.py +41 -0
  46. tapi/api/resource/__init__.py +1 -0
  47. tapi/api/resource/resources.py +152 -0
  48. tapi/api/story/__init__.py +10 -0
  49. tapi/api/story/change_requests.py +64 -0
  50. tapi/api/story/drafts.py +45 -0
  51. tapi/api/story/groups.py +38 -0
  52. tapi/api/story/runs.py +43 -0
  53. tapi/api/story/stories.py +162 -0
  54. tapi/api/story/versions.py +65 -0
  55. tapi/api/team/__init__.py +4 -0
  56. tapi/api/team/members.py +62 -0
  57. tapi/api/team/teams.py +60 -0
  58. tapi/api/tenant.py +68 -0
  59. tapi/client/__init__.py +1 -0
  60. tapi/client/client.py +55 -0
  61. tapi/utils/helpers.py +9 -0
  62. tapi/utils/http.py +8 -0
  63. tapi/utils/testing_decorators.py +5 -0
  64. tapi/utils/types.py +300 -0
  65. tapi-0.1.2.dist-info/METADATA +2487 -0
  66. tapi-0.1.2.dist-info/RECORD +69 -0
  67. tapi-0.1.2.dist-info/WHEEL +5 -0
  68. tapi-0.1.2.dist-info/licenses/LICENSE +674 -0
  69. tapi-0.1.2.dist-info/top_level.txt +1 -0
tapi/api/admin/user.py ADDED
@@ -0,0 +1,104 @@
1
+ from tapi.client import Client
2
+ from datetime import datetime
3
+ from typing import Optional, List, Literal, Union
4
+
5
+
6
+ class UsersAPI(Client):
7
+ def __init__(self, domain: str, apiKey: str):
8
+ super().__init__(domain, apiKey)
9
+ self.base_endpoint = "admin"
10
+
11
+ def create(
12
+ self,
13
+ email: str,
14
+ first_name: Optional[str] = None,
15
+ last_name: Optional[str] = None,
16
+ admin: bool = False,
17
+ tenant_permissions: Optional[List[Literal["AUDIT_LOG_READ", "FEATURE_FLAG_MANAGE", "TUNNEL_MANAGE"]]] = None,
18
+ is_active: bool = True
19
+ ):
20
+ return self._http_request(
21
+ "POST",
22
+ f"{self.base_endpoint}/users",
23
+ json = {key: value for key, value in locals().items() if value is not None and key != "self"}
24
+ )
25
+
26
+ def get(
27
+ self,
28
+ user_id: int
29
+ ):
30
+ return self._http_request(
31
+ "GET",
32
+ f"{self.base_endpoint}/users/{user_id}"
33
+ )
34
+
35
+ def sign_in_activity(
36
+ self,
37
+ user_id: int,
38
+ before: Optional[Union[datetime, str]] = None,
39
+ after: Optional[Union[datetime, str]] = None,
40
+ per_page: int = 10,
41
+ page: int = 1
42
+ ):
43
+ return self._http_request(
44
+ "GET",
45
+ f"{self.base_endpoint}/users/{user_id}/signin_activities",
46
+ params = {key: value for key, value in locals().items()
47
+ if value is not None and key not in ("self", "user_id")}
48
+ )
49
+
50
+ def update(
51
+ self,
52
+ user_id: int,
53
+ email: Optional[str] = None,
54
+ first_name: Optional[str] = None,
55
+ last_name: Optional[str] = None,
56
+ admin: Optional[bool] = None,
57
+ tenant_permissions: Optional[List[Literal["AUDIT_LOG_READ", "FEATURE_FLAG_MANAGE", "TUNNEL_MANAGE"]]] = None,
58
+ is_active: Optional[bool] = None
59
+ ):
60
+ return self._http_request(
61
+ "PUT",
62
+ f"{self.base_endpoint}/users/{user_id}",
63
+ json = {key: value for key, value in locals().items()
64
+ if value is not None and key not in ("self", "user_id")}
65
+ )
66
+
67
+ def list(
68
+ self,
69
+ per_page: int = 10,
70
+ page: int = 1,
71
+ filter: Optional[Literal["TENANT_OWNER"]] = None
72
+ ):
73
+ return self._http_request(
74
+ "GET",
75
+ f"{self.base_endpoint}/users",
76
+ params = {key: value for key, value in locals().items() if value is not None and key != "self"}
77
+ )
78
+
79
+ def delete(
80
+ self,
81
+ user_id: int
82
+ ):
83
+ return self._http_request(
84
+ "DELETE",
85
+ f"{self.base_endpoint}/users/{user_id}"
86
+ )
87
+
88
+ def resend_invitation(
89
+ self,
90
+ user_id: int
91
+ ):
92
+ return self._http_request(
93
+ "POST",
94
+ f"{self.base_endpoint}/users/{user_id}/resend_invitation"
95
+ )
96
+
97
+ def expire_session(
98
+ self,
99
+ user_id: int
100
+ ):
101
+ return self._http_request(
102
+ "POST",
103
+ f"{self.base_endpoint}/users/{user_id}/expire_session"
104
+ )
@@ -0,0 +1,5 @@
1
+ from .audit_logs import AuditLogsAPI
2
+
3
+ __all__ = [
4
+ "AuditLogsAPI"
5
+ ]
@@ -0,0 +1,24 @@
1
+ from tapi.client import Client
2
+ from tapi.utils.types import AuditLogType
3
+ from typing import Optional, List, Union
4
+
5
+
6
+ class AuditLogsAPI(Client):
7
+ def __init__(self, domain: str, apiKey: str):
8
+ super().__init__(domain, apiKey)
9
+ self.base_endpoint = "audit_logs"
10
+
11
+ def list(
12
+ self,
13
+ before: Optional[int] = None,
14
+ after: Optional[int] = None,
15
+ user_id: Optional[List[int]] = None,
16
+ operation_name: Optional[List[Union[AuditLogType, str]]] = None,
17
+ per_page: int = 10,
18
+ page: int = 1
19
+ ):
20
+ return self._http_request(
21
+ "GET",
22
+ self.base_endpoint,
23
+ params = {key: value for key, value in locals().items() if value is not None and key != "self"}
24
+ )
@@ -0,0 +1,20 @@
1
+ from .cases import CasesAPI
2
+ from .notes import CaseNotesAPI
3
+ from .files import CaseFilesAPI
4
+ from .fields import CaseFieldsAPI
5
+ from .records import CaseRecordsAPI
6
+ from .actions import CaseActionsAPI
7
+ from .linked_cases import LinkedCasesAPI
8
+ from .metadata import CaseMetadataAPI
9
+ from .assignees import CaseAssigneesAPI
10
+ from .activities import CaseActivitiesAPI
11
+ from .subscribers import CaseSubscribersAPI
12
+ from .inputs import CaseInputsAPI, CaseInputsFieldsAPI
13
+ from .blocks import CaseBlocksAPI, CaseBlockElementsAPI
14
+ from .comments import CaseCommentsAPI, CaseCommentsReactionsAPI
15
+
16
+ __all__ = [
17
+ "CasesAPI", "CaseActionsAPI", "CaseAssigneesAPI", "CaseActivitiesAPI", "CaseInputsAPI", "CaseInputsFieldsAPI",
18
+ "CaseCommentsAPI", "CaseCommentsReactionsAPI", "CaseFieldsAPI", "CaseFilesAPI", "LinkedCasesAPI", "CaseMetadataAPI",
19
+ "CaseNotesAPI", "CaseRecordsAPI", "CaseSubscribersAPI", "CaseBlocksAPI", "CaseBlockElementsAPI"
20
+ ]
@@ -0,0 +1,90 @@
1
+ from tapi.client import Client
2
+ from tapi.utils.types import CaseActionType
3
+ from typing import List, Optional, Dict, Any, Union
4
+
5
+
6
+ class CaseActionsAPI(Client):
7
+ def __init__(self, domain: str, apiKey: str):
8
+ super().__init__(domain, apiKey)
9
+ self.base_endpoint = "cases"
10
+
11
+ def create(
12
+ self,
13
+ case_id: int,
14
+ url: str,
15
+ label: str,
16
+ action_type: Union[CaseActionType, str],
17
+ action_text: Optional[str] = None
18
+ ):
19
+ return self._http_request(
20
+ "POST",
21
+ f"{self.base_endpoint}/{case_id}/actions",
22
+ "v2",
23
+ json={key: value for key, value in locals().items() if
24
+ value is not None and key not in ("self", "case_id")}
25
+ )
26
+
27
+ def get(
28
+ self,
29
+ case_id: int,
30
+ id: int
31
+ ):
32
+ return self._http_request(
33
+ "GET",
34
+ f"{self.base_endpoint}/{case_id}/actions/{id}",
35
+ "v2"
36
+ )
37
+
38
+ def update(
39
+ self,
40
+ case_id: int,
41
+ id: int,
42
+ url: Optional[str] = None,
43
+ label: Optional[str] = None,
44
+ action_type: Optional[Union[CaseActionType, str]] = None,
45
+ action_text: Optional[str] = None
46
+ ):
47
+ return self._http_request(
48
+ "PUT",
49
+ f"{self.base_endpoint}/{case_id}/actions/{id}",
50
+ "v2",
51
+ json={key: value for key, value in locals().items() if
52
+ value is not None and key not in ("self", "case_id", "id")}
53
+ )
54
+
55
+ def list(
56
+ self,
57
+ case_id: int,
58
+ per_page: int = 10,
59
+ page: int = 1,
60
+ ):
61
+ return self._http_request(
62
+ "GET",
63
+ f"{self.base_endpoint}/{case_id}/actions",
64
+ "v2",
65
+ json={key: value for key, value in locals().items() if
66
+ value is not None and key not in ("self", "case_id")}
67
+ )
68
+
69
+ def delete(
70
+ self,
71
+ case_id: int,
72
+ id: int
73
+ ):
74
+ return self._http_request(
75
+ "DELETE",
76
+ f"{self.base_endpoint}/{case_id}/actions/{id}",
77
+ "v2"
78
+ )
79
+
80
+ def batch_update(
81
+ self,
82
+ case_id: int,
83
+ actions: List[Dict[str, Any]]
84
+ ):
85
+ return self._http_request(
86
+ "PUT",
87
+ f"{self.base_endpoint}/{case_id}/actions/batch",
88
+ "v2",
89
+ json={"actions": actions}
90
+ )
@@ -0,0 +1,35 @@
1
+ from tapi.client import Client
2
+ from typing import Optional, Union
3
+ from tapi.utils.types import CaseActivityType
4
+
5
+
6
+ class CaseActivitiesAPI(Client):
7
+ def __init__(self, domain: str, apiKey: str):
8
+ super().__init__(domain, apiKey)
9
+ self.base_endpoint = "cases"
10
+
11
+ def get(
12
+ self,
13
+ case_id: int,
14
+ activity_id: int
15
+ ):
16
+ return self._http_request(
17
+ "GET",
18
+ f"{self.base_endpoint}/{case_id}/activities/{activity_id}",
19
+ "v2"
20
+ )
21
+
22
+ def list(
23
+ self,
24
+ case_id: int,
25
+ activity_type: Optional[Union[CaseActivityType, str]] = None,
26
+ per_page: int = 10,
27
+ page: int = 1
28
+ ):
29
+ return self._http_request(
30
+ "GET",
31
+ f"{self.base_endpoint}/{case_id}/activities",
32
+ "v2",
33
+ params = {"activity_type": activity_type},
34
+ json = {"per_page": per_page, "page": page}
35
+ )
@@ -0,0 +1,21 @@
1
+ from tapi.client import Client
2
+
3
+
4
+ class CaseAssigneesAPI(Client):
5
+ def __init__(self, domain: str, apiKey: str):
6
+ super().__init__(domain, apiKey)
7
+ self.base_endpoint = "cases"
8
+
9
+ def list(
10
+ self,
11
+ case_id: int,
12
+ per_page: int = 10,
13
+ page: int = 1,
14
+ ):
15
+ return self._http_request(
16
+ "GET",
17
+ f"{self.base_endpoint}/{case_id}/assignees",
18
+ "v2",
19
+ json = {key: value for key, value in locals().items() if
20
+ value is not None and key not in ("self", "case_id")}
21
+ )
@@ -0,0 +1,112 @@
1
+ from tapi.client import Client
2
+ from typing import Union, Literal, List, Dict, Optional
3
+
4
+
5
+ class CaseBlocksAPI(Client):
6
+ def __init__(self, domain: str, apiKey: str):
7
+ super().__init__(domain, apiKey)
8
+ self.base_endpoint = "cases"
9
+ self.elements = CaseBlockElementsAPI(domain, apiKey)
10
+
11
+ def create(
12
+ self,
13
+ case_id: int,
14
+ title: str,
15
+ block_type: Union[Literal["note", "file"]],
16
+ elements: List[Dict[str, str]],
17
+ position: int = 0,
18
+ ):
19
+ return self._http_request(
20
+ "POST",
21
+ f"{self.base_endpoint}/{case_id}/blocks",
22
+ "v2",
23
+ json = {key: value for key, value in locals().items() if
24
+ value is not None and key not in ("self", "case_id")}
25
+ )
26
+
27
+ def get(
28
+ self,
29
+ case_id: int,
30
+ block_id: int
31
+ ):
32
+ return self._http_request(
33
+ "GET",
34
+ f"{self.base_endpoint}/{case_id}/blocks/{block_id}",
35
+ "v2",
36
+ )
37
+
38
+ def update(
39
+ self,
40
+ case_id: int,
41
+ block_id: int,
42
+ title: Optional[str] = None,
43
+ position: Optional[str] = None
44
+ ):
45
+ return self._http_request(
46
+ "PUT",
47
+ f"{self.base_endpoint}/{case_id}/blocks/{block_id}",
48
+ "v2",
49
+ json = {key: value for key, value in locals().items() if
50
+ value is not None and key not in ("self", "case_id", "block_id")}
51
+ )
52
+
53
+ def list(
54
+ self,
55
+ case_id: int,
56
+ block_type: Optional[Literal["note", "file"]] = None,
57
+ per_page: int = 10,
58
+ page: int = 1
59
+ ):
60
+ return self._http_request(
61
+ "GET",
62
+ f"{self.base_endpoint}/{case_id}/blocks",
63
+ "v2",
64
+ params = {key: value for key, value in locals().items() if
65
+ value is not None and key not in ("self", "case_id")}
66
+ )
67
+
68
+ def delete(
69
+ self,
70
+ case_id: int,
71
+ block_id: int
72
+ ):
73
+ return self._http_request(
74
+ "DELETE",
75
+ f"{self.base_endpoint}/{case_id}/blocks/{block_id}",
76
+ "v2"
77
+ )
78
+
79
+
80
+ class CaseBlockElementsAPI(Client):
81
+ def __init__(self, domain: str, apiKey: str):
82
+ super().__init__(domain, apiKey)
83
+ self.base_endpoint = "cases"
84
+
85
+ def get(
86
+ self,
87
+ case_id: int,
88
+ block_id: int,
89
+ element_id: int,
90
+ ):
91
+ return self._http_request(
92
+ "GET",
93
+ f"{self.base_endpoint}/{case_id}/blocks/{block_id}/elements/{element_id}",
94
+ "v2"
95
+ )
96
+
97
+ def update(
98
+ self,
99
+ case_id: int,
100
+ block_id: int,
101
+ element_id: int,
102
+ content: Optional[str] = None,
103
+ color: Optional[Literal[ "white", "gold", "magenta", "green", "blue"]] = None
104
+ ):
105
+ return self._http_request(
106
+ "PUT",
107
+ f"{self.base_endpoint}/{case_id}/blocks/{block_id}/elements/{element_id}",
108
+ "v2",
109
+ json = {key: value for key, value in locals().items() if
110
+ value is not None and key not in ("self", "case_id", "block_id", "element_id")}
111
+ )
112
+
tapi/api/case/cases.py ADDED
@@ -0,0 +1,132 @@
1
+ from tapi.client import Client
2
+ from .notes import CaseNotesAPI
3
+ from .files import CaseFilesAPI
4
+ from .fields import CaseFieldsAPI
5
+ from .inputs import CaseInputsAPI
6
+ from .blocks import CaseBlocksAPI
7
+ from .actions import CaseActionsAPI
8
+ from .linked_cases import LinkedCasesAPI
9
+ from .records import CaseRecordsAPI
10
+ from .metadata import CaseMetadataAPI
11
+ from .comments import CaseCommentsAPI
12
+ from .assignees import CaseAssigneesAPI
13
+ from .activities import CaseActivitiesAPI
14
+ from .subscribers import CaseSubscribersAPI
15
+ from typing import List, Any, Dict, Optional, Union
16
+ from tapi.utils.types import CasePriority, CaseStatus, CaseReturnOrder
17
+
18
+ class CasesAPI(Client):
19
+ def __init__(self, domain: str, apiKey: str):
20
+ super().__init__(domain, apiKey)
21
+ self.base_endpoint = "cases"
22
+ self.files = CaseFilesAPI(domain, apiKey)
23
+ self.notes = CaseNotesAPI(domain, apiKey)
24
+ self.inputs = CaseInputsAPI(domain, apiKey)
25
+ self.fields = CaseFieldsAPI(domain, apiKey)
26
+ self.blocks = CaseBlocksAPI(domain, apiKey)
27
+ self.linked_cases = LinkedCasesAPI(domain, apiKey)
28
+ self.actions = CaseActionsAPI(domain, apiKey)
29
+ self.records = CaseRecordsAPI(domain, apiKey)
30
+ self.comments = CaseCommentsAPI(domain, apiKey)
31
+ self.metadata = CaseMetadataAPI(domain, apiKey)
32
+ self.assignees = CaseAssigneesAPI(domain, apiKey)
33
+ self.activities = CaseActivitiesAPI(domain, apiKey)
34
+ self.subscribers = CaseSubscribersAPI(domain, apiKey)
35
+
36
+ def create(
37
+ self,
38
+ team_id: int,
39
+ name: str,
40
+ description: Optional[str] = None,
41
+ priority: Union[CasePriority, str] = CasePriority.LOW,
42
+ status: Union[CaseStatus, str] = CaseStatus.OPEN,
43
+ sub_status_id: Optional[int] = None,
44
+ author_email: Optional[str] = None,
45
+ assignee_emails: Optional[List[str]] = None,
46
+ tag_names: Optional[List[str]] = None,
47
+ opened_at: Optional[str] = None,
48
+ resolved_at: Optional[str] = None,
49
+ metadata: Optional[Dict[str, str]] = None,
50
+ closure_conditions: Optional[List[Dict[str, Any]]] = None,
51
+ field_values: Optional[Dict[str, Any]] = None
52
+ ):
53
+ return self._http_request(
54
+ "POST",
55
+ self.base_endpoint,
56
+ "v2",
57
+ json = {key: value for key, value in locals().items() if
58
+ value is not None and key != "self"}
59
+ )
60
+
61
+ def get(
62
+ self,
63
+ case_id: int
64
+ ):
65
+ return self._http_request(
66
+ "GET",
67
+ f"{self.base_endpoint}/{case_id}",
68
+ "v2"
69
+ )
70
+
71
+ def download(
72
+ self,
73
+ case_id: int
74
+ ):
75
+ return self._http_request(
76
+ "GET",
77
+ f"{self.base_endpoint}/{case_id}/pdf",
78
+ "v2"
79
+ )
80
+
81
+ def update(
82
+ self,
83
+ case_id: int,
84
+ name: Optional[str] = None,
85
+ team_id: Optional[int] = None,
86
+ description: Optional[str] = None,
87
+ priority: Optional[Union[CasePriority, str]] = None,
88
+ status: Optional[Union[CaseStatus, str]] = None,
89
+ sub_status_id: Optional[int] = None,
90
+ author_email: Optional[str] = None,
91
+ assignee_emails: Optional[List[str]] = None,
92
+ add_assignee_emails: Optional[List[str]] = None,
93
+ remove_assignee_emails: Optional[List[str]] = None,
94
+ add_tag_names: Optional[List[str]] = None,
95
+ remove_tag_names: Optional[List[str]] = None,
96
+ opened_at: Optional[str] = None,
97
+ resolved_at: Optional[str] = None,
98
+ closure_conditions: Optional[List[Dict[str, Any]]] = None
99
+ ):
100
+ return self._http_request(
101
+ "PUT",
102
+ f"{self.base_endpoint}/{case_id}",
103
+ "v2",
104
+ json = {key: value for key, value in locals().items() if
105
+ value is not None and key not in ("self", "case_id")}
106
+ )
107
+
108
+ def list(
109
+ self,
110
+ team_id: Optional[int] = None,
111
+ filters: Optional[Dict[str, Any]] = None,
112
+ order: Optional[Union[CaseReturnOrder, str]] = None,
113
+ per_page: int = 10,
114
+ page: int = 1
115
+ ):
116
+ return self._http_request(
117
+ "GET",
118
+ self.base_endpoint,
119
+ "v2",
120
+ json = {key: value for key, value in locals().items() if
121
+ value is not None and key != "self"}
122
+ )
123
+
124
+ def delete(
125
+ self,
126
+ case_id: int
127
+ ):
128
+ return self._http_request(
129
+ "DELETE",
130
+ f"{self.base_endpoint}/{case_id}",
131
+ "v2"
132
+ )
@@ -0,0 +1,102 @@
1
+ from tapi.client import Client
2
+ from tapi.utils.types import ReactionType
3
+ from typing import Optional, Union
4
+
5
+
6
+ class CaseCommentsAPI(Client):
7
+ def __init__(self, domain: str, apiKey: str):
8
+ super().__init__(domain, apiKey)
9
+ self.base_endpoint = "cases"
10
+ self.reactions = CaseCommentsReactionsAPI(domain, apiKey)
11
+
12
+ def create(
13
+ self,
14
+ case_id: int,
15
+ value: str,
16
+ author_email: Optional[str] = None
17
+ ):
18
+ return self._http_request(
19
+ "POST",
20
+ f"{self.base_endpoint}/{case_id}/comments",
21
+ "v2",
22
+ json = {"value": value, "author_email": author_email}
23
+ )
24
+
25
+ def get(
26
+ self,
27
+ case_id: int,
28
+ comment_id: int
29
+ ):
30
+ return self._http_request(
31
+ "GET",
32
+ f"{self.base_endpoint}/{case_id}/comments/{comment_id}",
33
+ "v2"
34
+ )
35
+
36
+ def update(
37
+ self,
38
+ case_id: int,
39
+ comment_id: int,
40
+ value: str
41
+ ):
42
+ return self._http_request(
43
+ "PUT",
44
+ f"{self.base_endpoint}/{case_id}/comments/{comment_id}",
45
+ "v2",
46
+ json = {"value": value}
47
+ )
48
+
49
+ def list(
50
+ self,
51
+ case_id: int,
52
+ per_page: int = 10,
53
+ page: int = 1
54
+ ):
55
+ return self._http_request(
56
+ "GET",
57
+ f"{self.base_endpoint}/{case_id}/comments",
58
+ "v2",
59
+ json = {"per_page": per_page, "page": page}
60
+ )
61
+
62
+ def delete(
63
+ self,
64
+ case_id: int,
65
+ comment_id: int
66
+ ):
67
+ return self._http_request(
68
+ "DELETE",
69
+ f"{self.base_endpoint}/{case_id}/comments/{comment_id}",
70
+ "v2"
71
+ )
72
+
73
+ class CaseCommentsReactionsAPI(Client):
74
+ def __init__(self, domain: str, apiKey: str):
75
+ super().__init__(domain, apiKey)
76
+ self.base_endpoint = "cases"
77
+
78
+ def add(
79
+ self,
80
+ case_id: int,
81
+ comment_id: int,
82
+ value: Union[ReactionType, str]
83
+ ):
84
+ return self._http_request(
85
+ "POST",
86
+ f"{self.base_endpoint}/{case_id}/comments/{comment_id}/reactions",
87
+ "v2",
88
+ json = {"value": value}
89
+ )
90
+
91
+ def remove(
92
+ self,
93
+ case_id: int,
94
+ comment_id: int,
95
+ value: Union[ReactionType, str]
96
+ ):
97
+ return self._http_request(
98
+ "DELETE",
99
+ f"{self.base_endpoint}/{case_id}/comments/{comment_id}/reactions",
100
+ "v2",
101
+ json={"value": value}
102
+ )