@@ -7,32 +7,7 @@ python-gitlab supports both GitLab v3 and v4 APIs.
7
7
v3 being deprecated by GitLab, its support in python-gitlab will be minimal.
8
8
The development team will focus on v4.
9
9
10
- v3 is still the default API used by python-gitlab, for compatibility reasons..
11
-
12
-
13
- Base types
14
- ==========
15
-
16
- The ``gitlab `` package provides some base types.
17
-
18
- * ``gitlab.Gitlab `` is the primary class, handling the HTTP requests. It holds
19
- the GitLab URL and authentication information.
20
-
21
- For v4 the following types are defined:
22
-
23
- * ``gitlab.base.RESTObject `` is the base class for all the GitLab v4 objects.
24
- These objects provide an abstraction for GitLab resources (projects, groups,
25
- and so on).
26
- * ``gitlab.base.RESTManager `` is the base class for v4 objects managers,
27
- providing the API to manipulate the resources and their attributes.
28
-
29
- For v3 the following types are defined:
30
-
31
- * ``gitlab.base.GitlabObject `` is the base class for all the GitLab v3 objects.
32
- These objects provide an abstraction for GitLab resources (projects, groups,
33
- and so on).
34
- * ``gitlab.base.BaseManager `` is the base class for v3 objects managers,
35
- providing the API to manipulate the resources and their attributes.
10
+ v3 is still the default API used by python-gitlab, for compatibility reasons.
36
11
37
12
38
13
``gitlab.Gitlab `` class
@@ -109,6 +84,17 @@ Examples:
109
84
user = gl.users.create(user_data)
110
85
print (user)
111
86
87
+ You can list the mandatory and optional attributes for object creation
88
+ with the manager's ``get_create_attrs() `` method. It returns 2 tuples, the
89
+ first one is the list of mandatory attributes, the second one the list of
90
+ optional attribute:
91
+
92
+ .. code-block :: python
93
+
94
+ # v4 only
95
+ print (gl.projects.get_create_attrs())
96
+ ((' name' ,), (' path' , ' namespace_id' , ... ))
97
+
112
98
The attributes of objects are defined upon object creation, and depend on the
113
99
GitLab API itself. To list the available information associated with an object
114
100
use the python introspection tools for v3, or the ``attributes `` attribute for
@@ -150,7 +136,6 @@ You can update or delete a remote object when it exists locally:
150
136
# delete the resource
151
137
project.delete()
152
138
153
-
154
139
Some classes provide additional methods, allowing more actions on the GitLab
155
140
resources. For example:
156
141
@@ -160,6 +145,30 @@ resources. For example:
160
145
project = gl.projects.get(1 )
161
146
project.star()
162
147
148
+ Base types
149
+ ==========
150
+
151
+ The ``gitlab `` package provides some base types.
152
+
153
+ * ``gitlab.Gitlab `` is the primary class, handling the HTTP requests. It holds
154
+ the GitLab URL and authentication information.
155
+
156
+ For v4 the following types are defined:
157
+
158
+ * ``gitlab.base.RESTObject `` is the base class for all the GitLab v4 objects.
159
+ These objects provide an abstraction for GitLab resources (projects, groups,
160
+ and so on).
161
+ * ``gitlab.base.RESTManager `` is the base class for v4 objects managers,
162
+ providing the API to manipulate the resources and their attributes.
163
+
164
+ For v3 the following types are defined:
165
+
166
+ * ``gitlab.base.GitlabObject `` is the base class for all the GitLab v3 objects.
167
+ These objects provide an abstraction for GitLab resources (projects, groups,
168
+ and so on).
169
+ * ``gitlab.base.BaseManager `` is the base class for v3 objects managers,
170
+ providing the API to manipulate the resources and their attributes.
171
+
163
172
Lazy objects (v4 only)
164
173
======================
165
174
0 commit comments