File tree 2 files changed +70
-0
lines changed
2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 109
109
# share
110
110
project .share (group .id , group .DEVELOPER_ACCESS )
111
111
# end share
112
+
113
+ # hook list
114
+ hooks = gl .project_hooks .list (project_id = 1 )
115
+ # or
116
+ hooks = project .hooks .list ()
117
+ # end hook list
118
+
119
+ # hook get
120
+ hook = gl .project_hooks .get (1 , project_id = 1 )
121
+ # or
122
+ hook = project .hooks .get (1 )
123
+ # end hook get
124
+
125
+ # hook create
126
+ hook = gl .project_hooks .create ({'url' : 'http://my/action/url' ,
127
+ 'push_events' : 1 },
128
+ project_id = 1 )
129
+ # or
130
+ hook = project .hooks .create ({'url' : 'http://my/action/url' , 'push_events' : 1 })
131
+ # end hook create
132
+
133
+ # hook update
134
+ hook .push_events = 0
135
+ hook .save ()
136
+ # end hook update
137
+
138
+ # hook delete
139
+ gl .project_hooks .delete (1 , project_id = 1 )
140
+ # or
141
+ project .hooks .delete (1 )
142
+ # or
143
+ hook .delete ()
144
+ # end hook delete
Original file line number Diff line number Diff line change @@ -143,3 +143,40 @@ Share the project with a group:
143
143
.. literalinclude :: projects.py
144
144
:start-after: # share
145
145
:end-before: # end share
146
+
147
+ Hooks
148
+ -----
149
+
150
+ Use :class: `~gitlab.objects.ProjectHook ` objects to manipulate projects
151
+ hooks. The :attr: `gitlab.Gitlab.project_hooks ` and :attr: `Project.hooks
152
+ <gitlab.objects.Projects.hooks> ` manager objects provide helper functions.
153
+
154
+ List the project hooks:
155
+
156
+ .. literalinclude :: projects.py
157
+ :start-after: # hook list
158
+ :end-before: # end hook list
159
+
160
+ Get a project hook
161
+
162
+ .. literalinclude :: projects.py
163
+ :start-after: # hook get
164
+ :end-before: # end hook get
165
+
166
+ Create a project hook:
167
+
168
+ .. literalinclude :: projects.py
169
+ :start-after: # hook create
170
+ :end-before: # end hook create
171
+
172
+ Update a project hook:
173
+
174
+ .. literalinclude :: projects.py
175
+ :start-after: # hook update
176
+ :end-before: # end hook update
177
+
178
+ Delete a project hook:
179
+
180
+ .. literalinclude :: projects.py
181
+ :start-after: # hook delete
182
+ :end-before: # end hook delete
You can’t perform that action at this time.
0 commit comments