@@ -194,6 +194,24 @@ def get_all_draft_pages_from_space(self, space, start=0, limit=500, status='draf
194
194
status = status )
195
195
return (self .get (url ) or {}).get ('results' )
196
196
197
+ def get_all_draft_pages_from_space_through_cql (self , space , start = 0 , limit = 500 , status = 'draft' ):
198
+ """
199
+ Search list of draft pages by space key
200
+ Use case is cleanup old drafts from Confluence
201
+ :param space: Space Key
202
+ :param status: Can be changed
203
+ :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
204
+ :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
205
+ fixed system limits. Default: 500
206
+ :return:
207
+ """
208
+ url = 'rest/api/content?cql=space=spaceKey={space} and status={status}' .format (space = space ,
209
+ status = status )
210
+ params = {}
211
+ params ['limit' ] = limit
212
+ params ['start' ] = start
213
+ return (self .get (url , params = params ) or {}).get ('results' )
214
+
197
215
def get_all_restictions_for_content (self , content_id ):
198
216
"""
199
217
Returns info about all restrictions by operation.
@@ -209,16 +227,28 @@ def remove_page_from_trash(self, page_id):
209
227
:param page_id:
210
228
:return:
211
229
"""
212
- url = 'rest/api/content/{page_id}?status=trashed' .format (page_id = page_id )
213
- return self .delete (url )
230
+ return self .remove_page (page_id = page_id , status = 'trashed' )
214
231
215
- def remove_page (self , page_id ):
232
+ def remove_page_as_draft (self , page_id ):
233
+ """
234
+ This method removed page from trash
235
+ :param page_id:
236
+ :return:
237
+ """
238
+ return self .remove_page (page_id = page_id , status = 'draft' )
239
+
240
+ def remove_page (self , page_id , status = None ):
216
241
"""
217
242
This method removed page
218
243
:param page_id:
244
+ :param status: OPTIONAL: type of page
219
245
:return:
220
246
"""
221
- url = 'rest/api/content/{page_id}' .format (page_id = page_id )
247
+ if status is None :
248
+ url = 'rest/api/content/{page_id}' .format (page_id = page_id )
249
+ else :
250
+ url = 'rest/api/content/{page_id}?status={status}' .format (page_id = page_id , status = status )
251
+
222
252
return self .delete (url )
223
253
224
254
def create_page (self , space , title , body , parent_id = None , type = 'page' ):
0 commit comments