@@ -448,6 +448,8 @@ def getprojects(self, page=1, per_page=20):
448
448
"""
449
449
Returns a dictionary of all the projects
450
450
451
+ :param page: Page number
452
+ :param per_page: Records per page
451
453
:return: list with the repo name, description, last activity,web url, ssh url, owner and if its public
452
454
"""
453
455
data = {'page' : page , 'per_page' : per_page }
@@ -782,6 +784,8 @@ def getprojecthooks(self, project_id, page=1, per_page=20):
782
784
"""Get all the hooks from a project
783
785
784
786
:param project_id: project id
787
+ :param page: Page number
788
+ :param per_page: Records per page
785
789
:return: the hooks
786
790
"""
787
791
data = {'page' : page , 'per_page' : per_page }
@@ -813,7 +817,7 @@ def getprojecthook(self, project_id, hook_id):
813
817
def addprojecthook (self , project_id , url , push = False , issues = False , merge_requests = False , tag_push = False ):
814
818
"""
815
819
add a hook to a project
816
- :param id_ : project id
820
+ :param project_id : project id
817
821
:param url: url of the hook
818
822
:return: True if success
819
823
"""
@@ -1118,6 +1122,8 @@ def getissues(self, page=1, per_page=20):
1118
1122
"""
1119
1123
Return a global list of issues for your user.
1120
1124
1125
+ :param page: Page number
1126
+ :param per_page: Records per page
1121
1127
:return: list of issues
1122
1128
"""
1123
1129
data = {'page' : page , 'per_page' : per_page }
@@ -1136,6 +1142,9 @@ def getprojectissues(self, project_id, page=1, per_page=20, **kwargs):
1136
1142
Return a list of issues for project id.
1137
1143
1138
1144
:param: project_id: The id for the project.
1145
+ :param page: Page number
1146
+ :param per_page: Records per page
1147
+ :param kwargs: Extra data to send
1139
1148
:return: list of issues
1140
1149
"""
1141
1150
kwargs ['page' ] = page
@@ -1444,6 +1453,8 @@ def getgroups(self, group_id=None, page=1, per_page=20):
1444
1453
Retrieve group information
1445
1454
1446
1455
:param group_id: Specify a group. Otherwise, all groups are returned
1456
+ :param page: Page Number
1457
+ :param per_page: Records Per Page
1447
1458
:return: list of groups
1448
1459
"""
1449
1460
data = {'page' : page , 'per_page' : per_page }
@@ -1479,6 +1490,8 @@ def getmergerequests(self, project_id, page=1, per_page=20, state=None):
1479
1490
Get all the merge requests for a project.
1480
1491
1481
1492
:param project_id: ID of the project to retrieve merge requests for
1493
+ :param page: Page Number
1494
+ :param per_page: Records per page
1482
1495
:param state: Passes merge request state to filter them by it
1483
1496
:return: list with all the merge requests
1484
1497
"""
@@ -2212,10 +2225,10 @@ def deleteldapgrouplink(self, group_id, cn, provider=None):
2212
2225
"""
2213
2226
Deletes a LDAP group link (for a specific LDAP provider if given)
2214
2227
2215
- :param id : The ID of a group
2228
+ :param group_id : The ID of a group
2216
2229
:param cn: The CN of a LDAP group
2217
2230
:param provider: Name of a LDAP provider
2218
- :return True if success
2231
+ :return: True if success
2219
2232
"""
2220
2233
url = '{base}/{gid}/ldap_group_links/{provider}{cn}' .format (
2221
2234
base = self .groups_url , gid = group_id , cn = cn ,
@@ -2228,6 +2241,11 @@ def deleteldapgrouplink(self, group_id, cn, provider=None):
2228
2241
def getissuewallnotes (self , project_id , issue_id , page = 1 , per_page = 20 ):
2229
2242
"""
2230
2243
Get the notes from the wall of a issue
2244
+
2245
+ :param project_id: Project ID
2246
+ :param issue_id: Issue ID
2247
+ :param page: Page Number
2248
+ :param per_page: Records per page
2231
2249
"""
2232
2250
data = {'page' : page , 'per_page' : per_page }
2233
2251
@@ -2284,6 +2302,11 @@ def getsnippetwallnotes(self, project_id, snippet_id, page=1, per_page=20):
2284
2302
def getsnippetwallnote (self , project_id , snippet_id , note_id ):
2285
2303
"""
2286
2304
Get one note from the wall of the snippet
2305
+
2306
+ :param project_id: Project ID
2307
+ :param snippet_id: Snippet ID
2308
+ :param note_id: Note ID
2309
+ :return: Json or False
2287
2310
"""
2288
2311
request = requests .get (
2289
2312
'{0}/{1}/snippets/{2}/notes/{3}' .format (self .projects_url , project_id , snippet_id , note_id ),
@@ -2297,6 +2320,11 @@ def getsnippetwallnote(self, project_id, snippet_id, note_id):
2297
2320
def createsnippetewallnote (self , project_id , snippet_id , content ):
2298
2321
"""
2299
2322
Create a new note
2323
+
2324
+ :param project_id: Project ID
2325
+ :param snippet_id: Snippet ID
2326
+ :param content: Content
2327
+ :return: Json or False
2300
2328
"""
2301
2329
data = {'body' : content }
2302
2330
@@ -2312,6 +2340,12 @@ def createsnippetewallnote(self, project_id, snippet_id, content):
2312
2340
def getmergerequestwallnotes (self , project_id , merge_request_id , page = 1 , per_page = 20 ):
2313
2341
"""
2314
2342
Get the notes from the wall of a merge request
2343
+
2344
+ :param project_id: Project ID
2345
+ :param merge_request_id: Merger Request ID
2346
+ :param page: Page number
2347
+ :param per_page: Records per page
2348
+ :return: Json or False
2315
2349
"""
2316
2350
data = {'page' : page , 'per_page' : per_page }
2317
2351
@@ -2327,6 +2361,11 @@ def getmergerequestwallnotes(self, project_id, merge_request_id, page=1, per_pag
2327
2361
def getmergerequestwallnote (self , project_id , merge_request_id , note_id ):
2328
2362
"""
2329
2363
Get one note from the wall of the merge request
2364
+
2365
+ :param project_id: Project ID
2366
+ :param merge_request_id: Merger Request ID
2367
+ :param note_id: Note ID
2368
+ :return: Json or False
2330
2369
"""
2331
2370
request = requests .get (
2332
2371
'{0}/{1}/merge_requests/{2}/notes/{3}' .format (self .projects_url , project_id , merge_request_id , note_id ),
@@ -2340,6 +2379,11 @@ def getmergerequestwallnote(self, project_id, merge_request_id, note_id):
2340
2379
def createmergerequestewallnote (self , project_id , merge_request_id , content ):
2341
2380
"""
2342
2381
Create a new note
2382
+
2383
+ :param project_id: Project ID
2384
+ :param merge_request_id: Merger Request ID
2385
+ :param content: Content
2386
+ :return: Json or False
2343
2387
"""
2344
2388
data = {'body' : content }
2345
2389
@@ -2465,6 +2509,9 @@ def deletegitlabciservice(self, project_id, token, project_url):
2465
2509
"""
2466
2510
Delete GitLab CI service settings
2467
2511
2512
+ :param project_id: Project ID
2513
+ :param token: Token
2514
+ :param project_url: Project URL
2468
2515
:return: true if success, false if not
2469
2516
"""
2470
2517
request = requests .delete (
@@ -2568,21 +2615,23 @@ def getnamespaces(self, search=None, page=1, per_page=20):
2568
2615
return False
2569
2616
2570
2617
@staticmethod
2571
- def getall (fn , * args , ** kwargs ):
2618
+ def getall (fn , * args , page = None , ** kwargs ):
2572
2619
"""
2573
2620
Auto-iterate over the paginated results of various methods of the API.
2574
2621
Pass the GitLabAPI method as the first argument, followed by the
2575
2622
other parameters as normal. Include `page` to determine first page to poll.
2576
2623
Remaining kwargs are passed on to the called method, including `per_page`.
2577
2624
2625
+
2626
+
2578
2627
:param fn: Actual method to call
2579
- :param * args: Positional arguments to actual method
2628
+ :param args: Positional arguments to actual method
2580
2629
:param page: Optional, page number to start at, defaults to 1
2581
- :param **kwargs: Keyword arguments to actual method
2582
- :return: Yields each item in the result until exhausted, and then
2583
- implicit StopIteration; or no elements if error
2630
+ :param kwargs: Keyword arguments to actual method
2631
+ :return: Yields each item in the result until exhausted, and then implicit StopIteration; or no elements if error
2584
2632
"""
2585
- page = kwargs .pop ('page' , 1 )
2633
+ if not page :
2634
+ page = 1
2586
2635
2587
2636
while True :
2588
2637
results = fn (* args , page = page , ** kwargs )
0 commit comments