|
1 | 1 | from typing import Any, cast, Union |
2 | 2 |
|
3 | 3 | from gitlab.base import RESTManager, RESTObject |
4 | | -from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin |
| 4 | +from gitlab.mixins import ( |
| 5 | + CRUDMixin, |
| 6 | + DeleteMixin, |
| 7 | + GetWithoutIdMixin, |
| 8 | + ListMixin, |
| 9 | + ObjectDeleteMixin, |
| 10 | + RefreshMixin, |
| 11 | + SaveMixin, |
| 12 | + UpdateMethod, |
| 13 | + UpdateMixin, |
| 14 | +) |
5 | 15 | from gitlab.types import RequiredOptional |
6 | 16 |
|
7 | 17 | __all__ = [ |
8 | 18 | "PagesDomain", |
9 | 19 | "PagesDomainManager", |
10 | 20 | "ProjectPagesDomain", |
11 | 21 | "ProjectPagesDomainManager", |
| 22 | + "ProjectPages", |
| 23 | + "ProjectPagesManager", |
12 | 24 | ] |
13 | 25 |
|
14 | 26 |
|
@@ -38,3 +50,20 @@ def get( |
38 | 50 | self, id: Union[str, int], lazy: bool = False, **kwargs: Any |
39 | 51 | ) -> ProjectPagesDomain: |
40 | 52 | return cast(ProjectPagesDomain, super().get(id=id, lazy=lazy, **kwargs)) |
| 53 | + |
| 54 | + |
| 55 | +class ProjectPages(ObjectDeleteMixin, RefreshMixin, RESTObject): |
| 56 | + _id_attr = None |
| 57 | + |
| 58 | + |
| 59 | +class ProjectPagesManager(DeleteMixin, UpdateMixin, GetWithoutIdMixin, RESTManager): |
| 60 | + _path = "/projects/{project_id}/pages" |
| 61 | + _obj_cls = ProjectPages |
| 62 | + _from_parent_attrs = {"project_id": "id"} |
| 63 | + _update_attrs = RequiredOptional( |
| 64 | + optional=("pages_unique_domain_enabled", "pages_https_only") |
| 65 | + ) |
| 66 | + _update_method: UpdateMethod = UpdateMethod.PATCH |
| 67 | + |
| 68 | + def get(self, **kwargs: Any) -> ProjectPages: |
| 69 | + return cast(ProjectPages, super().get(**kwargs)) |
0 commit comments