|
3 | 3 | https://docs.gitlab.com/ee/api/job_artifacts.html |
4 | 4 | """ |
5 | 5 |
|
6 | | -from typing import Any, Callable, Iterator, Optional, TYPE_CHECKING, Union |
| 6 | +from typing import ( |
| 7 | + Any, |
| 8 | + Callable, |
| 9 | + Iterator, |
| 10 | + Literal, |
| 11 | + Optional, |
| 12 | + overload, |
| 13 | + TYPE_CHECKING, |
| 14 | + Union, |
| 15 | +) |
7 | 16 |
|
8 | 17 | import requests |
9 | 18 |
|
@@ -43,6 +52,45 @@ def delete(self, **kwargs: Any) -> None: |
43 | 52 | assert path is not None |
44 | 53 | self.gitlab.http_delete(path, **kwargs) |
45 | 54 |
|
| 55 | + @overload |
| 56 | + def download( |
| 57 | + self, |
| 58 | + ref_name: str, |
| 59 | + job: str, |
| 60 | + streamed: Literal[False] = False, |
| 61 | + action: None = None, |
| 62 | + chunk_size: int = 1024, |
| 63 | + *, |
| 64 | + iterator: Literal[False] = False, |
| 65 | + **kwargs: Any, |
| 66 | + ) -> bytes: ... |
| 67 | + |
| 68 | + @overload |
| 69 | + def download( |
| 70 | + self, |
| 71 | + ref_name: str, |
| 72 | + job: str, |
| 73 | + streamed: bool = False, |
| 74 | + action: None = None, |
| 75 | + chunk_size: int = 1024, |
| 76 | + *, |
| 77 | + iterator: Literal[True] = True, |
| 78 | + **kwargs: Any, |
| 79 | + ) -> Iterator[Any]: ... |
| 80 | + |
| 81 | + @overload |
| 82 | + def download( |
| 83 | + self, |
| 84 | + ref_name: str, |
| 85 | + job: str, |
| 86 | + streamed: Literal[True] = True, |
| 87 | + action: Optional[Callable[[bytes], None]] = None, |
| 88 | + chunk_size: int = 1024, |
| 89 | + *, |
| 90 | + iterator: Literal[False] = False, |
| 91 | + **kwargs: Any, |
| 92 | + ) -> None: ... |
| 93 | + |
46 | 94 | @cli.register_custom_action( |
47 | 95 | cls_names="ProjectArtifactManager", |
48 | 96 | required=("ref_name", "job"), |
@@ -94,6 +142,48 @@ def download( |
94 | 142 | result, streamed, action, chunk_size, iterator=iterator |
95 | 143 | ) |
96 | 144 |
|
| 145 | + @overload |
| 146 | + def raw( |
| 147 | + self, |
| 148 | + ref_name: str, |
| 149 | + artifact_path: str, |
| 150 | + job: str, |
| 151 | + streamed: Literal[False] = False, |
| 152 | + action: None = None, |
| 153 | + chunk_size: int = 1024, |
| 154 | + *, |
| 155 | + iterator: Literal[False] = False, |
| 156 | + **kwargs: Any, |
| 157 | + ) -> bytes: ... |
| 158 | + |
| 159 | + @overload |
| 160 | + def raw( |
| 161 | + self, |
| 162 | + ref_name: str, |
| 163 | + artifact_path: str, |
| 164 | + job: str, |
| 165 | + streamed: bool = False, |
| 166 | + action: None = None, |
| 167 | + chunk_size: int = 1024, |
| 168 | + *, |
| 169 | + iterator: Literal[True] = True, |
| 170 | + **kwargs: Any, |
| 171 | + ) -> Iterator[Any]: ... |
| 172 | + |
| 173 | + @overload |
| 174 | + def raw( |
| 175 | + self, |
| 176 | + ref_name: str, |
| 177 | + artifact_path: str, |
| 178 | + job: str, |
| 179 | + streamed: Literal[True] = True, |
| 180 | + action: Optional[Callable[[bytes], None]] = None, |
| 181 | + chunk_size: int = 1024, |
| 182 | + *, |
| 183 | + iterator: Literal[False] = False, |
| 184 | + **kwargs: Any, |
| 185 | + ) -> None: ... |
| 186 | + |
97 | 187 | @cli.register_custom_action( |
98 | 188 | cls_names="ProjectArtifactManager", |
99 | 189 | required=("ref_name", "artifact_path", "job"), |
|
0 commit comments