@@ -177,6 +177,40 @@ def export_labels(self, timeout_seconds=60):
177
177
self .uid )
178
178
time .sleep (sleep_time )
179
179
180
+ def export_issues (self , status = None ):
181
+ """ Calls the server-side Issues exporting that
182
+ returns the URL to that payload.
183
+
184
+ Args:
185
+ status (string): valid values: Open, Resolved
186
+ Returns:
187
+ URL of the data file with this Project's issues.
188
+ """
189
+ id_param = "projectId"
190
+ status_param = "status"
191
+ query_str = """query GetProjectIssuesExportPyApi($%s: ID!, $%s: IssueStatus) {
192
+ project(where: { id: $%s }) {
193
+ issueExportUrl(where: { status: $%s })
194
+ }
195
+ }""" % (id_param , status_param , id_param , status_param )
196
+
197
+ valid_statuses = {None , "Open" , "Resolved" }
198
+
199
+ if status not in valid_statuses :
200
+ raise ValueError ("status must be in {}. Found {}" .format (
201
+ valid_statuses , status ))
202
+
203
+ res = self .client .execute (query_str , {
204
+ id_param : self .uid ,
205
+ status_param : status
206
+ })
207
+
208
+ res = res ['project' ]
209
+
210
+ logger .debug ("Project '%s' issues export, link generated" , self .uid )
211
+
212
+ return res .get ('issueExportUrl' )
213
+
180
214
def upsert_instructions (self , instructions_file : str ):
181
215
"""
182
216
* Uploads instructions to the UI. Running more than once will replace the instructions
0 commit comments