Skip to content

Commit b8f91ef

Browse files
authored
feat(Service Desk): Add endpoints for specific request type data and itd fields (#1592)
* [service_desk] Single request_type method addition Added new method to fetch single request type. * [service_desk] Request type fields method addition Added a method to get field composition of a request type * [service_desk] Add docs Added docs for get_request_type and get_request_type_fields methods * fix: Remove trailing whitespace Removed the trailing whitespace linted by codacy
1 parent c2a516a commit b8f91ef

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

atlassian/service_desk.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,42 @@ def get_request_types(self, service_desk_id):
166166
f"rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype",
167167
headers=self.experimental_headers,
168168
)
169+
def get_request_type(self, service_desk_id, request_type_id):
170+
"""
171+
Fetches detailed information about a specific request type within a service desk.
172+
173+
:param service_desk_id: The ID of the service desk where the request type
174+
exists.
175+
:type service_desk_id: str
176+
:param request_type_id: The ID of the request type to retrieve.
177+
:type request_type_id: str
178+
:return: A dictionary containing the details of the specified request type.
179+
:rtype: dict
180+
"""
181+
return self.get(
182+
f"rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype/{request_type_id}",
183+
headers=self.experimental_headers,
184+
)
185+
186+
def get_request_type_fields(self, service_desk_id, request_type_id):
187+
"""
188+
Retrieve the fields for a specific request type in a service desk.
189+
190+
:param service_desk_id: The ID of the service desk for which the request type
191+
fields are to be retrieved.
192+
:type service_desk_id: str
193+
:param request_type_id: The ID of the request type within the specified service
194+
desk.
195+
:type request_type_id: str
196+
:return: A response object containing the fields information for the specified
197+
request type.
198+
:rtype: requests.Response
199+
"""
200+
201+
return self.get(
202+
f"rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype/{request_type_id}/field",
203+
headers=self.experimental_headers,
204+
)
169205

170206
# Participants actions
171207
def get_request_participants(self, issue_id_or_key, start=0, limit=50):

docs/service_desk.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,24 @@ Manage a Participants
6666
# The calling user must have permission to manage participants for this customer request
6767
sd.remove_request_participants(issue_id_or_key, users_list=None, account_list=None)
6868
69+
70+
Request types
71+
---------------------
72+
73+
.. code-block:: python
74+
75+
# Get all request types in a serrvice desk project
76+
sd.get_request_types(service_desk_id)
77+
78+
# Get single request type in a given serrvice desk project
79+
sd.get_request_type(service_desk_id, request_type_id)
80+
81+
# Get field composition of a given request type
82+
sd.get_request_type_fields(service_desk_id, request_type_id)
83+
84+
6985
Transitions
70-
-----------
86+
---------------------
7187

7288
**EXPERIMENTAL** (may change without notice)
7389

0 commit comments

Comments
 (0)