python-gitlab 4.8.0__py3-none-any.whl → 4.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gitlab/_version.py CHANGED
@@ -3,4 +3,4 @@ __copyright__ = "Copyright 2013-2019 Gauvain Pocentek, 2019-2023 python-gitlab t
3
3
  __email__ = "gauvainpocentek@gmail.com"
4
4
  __license__ = "LGPL3"
5
5
  __title__ = "python-gitlab"
6
- __version__ = "4.8.0"
6
+ __version__ = "4.10.0"
gitlab/exceptions.py CHANGED
@@ -316,6 +316,10 @@ class GitlabDeploymentApprovalError(GitlabOperationError):
316
316
  pass
317
317
 
318
318
 
319
+ class GitlabHookTestError(GitlabOperationError):
320
+ pass
321
+
322
+
319
323
  # For an explanation of how these type-hints work see:
320
324
  # https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators
321
325
  #
@@ -370,6 +374,7 @@ __all__ = [
370
374
  "GitlabGetError",
371
375
  "GitlabGroupTransferError",
372
376
  "GitlabHeadError",
377
+ "GitlabHookTestError",
373
378
  "GitlabHousekeepingError",
374
379
  "GitlabHttpError",
375
380
  "GitlabImportError",
@@ -1,5 +1,6 @@
1
1
  from typing import Any, cast, Union
2
2
 
3
+ from gitlab import exceptions as exc
3
4
  from gitlab.base import RESTManager, RESTObject
4
5
  from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin
5
6
  from gitlab.types import RequiredOptional
@@ -31,6 +32,20 @@ class HookManager(NoUpdateMixin, RESTManager):
31
32
  class ProjectHook(SaveMixin, ObjectDeleteMixin, RESTObject):
32
33
  _repr_attr = "url"
33
34
 
35
+ @exc.on_http_error(exc.GitlabHookTestError)
36
+ def test(self, trigger: str) -> None:
37
+ """
38
+ Test a Project Hook
39
+
40
+ Args:
41
+ trigger: Type of trigger event to test
42
+
43
+ Raises:
44
+ GitlabHookTestError: If the hook test attempt failed
45
+ """
46
+ path = f"{self.manager.path}/{self.encoded_id}/test/{trigger}"
47
+ self.manager.gitlab.http_post(path)
48
+
34
49
 
35
50
  class ProjectHookManager(CRUDMixin, RESTManager):
36
51
  _path = "/projects/{project_id}/hooks"
@@ -78,6 +93,20 @@ class ProjectHookManager(CRUDMixin, RESTManager):
78
93
  class GroupHook(SaveMixin, ObjectDeleteMixin, RESTObject):
79
94
  _repr_attr = "url"
80
95
 
96
+ @exc.on_http_error(exc.GitlabHookTestError)
97
+ def test(self, trigger: str) -> None:
98
+ """
99
+ Test a Group Hook
100
+
101
+ Args:
102
+ trigger: Type of trigger event to test
103
+
104
+ Raises:
105
+ GitlabHookTestError: If the hook test attempt failed
106
+ """
107
+ path = f"{self.manager.path}/{self.encoded_id}/test/{trigger}"
108
+ self.manager.gitlab.http_post(path)
109
+
81
110
 
82
111
  class GroupHookManager(CRUDMixin, RESTManager):
83
112
  _path = "/groups/{group_id}/hooks"
@@ -90,11 +90,35 @@ class SnippetManager(CRUDMixin, RESTManager):
90
90
  )
91
91
 
92
92
  @cli.register_custom_action(cls_names="SnippetManager")
93
- def public(self, **kwargs: Any) -> Union[RESTObjectList, List[RESTObject]]:
94
- """List all the public snippets.
93
+ def list_public(self, **kwargs: Any) -> Union[RESTObjectList, List[RESTObject]]:
94
+ """List all public snippets.
95
+
96
+ Args:
97
+ get_all: If True, return all the items, without pagination
98
+ per_page: Number of items to retrieve per request
99
+ page: ID of the page to return (starts with page 1)
100
+ iterator: If set to True and no pagination option is
101
+ defined, return a generator instead of a list
102
+ **kwargs: Extra options to send to the server (e.g. sudo)
103
+
104
+ Raises:
105
+ GitlabListError: If the list could not be retrieved
106
+
107
+ Returns:
108
+ The list of snippets, or a generator if `iterator` is True
109
+ """
110
+ return self.list(path="/snippets/public", **kwargs)
111
+
112
+ @cli.register_custom_action(cls_names="SnippetManager")
113
+ def list_all(self, **kwargs: Any) -> Union[RESTObjectList, List[RESTObject]]:
114
+ """List all snippets.
95
115
 
96
116
  Args:
97
- all: If True the returned object will be a list
117
+ get_all: If True, return all the items, without pagination
118
+ per_page: Number of items to retrieve per request
119
+ page: ID of the page to return (starts with page 1)
120
+ iterator: If set to True and no pagination option is
121
+ defined, return a generator instead of a list
98
122
  **kwargs: Extra options to send to the server (e.g. sudo)
99
123
 
100
124
  Raises:
@@ -103,6 +127,32 @@ class SnippetManager(CRUDMixin, RESTManager):
103
127
  Returns:
104
128
  A generator for the snippets list
105
129
  """
130
+ return self.list(path="/snippets/all", **kwargs)
131
+
132
+ def public(self, **kwargs: Any) -> Union[RESTObjectList, List[RESTObject]]:
133
+ """List all public snippets.
134
+
135
+ Args:
136
+ get_all: If True, return all the items, without pagination
137
+ per_page: Number of items to retrieve per request
138
+ page: ID of the page to return (starts with page 1)
139
+ iterator: If set to True and no pagination option is
140
+ defined, return a generator instead of a list
141
+ **kwargs: Extra options to send to the server (e.g. sudo)
142
+
143
+ Raises:
144
+ GitlabListError: If the list could not be retrieved
145
+
146
+ Returns:
147
+ The list of snippets, or a generator if `iterator` is True
148
+ """
149
+ utils.warn(
150
+ message=(
151
+ "Gitlab.snippets.public() is deprecated and will be removed in a"
152
+ "future major version. Use Gitlab.snippets.list_public() instead."
153
+ ),
154
+ category=DeprecationWarning,
155
+ )
106
156
  return self.list(path="/snippets/public", **kwargs)
107
157
 
108
158
  def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Snippet:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-gitlab
3
- Version: 4.8.0
3
+ Version: 4.10.0
4
4
  Summary: A python wrapper for the GitLab API
5
5
  Author-email: Gauvain Pocentek <gauvain@pocentek.net>
6
6
  Maintainer-email: John Villalovos <john@sodarock.com>, Max Wittig <max.wittig@siemens.com>, Nejc Habjan <nejc.habjan@siemens.com>, Roger Meier <r.meier@siemens.com>
@@ -1,12 +1,12 @@
1
1
  gitlab/__init__.py,sha256=bd8BSLyUUjtHMKtzmf-T5855W6FUHcuhIwx2hNu0w2o,1382
2
2
  gitlab/__main__.py,sha256=HTesNl0UAU6mPb9EXWkTKMy6Q6pAUxGi3iPnDHTE2uE,68
3
- gitlab/_version.py,sha256=3TRBcm3XV1lQcTc_QJPz-wxp5A9NuRqyRAdwFZNNgk0,249
3
+ gitlab/_version.py,sha256=C2if8HKzMGs_l0KkoB0yUyEdcIgWXwepCAiMYKCptLo,250
4
4
  gitlab/base.py,sha256=5cotawlHD01Vw88aN4o7wNIhDyk_bmcwubX4mbOpnVo,13780
5
5
  gitlab/cli.py,sha256=d3-LtZuA1Fgon5wZWn4c3E70fTIu4mM4Juyhh3F8EBs,12416
6
6
  gitlab/client.py,sha256=fPezDHNi4kJxzGxGeDWOWsKmKy76wVR4-fteCgDrY4I,49296
7
7
  gitlab/config.py,sha256=T1DgUXD0-MN2qNszrv-SO5d4uy0FITnNN0vWJgOt2yo,9088
8
8
  gitlab/const.py,sha256=rtPU-fxVSOvgpueoQVTvZGQp6iAZ-aa3nsY4RcSs_M4,5352
9
- gitlab/exceptions.py,sha256=Ruz9LusKMRu6SyV1vXpOu_UTCi3XU64A9BeHsqKASOw,8303
9
+ gitlab/exceptions.py,sha256=VOQftPzEq5mpVj6vke7z6Xe4S7Yf_rDTab0lNHqf3AY,8390
10
10
  gitlab/mixins.py,sha256=7iPlzqGmd5Ew2RLzRzRWsJ4r8Bn6wteUj791BJrjtXc,36645
11
11
  gitlab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  gitlab/types.py,sha256=lepiiI_YOr94B4koqIHuY70tszZC_X3YW4lDvbadbI8,3312
@@ -48,7 +48,7 @@ gitlab/v4/objects/files.py,sha256=9M7pocu_n9JDRAPu5BqIt398emYD5WVnGh3wAJinPX8,10
48
48
  gitlab/v4/objects/geo_nodes.py,sha256=tD9piU7OIZgbNQRUeLTFPtAJ6PVL_SI6tR_zh6Tm2M8,3686
49
49
  gitlab/v4/objects/group_access_tokens.py,sha256=EijY0sfsp0Gtx_q4JLBeLL3jphx5b_6-nTzKxV272jc,1023
50
50
  gitlab/v4/objects/groups.py,sha256=YxOeaRYUjhu8PicCicVT7Eua04YuyOLAc8J13V7r9Gg,15958
51
- gitlab/v4/objects/hooks.py,sha256=1uDYi09GOmgR6t7gVT06CeMGL0ZZ1N5swz1KMtsybDk,3598
51
+ gitlab/v4/objects/hooks.py,sha256=ig8qyC6ZWpZXqcGYCSS7LVvTpD1xnLkNNtfJAOXeYv8,4445
52
52
  gitlab/v4/objects/integrations.py,sha256=QWl5ZnE1oivt4ho9qJa_o268ORdaW35D4klBRy1jUyQ,9229
53
53
  gitlab/v4/objects/invitations.py,sha256=ya9x7xhL1oSbx-FLJud-lHKmbYQoTplZlAbjsZip2CI,2734
54
54
  gitlab/v4/objects/issues.py,sha256=kxciXrLGxCsevJ2eoxpDdMLnw1kF4VrQTy4YB4AoN1U,10393
@@ -84,7 +84,7 @@ gitlab/v4/objects/secure_files.py,sha256=KC5jGC79Qd_IeHx1EhjobMZrJPPIA-4jUYZny_o
84
84
  gitlab/v4/objects/service_accounts.py,sha256=MPy-xk2ObEwohscBK7jcsVUYjhEM48c8_7jK6wB0PYM,517
85
85
  gitlab/v4/objects/settings.py,sha256=LTkdyhhU2MTA15EJw2lZeqDKfK_Bg65CV1CchPljrqY,4295
86
86
  gitlab/v4/objects/sidekiq.py,sha256=kIMgglIBJkbA_io9MXwkCEUs8mZPte6sFQYoWH1TXI4,2996
87
- gitlab/v4/objects/snippets.py,sha256=uOWD275Ck8wc9lWiKdryzJeYZaGCCnVtWRhzmQ6OL5g,6048
87
+ gitlab/v4/objects/snippets.py,sha256=Tq_-9thqcFWN0AqfYOROxwbXfKqlY0zLqbVcp7nww3w,8176
88
88
  gitlab/v4/objects/statistics.py,sha256=NPN8WpCwFJeWeLcn5zahwAgzpJl-Q6bJyoi5ff8XCRQ,2638
89
89
  gitlab/v4/objects/tags.py,sha256=LCvSzI44a1NlrUVi5A_2eOwFSOJjVBSkWe71QdXH_68,1453
90
90
  gitlab/v4/objects/templates.py,sha256=DWbb46-SiusrbW7OuMfBJLrH0rqpRV0G6gzFLbaLpOc,1726
@@ -94,10 +94,10 @@ gitlab/v4/objects/triggers.py,sha256=UAERq_C-QdPBbBQPHLh5IfhpkdDeIxdnVGPHfu9Qy5Y
94
94
  gitlab/v4/objects/users.py,sha256=_gGrTwcE17jeoXIPgfFSv54jtF1_9C1R0Y0hhssTvXY,21381
95
95
  gitlab/v4/objects/variables.py,sha256=S0Vz32jEpUbo4J2js8gMPPTVpcy1ge5FYVHLiPz9c-A,2627
96
96
  gitlab/v4/objects/wikis.py,sha256=JtI1cQqZV1_PRfKVlQRMh4LZjdxEfi9T2VuFYv6PrV8,1775
97
- python_gitlab-4.8.0.dist-info/AUTHORS,sha256=Z0P61GJSVnp7iFbRcMezhx3f4zMyPkVmG--TWaRo768,526
98
- python_gitlab-4.8.0.dist-info/COPYING,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
99
- python_gitlab-4.8.0.dist-info/METADATA,sha256=xyrDULh_rYlzaBL20eATjkp8ZugRAm0v772cwmShWFs,8228
100
- python_gitlab-4.8.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
101
- python_gitlab-4.8.0.dist-info/entry_points.txt,sha256=nhpKLLP_uQPFByn8UtE9zsvQQwa402t52o_Cw9IFXMo,43
102
- python_gitlab-4.8.0.dist-info/top_level.txt,sha256=MvIaP8p_Oaf4gO_hXmHkX-5y2deHLp1pe6tJR3ukQ6o,7
103
- python_gitlab-4.8.0.dist-info/RECORD,,
97
+ python_gitlab-4.10.0.dist-info/AUTHORS,sha256=Z0P61GJSVnp7iFbRcMezhx3f4zMyPkVmG--TWaRo768,526
98
+ python_gitlab-4.10.0.dist-info/COPYING,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
99
+ python_gitlab-4.10.0.dist-info/METADATA,sha256=11-PatLY4p9_VyEBKOAU4MWJcYVPn3YjnifSnxeLZlg,8229
100
+ python_gitlab-4.10.0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
101
+ python_gitlab-4.10.0.dist-info/entry_points.txt,sha256=nhpKLLP_uQPFByn8UtE9zsvQQwa402t52o_Cw9IFXMo,43
102
+ python_gitlab-4.10.0.dist-info/top_level.txt,sha256=MvIaP8p_Oaf4gO_hXmHkX-5y2deHLp1pe6tJR3ukQ6o,7
103
+ python_gitlab-4.10.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5