Skip to content

Commit 4540614

Browse files
author
Gauvain Pocentek
committed
docs: add licenses API
1 parent 31882b8 commit 4540614

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

docs/api-objects.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ API objects manipulation
1313
gl_objects/groups
1414
gl_objects/issues
1515
gl_objects/labels
16+
gl_objects/licenses
1617
gl_objects/namespaces
1718
gl_objects/projects
1819
gl_objects/runners

docs/gl_objects/licenses.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# list
2+
licenses = gl.licenses.list()
3+
# end list
4+
5+
# get
6+
license = gl.licenses.get('apache-2.0', project='foobar', fullname='John Doe')
7+
print(license.content)
8+
# end get

docs/gl_objects/licenses.rst

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
########
2+
Licenses
3+
########
4+
5+
Use :class:`~gitlab.objects.License` objects to manipulate licenses. The
6+
:attr:`gitlab.Gitlab.licenses` manager object provides helper functions.
7+
8+
Examples
9+
--------
10+
11+
List known licenses:
12+
13+
.. literalinclude:: licenses.py
14+
:start-after: # list
15+
:end-before: # end list
16+
17+
Generate a license content for a project:
18+
19+
.. literalinclude:: licenses.py
20+
:start-after: # get
21+
:end-before: # end get

0 commit comments

Comments
 (0)