3737 }
3838 },
3939)
40- PROJECT_KEY = StringParam (
41- "PROJECT_KEY" , description = "Project key of your Jira instance (e.g. 'XY')"
42- )
40+ PROJECT_KEY = StringParam ("PROJECT_KEY" ,
41+ description = "Project key of your Jira instance (e.g. 'XY')" )
4342ISSUE_TYPE_ID = IntParam (
4443 "ISSUE_TYPE_ID" ,
4544 description = "Issue type ID for the Jira issues being created" ,
5554 description = "Owner of the Jira API token" ,
5655 input = {
5756 "text" : {
58- "validation_regex" : r"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$" ,
59- "validation_error_message" : "Please enter a valid email address" ,
57+ "validation_regex" :
58+ r"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$" ,
59+ "validation_error_message" :
60+ "Please enter a valid email address" ,
6061 }
6162 },
6263)
@@ -94,8 +95,7 @@ def create_issue(event: InAppFeedbackEvent):
9495 )
9596 if not response .ok :
9697 raise Exception (
97- f"Issue creation failed: { response .status_code } { response .reason } for { request_json } "
98- )
98+ f"Issue creation failed: { response .status_code } { response .reason } for { request_json } " )
9999 return response .json ()["self" ] # issueUri
100100
101101
@@ -104,8 +104,7 @@ def upload_screenshot(issue_uri: str, screenshot_uri: str):
104104 dl_response = requests .get (screenshot_uri )
105105 if not dl_response .ok :
106106 raise Exception (
107- f"Screenshot download failed: { dl_response .status_code } { dl_response .reason } "
108- )
107+ f"Screenshot download failed: { dl_response .status_code } { dl_response .reason } " )
109108 blob = dl_response .content
110109 files = {"file" : ("screenshot.png" , blob , "image/png" )}
111110 ul_response = requests .post (
@@ -118,16 +117,17 @@ def upload_screenshot(issue_uri: str, screenshot_uri: str):
118117 files = files ,
119118 )
120119 if not ul_response .ok :
121- raise Exception (
122- f"Screenshot upload failed: { ul_response .status_code } { ul_response .reason } "
123- )
120+ raise Exception (f"Screenshot upload failed: { ul_response .status_code } { ul_response .reason } " )
124121
125122
126123def lookup_reporter (tester_email : str ):
127124 """Looks up Jira user ID."""
128125 response = requests .get (
129126 f"{ JIRA_URI .value ()} /rest/api/3/user/search?query={ tester_email } " ,
130- headers = {"Authorization" : auth_header (), "Accept" : "application/json" },
127+ headers = {
128+ "Authorization" : auth_header (),
129+ "Accept" : "application/json"
130+ },
131131 )
132132 if not response .ok :
133133 print (
@@ -148,52 +148,79 @@ def build_create_issue_request(event: InAppFeedbackEvent):
148148 "update" : {},
149149 "fields" : {
150150 "summary" : summary ,
151- "issuetype" : {"id" : str (ISSUE_TYPE_ID .value ())},
152- "project" : {"key" : PROJECT_KEY .value ()},
151+ "issuetype" : {
152+ "id" : str (ISSUE_TYPE_ID .value ())
153+ },
154+ "project" : {
155+ "key" : PROJECT_KEY .value ()
156+ },
153157 "description" : {
154- "type" : "doc" ,
155- "version" : 1 ,
158+ "type" :
159+ "doc" ,
160+ "version" :
161+ 1 ,
156162 "content" : [
157163 {
158- "type" : "paragraph" ,
164+ "type" :
165+ "paragraph" ,
159166 "content" : [
160167 {
161168 "text" : "Firebase App ID: " ,
162169 "type" : "text" ,
163- "marks" : [{"type" : "strong" }],
170+ "marks" : [{
171+ "type" : "strong"
172+ }],
173+ },
174+ {
175+ "text" : event .app_id ,
176+ "type" : "text"
164177 },
165- {"text" : event .app_id , "type" : "text" },
166178 ],
167179 },
168180 {
169- "type" : "paragraph" ,
181+ "type" :
182+ "paragraph" ,
170183 "content" : [
171184 {
172185 "text" : "App Version: " ,
173186 "type" : "text" ,
174- "marks" : [{"type" : "strong" }],
187+ "marks" : [{
188+ "type" : "strong"
189+ }],
190+ },
191+ {
192+ "text" : event .data .payload .app_version ,
193+ "type" : "text"
175194 },
176- {"text" : event .data .payload .app_version , "type" : "text" },
177195 ],
178196 },
179197 {
180- "type" : "paragraph" ,
198+ "type" :
199+ "paragraph" ,
181200 "content" : [
182201 {
183202 "text" : "Tester Email: " ,
184203 "type" : "text" ,
185- "marks" : [{"type" : "strong" }],
204+ "marks" : [{
205+ "type" : "strong"
206+ }],
207+ },
208+ {
209+ "text" : event .data .payload .tester_email ,
210+ "type" : "text"
186211 },
187- {"text" : event .data .payload .tester_email , "type" : "text" },
188212 ],
189213 },
190214 {
191- "type" : "paragraph" ,
215+ "type" :
216+ "paragraph" ,
192217 "content" : [
193218 {
194219 "text" : "Tester Name: " ,
195220 "type" : "text" ,
196- "marks" : [{"type" : "strong" }],
221+ "marks" : [{
222+ "type" : "strong"
223+ }],
197224 },
198225 {
199226 "text" : event .data .payload .tester_name or "None" ,
@@ -202,33 +229,38 @@ def build_create_issue_request(event: InAppFeedbackEvent):
202229 ],
203230 },
204231 {
205- "type" : "paragraph" ,
232+ "type" :
233+ "paragraph" ,
206234 "content" : [
207235 {
208236 "text" : "Feedback text: " ,
209237 "type" : "text" ,
210- "marks" : [{"type" : "strong" }],
238+ "marks" : [{
239+ "type" : "strong"
240+ }],
241+ },
242+ {
243+ "text" : event .data .payload .text ,
244+ "type" : "text"
211245 },
212- {"text" : event .data .payload .text , "type" : "text" },
213246 ],
214247 },
215248 {
216- "type" : "paragraph" ,
217- "content" : [
218- {
219- "text" : "Console link" ,
220- "type" : "text" ,
221- "marks" : [
222- {
223- "type" : "link" ,
224- "attrs" : {
225- "href" : event .data .payload .feedback_console_uri ,
226- "title" : "Firebase console" ,
227- },
228- }
229- ],
230- }
231- ],
249+ "type" :
250+ "paragraph" ,
251+ "content" : [{
252+ "text" :
253+ "Console link" ,
254+ "type" :
255+ "text" ,
256+ "marks" : [{
257+ "type" : "link" ,
258+ "attrs" : {
259+ "href" : event .data .payload .feedback_console_uri ,
260+ "title" : "Firebase console" ,
261+ },
262+ }],
263+ }],
232264 },
233265 ],
234266 },
0 commit comments