atlassian-modules 0.3__tar.gz → 0.4__tar.gz
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.
- {atlassian_modules-0.3 → atlassian_modules-0.4}/PKG-INFO +79 -11
- {atlassian_modules-0.3 → atlassian_modules-0.4}/README.md +78 -10
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules/helper.py +81 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/PKG-INFO +79 -11
- {atlassian_modules-0.3 → atlassian_modules-0.4}/setup.py +1 -1
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules/__init__.py +0 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/SOURCES.txt +0 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/dependency_links.txt +0 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/requires.txt +0 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/top_level.txt +0 -0
- {atlassian_modules-0.3 → atlassian_modules-0.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: atlassian_modules
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: Modules for interacting with Atlassian products.
|
|
5
5
|
Home-page:
|
|
6
6
|
Author: Pavan Bhatt
|
|
@@ -56,7 +56,68 @@ Return:
|
|
|
56
56
|
- `URL of the created ticket (str)`: If the ticket creation is successful, the function returns the URL to access the newly created ticket directly.
|
|
57
57
|
- `False`: If the ticket creation fails (for example, due to incorrect input parameters or server errors), the function returns `False`.
|
|
58
58
|
______________________________________________________________________________
|
|
59
|
-
## 2.
|
|
59
|
+
## 2. Create a custom Jira Ticket
|
|
60
|
+
- You can create a new custom Jira ticket using the `create_custom_ticket` method:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
64
|
+
|
|
65
|
+
# Define additional fields if necessary
|
|
66
|
+
additional_fields = {
|
|
67
|
+
"customfield_12345": "Custom value",
|
|
68
|
+
"labels": ["label1", "label2"]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ticket_url = jira_helper.create_custom_ticket("PRJ", "Issue Summary", "Detailed issue description.", "Bug", additional_fields)
|
|
72
|
+
if ticket_url:
|
|
73
|
+
print(f"Ticket created: {ticket_url}")
|
|
74
|
+
else:
|
|
75
|
+
print("Failed to create ticket.")
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Parameters:
|
|
79
|
+
- `project_key` (str): The key of the project where the new ticket will be created. This is typically a short, capitalized identifier specific to a project in Jira.
|
|
80
|
+
- `summary` (str): A concise overview of the issue or task that the new ticket will represent.
|
|
81
|
+
- `description` (str): A detailed description of the issue or task, providing all necessary details for understanding and addressing it.
|
|
82
|
+
- `issue_type` (str): Specifies the type of issue being created (e.g., `Bug`, `Task`, `Story`), determining how the issue is categorized within Jira.
|
|
83
|
+
- `additional_fields` (dict, optional): A dictionary of additional fields that are required for ticket creation. This parameter allows for the inclusion of project-specific or issue-specific information that is not covered by the standard fields.
|
|
84
|
+
|
|
85
|
+
Output:
|
|
86
|
+
- The function provides informational messages throughout the process of creating a ticket.
|
|
87
|
+
- These messages include details on preparing the issue data, sending a request to create the ticket, and the outcome of that request.
|
|
88
|
+
Return:
|
|
89
|
+
- `URL of the created ticket` (str): If the ticket creation is successful, the function returns the URL to access the newly created ticket directly. This allows for immediate navigation to the ticket for review or further action.
|
|
90
|
+
- `False`: If the ticket creation process fails, whether due to incorrect input parameters, server errors, or issues with the additional fields, the function returns `False`. This indicates that the ticket was not created and provides an opportunity to address any issues before retrying.
|
|
91
|
+
______________________________________________________________________________
|
|
92
|
+
## 3. Update the Jira ticket with inbuilt and custom fields
|
|
93
|
+
- You can update any custom field of Jira ticket using the `update_ticket_with_fields` method:
|
|
94
|
+
```python
|
|
95
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
96
|
+
|
|
97
|
+
# Define the additional fields you want to update
|
|
98
|
+
additional_fields = {
|
|
99
|
+
"customfield_12345": "New custom value",
|
|
100
|
+
"labels": ["newlabel1", "newlabel2"]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ticket_id = "PRJ-123" # Example ticket ID to be updated
|
|
104
|
+
|
|
105
|
+
update_success = jira_helper.update_ticket_with_fields(ticket_id, additional_fields)
|
|
106
|
+
if update_success:
|
|
107
|
+
print(f"Ticket {ticket_id} updated successfully.")
|
|
108
|
+
else:
|
|
109
|
+
print(f"Failed to update ticket {ticket_id}.")
|
|
110
|
+
```
|
|
111
|
+
Parameters:
|
|
112
|
+
- `ticket_id` (str): ID (also known as the key) of the ticket to be updated. This identifier is typically a combination of the project key and a sequence number, like `PRJ-123`.
|
|
113
|
+
- `additional_fields` (dict): A dictionary of fields to update the ticket with. This parameter allows specifying values for any standard or custom field in the ticket that supports updates.
|
|
114
|
+
Output:
|
|
115
|
+
- The function prints messages about the process of updating the ticket, including preparing the update data, making the request to update the ticket, and the result of that request.
|
|
116
|
+
Return:
|
|
117
|
+
- `True` if the update was successful. This indicates that the server accepted the update request and applied the changes to the ticket.
|
|
118
|
+
- `False` otherwise. If the ticket update fails (for example, due to incorrect ticket ID, fields that cannot be updated, or server errors), the function returns `False`, and additional error information is printed to help diagnose the issue.
|
|
119
|
+
______________________________________________________________________________
|
|
120
|
+
## 3. Delete a Jira Ticket
|
|
60
121
|
|
|
61
122
|
- To delete a ticket, use the `delete_ticket` method:
|
|
62
123
|
|
|
@@ -79,7 +140,7 @@ Return:
|
|
|
79
140
|
- `True`: If the ticket is successfully deleted. This is indicated by a `204` HTTP status code from the JIRA API, meaning "`No Content`" but signifying successful deletion.
|
|
80
141
|
- `False`: If the deletion fails, which can occur if the ticket does not exist or if there's an issue with the API request (e.g., permissions, invalid ticket key). This is communicated by returning `False`.
|
|
81
142
|
______________________________________________________________________________
|
|
82
|
-
##
|
|
143
|
+
## 4. Get Transition ID
|
|
83
144
|
|
|
84
145
|
```python
|
|
85
146
|
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
@@ -104,7 +165,7 @@ Return:
|
|
|
104
165
|
- `Transition ID` (str): If the specified transition is found for the given ticket, the function returns the transition's ID, which can be used for further actions like transitioning the ticket to another status.
|
|
105
166
|
- `False`: If the specified transition is not found for the ticket, or if there is any failure in fetching transitions (e.g., due to an invalid ticket key, network issues, or server errors), the function returns `False`.
|
|
106
167
|
______________________________________________________________________________
|
|
107
|
-
##
|
|
168
|
+
## 5. Transition a Jira Ticket
|
|
108
169
|
|
|
109
170
|
- To transition a ticket to a different status, use the `transition_ticket` method:
|
|
110
171
|
|
|
@@ -131,7 +192,7 @@ Return:
|
|
|
131
192
|
- `False`: If the ticket transition fails. This could be due to various reasons, such as an invalid ticket key, an unrecognized transition name or ID, or a failure in the HTTP request itself.
|
|
132
193
|
|
|
133
194
|
______________________________________________________________________________
|
|
134
|
-
##
|
|
195
|
+
## 6. If exist a Jira Ticket
|
|
135
196
|
|
|
136
197
|
- To check if a ticket exist, use the `if_ticket_exist` method:
|
|
137
198
|
|
|
@@ -154,7 +215,7 @@ Return:
|
|
|
154
215
|
- `True`: If the ticket exists. This is confirmed by a `200` HTTP status code, indicating that the ticket was found.
|
|
155
216
|
- `False`: If the ticket does not exist or if there was an error in checking. A `404` HTTP status code indicates the ticket does not exist. Other status codes indicate a failure in the request to check the ticket.
|
|
156
217
|
______________________________________________________________________________
|
|
157
|
-
##
|
|
218
|
+
## 7. Comment on a Jira ticket
|
|
158
219
|
|
|
159
220
|
- To comment on the ticket, use the `comment_ticket` method:
|
|
160
221
|
|
|
@@ -180,7 +241,7 @@ Return:
|
|
|
180
241
|
- `URL of the created comment` (str): If adding the comment is successful, the function returns the URL to access the newly created comment directly. This is indicated by a `201` HTTP status code, meaning "`Created`".
|
|
181
242
|
- `False`: If adding the comment fails. This could be because the ticket does not exist, the comment text is invalid, or there was an error in the request itself. In such cases, the function returns `False`.
|
|
182
243
|
______________________________________________________________________________
|
|
183
|
-
##
|
|
244
|
+
## 8. Pass the JQL and get the ticket array
|
|
184
245
|
|
|
185
246
|
- To query tickets using JQL, use the `jql_ticket` method:
|
|
186
247
|
|
|
@@ -554,12 +615,19 @@ ______________________________________________________________________________
|
|
|
554
615
|
|
|
555
616
|
# Release Notes
|
|
556
617
|
|
|
557
|
-
## Latest Release: 0.
|
|
558
|
-
-
|
|
559
|
-
-
|
|
560
|
-
|
|
618
|
+
## Latest Release: 0.4 (21 Mar 2024)
|
|
619
|
+
- New Features:
|
|
620
|
+
- JIRA Integration Enhancements:
|
|
621
|
+
- Custom Ticket Creation: The `create_custom_ticket` function has been introduced, allowing for more flexible ticket creation in JIRA projects. This function supports additional fields, enabling users to specify custom data during ticket creation.
|
|
622
|
+
- Ticket Field Updates: The `update_ticket_with_fields` method has been added, offering the ability to update existing tickets with new or modified fields. This feature is crucial for maintaining accurate and up-to-date ticket information.
|
|
623
|
+
- Beta Features (Continued from previous release):
|
|
624
|
+
- Beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
561
625
|
|
|
562
626
|
## Previous Releases:
|
|
627
|
+
- 0.3 (21 Mar 2024)
|
|
628
|
+
- Enhancements:
|
|
629
|
+
- Updated `readme.md` documentation.
|
|
630
|
+
- Introduced beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
563
631
|
- 0.2.8 (21 Mar 2024)
|
|
564
632
|
- Minor updates and enhancements (details forthcoming).
|
|
565
633
|
- 0.2.7 (08 Jan 2024)
|
|
@@ -47,7 +47,68 @@ Return:
|
|
|
47
47
|
- `URL of the created ticket (str)`: If the ticket creation is successful, the function returns the URL to access the newly created ticket directly.
|
|
48
48
|
- `False`: If the ticket creation fails (for example, due to incorrect input parameters or server errors), the function returns `False`.
|
|
49
49
|
______________________________________________________________________________
|
|
50
|
-
## 2.
|
|
50
|
+
## 2. Create a custom Jira Ticket
|
|
51
|
+
- You can create a new custom Jira ticket using the `create_custom_ticket` method:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
55
|
+
|
|
56
|
+
# Define additional fields if necessary
|
|
57
|
+
additional_fields = {
|
|
58
|
+
"customfield_12345": "Custom value",
|
|
59
|
+
"labels": ["label1", "label2"]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ticket_url = jira_helper.create_custom_ticket("PRJ", "Issue Summary", "Detailed issue description.", "Bug", additional_fields)
|
|
63
|
+
if ticket_url:
|
|
64
|
+
print(f"Ticket created: {ticket_url}")
|
|
65
|
+
else:
|
|
66
|
+
print("Failed to create ticket.")
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Parameters:
|
|
70
|
+
- `project_key` (str): The key of the project where the new ticket will be created. This is typically a short, capitalized identifier specific to a project in Jira.
|
|
71
|
+
- `summary` (str): A concise overview of the issue or task that the new ticket will represent.
|
|
72
|
+
- `description` (str): A detailed description of the issue or task, providing all necessary details for understanding and addressing it.
|
|
73
|
+
- `issue_type` (str): Specifies the type of issue being created (e.g., `Bug`, `Task`, `Story`), determining how the issue is categorized within Jira.
|
|
74
|
+
- `additional_fields` (dict, optional): A dictionary of additional fields that are required for ticket creation. This parameter allows for the inclusion of project-specific or issue-specific information that is not covered by the standard fields.
|
|
75
|
+
|
|
76
|
+
Output:
|
|
77
|
+
- The function provides informational messages throughout the process of creating a ticket.
|
|
78
|
+
- These messages include details on preparing the issue data, sending a request to create the ticket, and the outcome of that request.
|
|
79
|
+
Return:
|
|
80
|
+
- `URL of the created ticket` (str): If the ticket creation is successful, the function returns the URL to access the newly created ticket directly. This allows for immediate navigation to the ticket for review or further action.
|
|
81
|
+
- `False`: If the ticket creation process fails, whether due to incorrect input parameters, server errors, or issues with the additional fields, the function returns `False`. This indicates that the ticket was not created and provides an opportunity to address any issues before retrying.
|
|
82
|
+
______________________________________________________________________________
|
|
83
|
+
## 3. Update the Jira ticket with inbuilt and custom fields
|
|
84
|
+
- You can update any custom field of Jira ticket using the `update_ticket_with_fields` method:
|
|
85
|
+
```python
|
|
86
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
87
|
+
|
|
88
|
+
# Define the additional fields you want to update
|
|
89
|
+
additional_fields = {
|
|
90
|
+
"customfield_12345": "New custom value",
|
|
91
|
+
"labels": ["newlabel1", "newlabel2"]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ticket_id = "PRJ-123" # Example ticket ID to be updated
|
|
95
|
+
|
|
96
|
+
update_success = jira_helper.update_ticket_with_fields(ticket_id, additional_fields)
|
|
97
|
+
if update_success:
|
|
98
|
+
print(f"Ticket {ticket_id} updated successfully.")
|
|
99
|
+
else:
|
|
100
|
+
print(f"Failed to update ticket {ticket_id}.")
|
|
101
|
+
```
|
|
102
|
+
Parameters:
|
|
103
|
+
- `ticket_id` (str): ID (also known as the key) of the ticket to be updated. This identifier is typically a combination of the project key and a sequence number, like `PRJ-123`.
|
|
104
|
+
- `additional_fields` (dict): A dictionary of fields to update the ticket with. This parameter allows specifying values for any standard or custom field in the ticket that supports updates.
|
|
105
|
+
Output:
|
|
106
|
+
- The function prints messages about the process of updating the ticket, including preparing the update data, making the request to update the ticket, and the result of that request.
|
|
107
|
+
Return:
|
|
108
|
+
- `True` if the update was successful. This indicates that the server accepted the update request and applied the changes to the ticket.
|
|
109
|
+
- `False` otherwise. If the ticket update fails (for example, due to incorrect ticket ID, fields that cannot be updated, or server errors), the function returns `False`, and additional error information is printed to help diagnose the issue.
|
|
110
|
+
______________________________________________________________________________
|
|
111
|
+
## 3. Delete a Jira Ticket
|
|
51
112
|
|
|
52
113
|
- To delete a ticket, use the `delete_ticket` method:
|
|
53
114
|
|
|
@@ -70,7 +131,7 @@ Return:
|
|
|
70
131
|
- `True`: If the ticket is successfully deleted. This is indicated by a `204` HTTP status code from the JIRA API, meaning "`No Content`" but signifying successful deletion.
|
|
71
132
|
- `False`: If the deletion fails, which can occur if the ticket does not exist or if there's an issue with the API request (e.g., permissions, invalid ticket key). This is communicated by returning `False`.
|
|
72
133
|
______________________________________________________________________________
|
|
73
|
-
##
|
|
134
|
+
## 4. Get Transition ID
|
|
74
135
|
|
|
75
136
|
```python
|
|
76
137
|
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
@@ -95,7 +156,7 @@ Return:
|
|
|
95
156
|
- `Transition ID` (str): If the specified transition is found for the given ticket, the function returns the transition's ID, which can be used for further actions like transitioning the ticket to another status.
|
|
96
157
|
- `False`: If the specified transition is not found for the ticket, or if there is any failure in fetching transitions (e.g., due to an invalid ticket key, network issues, or server errors), the function returns `False`.
|
|
97
158
|
______________________________________________________________________________
|
|
98
|
-
##
|
|
159
|
+
## 5. Transition a Jira Ticket
|
|
99
160
|
|
|
100
161
|
- To transition a ticket to a different status, use the `transition_ticket` method:
|
|
101
162
|
|
|
@@ -122,7 +183,7 @@ Return:
|
|
|
122
183
|
- `False`: If the ticket transition fails. This could be due to various reasons, such as an invalid ticket key, an unrecognized transition name or ID, or a failure in the HTTP request itself.
|
|
123
184
|
|
|
124
185
|
______________________________________________________________________________
|
|
125
|
-
##
|
|
186
|
+
## 6. If exist a Jira Ticket
|
|
126
187
|
|
|
127
188
|
- To check if a ticket exist, use the `if_ticket_exist` method:
|
|
128
189
|
|
|
@@ -145,7 +206,7 @@ Return:
|
|
|
145
206
|
- `True`: If the ticket exists. This is confirmed by a `200` HTTP status code, indicating that the ticket was found.
|
|
146
207
|
- `False`: If the ticket does not exist or if there was an error in checking. A `404` HTTP status code indicates the ticket does not exist. Other status codes indicate a failure in the request to check the ticket.
|
|
147
208
|
______________________________________________________________________________
|
|
148
|
-
##
|
|
209
|
+
## 7. Comment on a Jira ticket
|
|
149
210
|
|
|
150
211
|
- To comment on the ticket, use the `comment_ticket` method:
|
|
151
212
|
|
|
@@ -171,7 +232,7 @@ Return:
|
|
|
171
232
|
- `URL of the created comment` (str): If adding the comment is successful, the function returns the URL to access the newly created comment directly. This is indicated by a `201` HTTP status code, meaning "`Created`".
|
|
172
233
|
- `False`: If adding the comment fails. This could be because the ticket does not exist, the comment text is invalid, or there was an error in the request itself. In such cases, the function returns `False`.
|
|
173
234
|
______________________________________________________________________________
|
|
174
|
-
##
|
|
235
|
+
## 8. Pass the JQL and get the ticket array
|
|
175
236
|
|
|
176
237
|
- To query tickets using JQL, use the `jql_ticket` method:
|
|
177
238
|
|
|
@@ -545,12 +606,19 @@ ______________________________________________________________________________
|
|
|
545
606
|
|
|
546
607
|
# Release Notes
|
|
547
608
|
|
|
548
|
-
## Latest Release: 0.
|
|
549
|
-
-
|
|
550
|
-
-
|
|
551
|
-
|
|
609
|
+
## Latest Release: 0.4 (21 Mar 2024)
|
|
610
|
+
- New Features:
|
|
611
|
+
- JIRA Integration Enhancements:
|
|
612
|
+
- Custom Ticket Creation: The `create_custom_ticket` function has been introduced, allowing for more flexible ticket creation in JIRA projects. This function supports additional fields, enabling users to specify custom data during ticket creation.
|
|
613
|
+
- Ticket Field Updates: The `update_ticket_with_fields` method has been added, offering the ability to update existing tickets with new or modified fields. This feature is crucial for maintaining accurate and up-to-date ticket information.
|
|
614
|
+
- Beta Features (Continued from previous release):
|
|
615
|
+
- Beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
552
616
|
|
|
553
617
|
## Previous Releases:
|
|
618
|
+
- 0.3 (21 Mar 2024)
|
|
619
|
+
- Enhancements:
|
|
620
|
+
- Updated `readme.md` documentation.
|
|
621
|
+
- Introduced beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
554
622
|
- 0.2.8 (21 Mar 2024)
|
|
555
623
|
- Minor updates and enhancements (details forthcoming).
|
|
556
624
|
- 0.2.7 (08 Jan 2024)
|
|
@@ -11,6 +11,87 @@ class JiraHelper:
|
|
|
11
11
|
"Content-Type": "application/json"
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
def create_custom_ticket(self, project_key, summary, description, issue_type, additional_fields=None):
|
|
15
|
+
"""
|
|
16
|
+
Create a ticket in a specified project using the provided details and additional fields.
|
|
17
|
+
|
|
18
|
+
:param project_key: Key of the project where the new ticket will be created.
|
|
19
|
+
:param summary: Summary of the new ticket.
|
|
20
|
+
:param description: Detailed description of the new ticket.
|
|
21
|
+
:param issue_type: Type of the issue (e.g., Bug, Task, Story).
|
|
22
|
+
:param additional_fields: Dictionary of additional fields required for ticket creation.
|
|
23
|
+
:return: URL of the created ticket or False if the creation failed.
|
|
24
|
+
"""
|
|
25
|
+
# Preparing issue data
|
|
26
|
+
print("Preparing issue data...")
|
|
27
|
+
issue_data = {
|
|
28
|
+
"fields": {
|
|
29
|
+
"project": {"key": project_key},
|
|
30
|
+
"summary": summary,
|
|
31
|
+
"description": description,
|
|
32
|
+
"issuetype": {"name": issue_type},
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Incorporating additional fields if provided
|
|
37
|
+
if additional_fields:
|
|
38
|
+
issue_data["fields"].update(additional_fields)
|
|
39
|
+
|
|
40
|
+
# Making a request to create a ticket
|
|
41
|
+
print(f"Sending request to create a ticket in project {project_key}...")
|
|
42
|
+
response = requests.post(
|
|
43
|
+
f"{self.server_url}/rest/api/2/issue",
|
|
44
|
+
json=issue_data,
|
|
45
|
+
headers=self.headers,
|
|
46
|
+
auth=self.auth
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Checking response
|
|
50
|
+
if response.status_code == 201: # HTTP 201 Created
|
|
51
|
+
print("Ticket created successfully!")
|
|
52
|
+
ticket_data = response.json()
|
|
53
|
+
ticket_key = ticket_data["key"]
|
|
54
|
+
ticket_url = f"{self.server_url}/browse/{ticket_key}"
|
|
55
|
+
print(f"Ticket URL: {ticket_url}")
|
|
56
|
+
return ticket_url
|
|
57
|
+
else:
|
|
58
|
+
print(f"Failed to create ticket. HTTP Status Code: {response.status_code}")
|
|
59
|
+
print(f"Response Content: {response.text}")
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
def update_ticket_with_fields(self, ticket_id, additional_fields):
|
|
63
|
+
"""
|
|
64
|
+
Update a JIRA ticket with additional fields.
|
|
65
|
+
|
|
66
|
+
:param ticket_id: ID (key) of the ticket to be updated.
|
|
67
|
+
:param additional_fields: Dictionary of fields to update the ticket with.
|
|
68
|
+
:return: True if the update was successful, False otherwise.
|
|
69
|
+
"""
|
|
70
|
+
print(f"Updating ticket {ticket_id} with additional fields...")
|
|
71
|
+
|
|
72
|
+
# Preparing the update data
|
|
73
|
+
update_data = {
|
|
74
|
+
"fields": additional_fields
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Making a request to update the ticket
|
|
78
|
+
print(f"Sending request to update ticket {ticket_id}...")
|
|
79
|
+
response = requests.put(
|
|
80
|
+
f"{self.server_url}/rest/api/2/issue/{ticket_id}",
|
|
81
|
+
json=update_data,
|
|
82
|
+
headers=self.headers,
|
|
83
|
+
auth=self.auth
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Checking response
|
|
87
|
+
if response.status_code in [200, 204]: # HTTP 200 OK or 204 No Content indicate success
|
|
88
|
+
print("Ticket updated successfully!")
|
|
89
|
+
return True
|
|
90
|
+
else:
|
|
91
|
+
print(f"Failed to update ticket. HTTP Status Code: {response.status_code}")
|
|
92
|
+
print(f"Response Content: {response.text}")
|
|
93
|
+
return False
|
|
94
|
+
|
|
14
95
|
def create_ticket(self, project_key, summary, description, issue_type):
|
|
15
96
|
"""
|
|
16
97
|
Create a ticket in a specified project using the provided details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: atlassian-modules
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: Modules for interacting with Atlassian products.
|
|
5
5
|
Home-page:
|
|
6
6
|
Author: Pavan Bhatt
|
|
@@ -56,7 +56,68 @@ Return:
|
|
|
56
56
|
- `URL of the created ticket (str)`: If the ticket creation is successful, the function returns the URL to access the newly created ticket directly.
|
|
57
57
|
- `False`: If the ticket creation fails (for example, due to incorrect input parameters or server errors), the function returns `False`.
|
|
58
58
|
______________________________________________________________________________
|
|
59
|
-
## 2.
|
|
59
|
+
## 2. Create a custom Jira Ticket
|
|
60
|
+
- You can create a new custom Jira ticket using the `create_custom_ticket` method:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
64
|
+
|
|
65
|
+
# Define additional fields if necessary
|
|
66
|
+
additional_fields = {
|
|
67
|
+
"customfield_12345": "Custom value",
|
|
68
|
+
"labels": ["label1", "label2"]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ticket_url = jira_helper.create_custom_ticket("PRJ", "Issue Summary", "Detailed issue description.", "Bug", additional_fields)
|
|
72
|
+
if ticket_url:
|
|
73
|
+
print(f"Ticket created: {ticket_url}")
|
|
74
|
+
else:
|
|
75
|
+
print("Failed to create ticket.")
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Parameters:
|
|
79
|
+
- `project_key` (str): The key of the project where the new ticket will be created. This is typically a short, capitalized identifier specific to a project in Jira.
|
|
80
|
+
- `summary` (str): A concise overview of the issue or task that the new ticket will represent.
|
|
81
|
+
- `description` (str): A detailed description of the issue or task, providing all necessary details for understanding and addressing it.
|
|
82
|
+
- `issue_type` (str): Specifies the type of issue being created (e.g., `Bug`, `Task`, `Story`), determining how the issue is categorized within Jira.
|
|
83
|
+
- `additional_fields` (dict, optional): A dictionary of additional fields that are required for ticket creation. This parameter allows for the inclusion of project-specific or issue-specific information that is not covered by the standard fields.
|
|
84
|
+
|
|
85
|
+
Output:
|
|
86
|
+
- The function provides informational messages throughout the process of creating a ticket.
|
|
87
|
+
- These messages include details on preparing the issue data, sending a request to create the ticket, and the outcome of that request.
|
|
88
|
+
Return:
|
|
89
|
+
- `URL of the created ticket` (str): If the ticket creation is successful, the function returns the URL to access the newly created ticket directly. This allows for immediate navigation to the ticket for review or further action.
|
|
90
|
+
- `False`: If the ticket creation process fails, whether due to incorrect input parameters, server errors, or issues with the additional fields, the function returns `False`. This indicates that the ticket was not created and provides an opportunity to address any issues before retrying.
|
|
91
|
+
______________________________________________________________________________
|
|
92
|
+
## 3. Update the Jira ticket with inbuilt and custom fields
|
|
93
|
+
- You can update any custom field of Jira ticket using the `update_ticket_with_fields` method:
|
|
94
|
+
```python
|
|
95
|
+
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
96
|
+
|
|
97
|
+
# Define the additional fields you want to update
|
|
98
|
+
additional_fields = {
|
|
99
|
+
"customfield_12345": "New custom value",
|
|
100
|
+
"labels": ["newlabel1", "newlabel2"]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ticket_id = "PRJ-123" # Example ticket ID to be updated
|
|
104
|
+
|
|
105
|
+
update_success = jira_helper.update_ticket_with_fields(ticket_id, additional_fields)
|
|
106
|
+
if update_success:
|
|
107
|
+
print(f"Ticket {ticket_id} updated successfully.")
|
|
108
|
+
else:
|
|
109
|
+
print(f"Failed to update ticket {ticket_id}.")
|
|
110
|
+
```
|
|
111
|
+
Parameters:
|
|
112
|
+
- `ticket_id` (str): ID (also known as the key) of the ticket to be updated. This identifier is typically a combination of the project key and a sequence number, like `PRJ-123`.
|
|
113
|
+
- `additional_fields` (dict): A dictionary of fields to update the ticket with. This parameter allows specifying values for any standard or custom field in the ticket that supports updates.
|
|
114
|
+
Output:
|
|
115
|
+
- The function prints messages about the process of updating the ticket, including preparing the update data, making the request to update the ticket, and the result of that request.
|
|
116
|
+
Return:
|
|
117
|
+
- `True` if the update was successful. This indicates that the server accepted the update request and applied the changes to the ticket.
|
|
118
|
+
- `False` otherwise. If the ticket update fails (for example, due to incorrect ticket ID, fields that cannot be updated, or server errors), the function returns `False`, and additional error information is printed to help diagnose the issue.
|
|
119
|
+
______________________________________________________________________________
|
|
120
|
+
## 3. Delete a Jira Ticket
|
|
60
121
|
|
|
61
122
|
- To delete a ticket, use the `delete_ticket` method:
|
|
62
123
|
|
|
@@ -79,7 +140,7 @@ Return:
|
|
|
79
140
|
- `True`: If the ticket is successfully deleted. This is indicated by a `204` HTTP status code from the JIRA API, meaning "`No Content`" but signifying successful deletion.
|
|
80
141
|
- `False`: If the deletion fails, which can occur if the ticket does not exist or if there's an issue with the API request (e.g., permissions, invalid ticket key). This is communicated by returning `False`.
|
|
81
142
|
______________________________________________________________________________
|
|
82
|
-
##
|
|
143
|
+
## 4. Get Transition ID
|
|
83
144
|
|
|
84
145
|
```python
|
|
85
146
|
jira_helper = JiraHelper(JIRA_URL, EMAIL, API_TOKEN)
|
|
@@ -104,7 +165,7 @@ Return:
|
|
|
104
165
|
- `Transition ID` (str): If the specified transition is found for the given ticket, the function returns the transition's ID, which can be used for further actions like transitioning the ticket to another status.
|
|
105
166
|
- `False`: If the specified transition is not found for the ticket, or if there is any failure in fetching transitions (e.g., due to an invalid ticket key, network issues, or server errors), the function returns `False`.
|
|
106
167
|
______________________________________________________________________________
|
|
107
|
-
##
|
|
168
|
+
## 5. Transition a Jira Ticket
|
|
108
169
|
|
|
109
170
|
- To transition a ticket to a different status, use the `transition_ticket` method:
|
|
110
171
|
|
|
@@ -131,7 +192,7 @@ Return:
|
|
|
131
192
|
- `False`: If the ticket transition fails. This could be due to various reasons, such as an invalid ticket key, an unrecognized transition name or ID, or a failure in the HTTP request itself.
|
|
132
193
|
|
|
133
194
|
______________________________________________________________________________
|
|
134
|
-
##
|
|
195
|
+
## 6. If exist a Jira Ticket
|
|
135
196
|
|
|
136
197
|
- To check if a ticket exist, use the `if_ticket_exist` method:
|
|
137
198
|
|
|
@@ -154,7 +215,7 @@ Return:
|
|
|
154
215
|
- `True`: If the ticket exists. This is confirmed by a `200` HTTP status code, indicating that the ticket was found.
|
|
155
216
|
- `False`: If the ticket does not exist or if there was an error in checking. A `404` HTTP status code indicates the ticket does not exist. Other status codes indicate a failure in the request to check the ticket.
|
|
156
217
|
______________________________________________________________________________
|
|
157
|
-
##
|
|
218
|
+
## 7. Comment on a Jira ticket
|
|
158
219
|
|
|
159
220
|
- To comment on the ticket, use the `comment_ticket` method:
|
|
160
221
|
|
|
@@ -180,7 +241,7 @@ Return:
|
|
|
180
241
|
- `URL of the created comment` (str): If adding the comment is successful, the function returns the URL to access the newly created comment directly. This is indicated by a `201` HTTP status code, meaning "`Created`".
|
|
181
242
|
- `False`: If adding the comment fails. This could be because the ticket does not exist, the comment text is invalid, or there was an error in the request itself. In such cases, the function returns `False`.
|
|
182
243
|
______________________________________________________________________________
|
|
183
|
-
##
|
|
244
|
+
## 8. Pass the JQL and get the ticket array
|
|
184
245
|
|
|
185
246
|
- To query tickets using JQL, use the `jql_ticket` method:
|
|
186
247
|
|
|
@@ -554,12 +615,19 @@ ______________________________________________________________________________
|
|
|
554
615
|
|
|
555
616
|
# Release Notes
|
|
556
617
|
|
|
557
|
-
## Latest Release: 0.
|
|
558
|
-
-
|
|
559
|
-
-
|
|
560
|
-
|
|
618
|
+
## Latest Release: 0.4 (21 Mar 2024)
|
|
619
|
+
- New Features:
|
|
620
|
+
- JIRA Integration Enhancements:
|
|
621
|
+
- Custom Ticket Creation: The `create_custom_ticket` function has been introduced, allowing for more flexible ticket creation in JIRA projects. This function supports additional fields, enabling users to specify custom data during ticket creation.
|
|
622
|
+
- Ticket Field Updates: The `update_ticket_with_fields` method has been added, offering the ability to update existing tickets with new or modified fields. This feature is crucial for maintaining accurate and up-to-date ticket information.
|
|
623
|
+
- Beta Features (Continued from previous release):
|
|
624
|
+
- Beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
561
625
|
|
|
562
626
|
## Previous Releases:
|
|
627
|
+
- 0.3 (21 Mar 2024)
|
|
628
|
+
- Enhancements:
|
|
629
|
+
- Updated `readme.md` documentation.
|
|
630
|
+
- Introduced beta functions `wiki_helper.add_row_to_table` & `wiki_helper.update_or_add_table_row` for improved table management.
|
|
563
631
|
- 0.2.8 (21 Mar 2024)
|
|
564
632
|
- Minor updates and enhancements (details forthcoming).
|
|
565
633
|
- 0.2.7 (08 Jan 2024)
|
|
File without changes
|
|
File without changes
|
{atlassian_modules-0.3 → atlassian_modules-0.4}/atlassian_modules.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|