Skip to content

Commit cc23fb8

Browse files
committed
Started updating docs
1 parent 262b080 commit cc23fb8

File tree

1 file changed

+58
-9
lines changed

1 file changed

+58
-9
lines changed

gitlab/__init__.py

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ def getprojects(self, page=1, per_page=20):
448448
"""
449449
Returns a dictionary of all the projects
450450
451+
:param page: Page number
452+
:param per_page: Records per page
451453
:return: list with the repo name, description, last activity,web url, ssh url, owner and if its public
452454
"""
453455
data = {'page': page, 'per_page': per_page}
@@ -782,6 +784,8 @@ def getprojecthooks(self, project_id, page=1, per_page=20):
782784
"""Get all the hooks from a project
783785
784786
:param project_id: project id
787+
:param page: Page number
788+
:param per_page: Records per page
785789
:return: the hooks
786790
"""
787791
data = {'page': page, 'per_page': per_page}
@@ -813,7 +817,7 @@ def getprojecthook(self, project_id, hook_id):
813817
def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False):
814818
"""
815819
add a hook to a project
816-
:param id_: project id
820+
:param project_id: project id
817821
:param url: url of the hook
818822
:return: True if success
819823
"""
@@ -1118,6 +1122,8 @@ def getissues(self, page=1, per_page=20):
11181122
"""
11191123
Return a global list of issues for your user.
11201124
1125+
:param page: Page number
1126+
:param per_page: Records per page
11211127
:return: list of issues
11221128
"""
11231129
data = {'page': page, 'per_page': per_page}
@@ -1136,6 +1142,9 @@ def getprojectissues(self, project_id, page=1, per_page=20, **kwargs):
11361142
Return a list of issues for project id.
11371143
11381144
: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
11391148
:return: list of issues
11401149
"""
11411150
kwargs['page'] = page
@@ -1444,6 +1453,8 @@ def getgroups(self, group_id=None, page=1, per_page=20):
14441453
Retrieve group information
14451454
14461455
:param group_id: Specify a group. Otherwise, all groups are returned
1456+
:param page: Page Number
1457+
:param per_page: Records Per Page
14471458
:return: list of groups
14481459
"""
14491460
data = {'page': page, 'per_page': per_page}
@@ -1479,6 +1490,8 @@ def getmergerequests(self, project_id, page=1, per_page=20, state=None):
14791490
Get all the merge requests for a project.
14801491
14811492
:param project_id: ID of the project to retrieve merge requests for
1493+
:param page: Page Number
1494+
:param per_page: Records per page
14821495
:param state: Passes merge request state to filter them by it
14831496
:return: list with all the merge requests
14841497
"""
@@ -2212,10 +2225,10 @@ def deleteldapgrouplink(self, group_id, cn, provider=None):
22122225
"""
22132226
Deletes a LDAP group link (for a specific LDAP provider if given)
22142227
2215-
:param id: The ID of a group
2228+
:param group_id: The ID of a group
22162229
:param cn: The CN of a LDAP group
22172230
:param provider: Name of a LDAP provider
2218-
:return True if success
2231+
:return: True if success
22192232
"""
22202233
url = '{base}/{gid}/ldap_group_links/{provider}{cn}'.format(
22212234
base=self.groups_url, gid=group_id, cn=cn,
@@ -2228,6 +2241,11 @@ def deleteldapgrouplink(self, group_id, cn, provider=None):
22282241
def getissuewallnotes(self, project_id, issue_id, page=1, per_page=20):
22292242
"""
22302243
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
22312249
"""
22322250
data = {'page': page, 'per_page': per_page}
22332251

@@ -2284,6 +2302,11 @@ def getsnippetwallnotes(self, project_id, snippet_id, page=1, per_page=20):
22842302
def getsnippetwallnote(self, project_id, snippet_id, note_id):
22852303
"""
22862304
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
22872310
"""
22882311
request = requests.get(
22892312
'{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):
22972320
def createsnippetewallnote(self, project_id, snippet_id, content):
22982321
"""
22992322
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
23002328
"""
23012329
data = {'body': content}
23022330

@@ -2312,6 +2340,12 @@ def createsnippetewallnote(self, project_id, snippet_id, content):
23122340
def getmergerequestwallnotes(self, project_id, merge_request_id, page=1, per_page=20):
23132341
"""
23142342
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
23152349
"""
23162350
data = {'page': page, 'per_page': per_page}
23172351

@@ -2327,6 +2361,11 @@ def getmergerequestwallnotes(self, project_id, merge_request_id, page=1, per_pag
23272361
def getmergerequestwallnote(self, project_id, merge_request_id, note_id):
23282362
"""
23292363
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
23302369
"""
23312370
request = requests.get(
23322371
'{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):
23402379
def createmergerequestewallnote(self, project_id, merge_request_id, content):
23412380
"""
23422381
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
23432387
"""
23442388
data = {'body': content}
23452389

@@ -2465,6 +2509,9 @@ def deletegitlabciservice(self, project_id, token, project_url):
24652509
"""
24662510
Delete GitLab CI service settings
24672511
2512+
:param project_id: Project ID
2513+
:param token: Token
2514+
:param project_url: Project URL
24682515
:return: true if success, false if not
24692516
"""
24702517
request = requests.delete(
@@ -2568,21 +2615,23 @@ def getnamespaces(self, search=None, page=1, per_page=20):
25682615
return False
25692616

25702617
@staticmethod
2571-
def getall(fn, *args, **kwargs):
2618+
def getall(fn, *args, page=None, **kwargs):
25722619
"""
25732620
Auto-iterate over the paginated results of various methods of the API.
25742621
Pass the GitLabAPI method as the first argument, followed by the
25752622
other parameters as normal. Include `page` to determine first page to poll.
25762623
Remaining kwargs are passed on to the called method, including `per_page`.
25772624
2625+
2626+
25782627
:param fn: Actual method to call
2579-
:param *args: Positional arguments to actual method
2628+
:param args: Positional arguments to actual method
25802629
: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
25842632
"""
2585-
page = kwargs.pop('page', 1)
2633+
if not page:
2634+
page = 1
25862635

25872636
while True:
25882637
results = fn(*args, page=page, **kwargs)

0 commit comments

Comments
 (0)