|
| 1 | +"""Detailed information on the GhApi API""" |
| 2 | + |
1 | 3 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../00_core.ipynb. |
2 | 4 |
|
3 | 5 | # %% auto 0 |
@@ -250,32 +252,34 @@ def get_content(self:GhApi, path): |
250 | 252 |
|
251 | 253 | # %% ../00_core.ipynb 108 |
252 | 254 | @patch |
253 | | -def create_or_update_file(self:GhApi, path, message=None, content=None, |
254 | | - sha=None, branch=None, committer=None, author=None): |
| 255 | +def create_or_update_file(self:GhApi, path, message, committer, author, content=None, sha=None, branch=''): |
| 256 | + if not branch: branch = api.repos.get()['default_branch'] |
255 | 257 | if not isinstance(content,bytes): content = content.encode() |
256 | 258 | content = base64.b64encode(content).decode() |
257 | 259 | kwargs = {'sha':sha} if sha else {} |
258 | 260 | return self.repos.create_or_update_file_contents(path, message, content=content, |
259 | | - branch=branch, committer=committer, author=author, **kwargs) |
| 261 | + branch=branch, committer=committer or {}, author=author or {}, **kwargs) |
260 | 262 |
|
261 | 263 | # %% ../00_core.ipynb 109 |
262 | 264 | @patch |
263 | | -def create_file(self:GhApi, path, message, content=None, branch=None, committer=None, author=None): |
264 | | - return self.create_or_update_file(path, message, content, branch=branch, committer=committer, author=author) |
| 265 | +def create_file(self:GhApi, path, message, committer, author, content=None, branch=None): |
| 266 | + if not branch: branch = api.repos.get()['default_branch'] |
| 267 | + return self.create_or_update_file(path, message, branch=branch, committer=committer, content=content, author=author) |
265 | 268 |
|
266 | 269 | # %% ../00_core.ipynb 111 |
267 | 270 | @patch |
268 | | -def delete_file(self:GhApi, path, message, sha=None, branch=None, committer=None, author=None): |
| 271 | +def delete_file(self:GhApi, path, message, committer, author, sha=None, branch=None): |
| 272 | + if not branch: branch = api.repos.get()['default_branch'] |
269 | 273 | if sha is None: sha = self.list_files()[path].sha |
270 | 274 | return self.repos.delete_file(path, message=message, sha=sha, |
271 | 275 | branch=branch, committer=committer, author=author) |
272 | 276 |
|
273 | 277 | # %% ../00_core.ipynb 113 |
274 | 278 | @patch |
275 | | -def update_contents(self:GhApi, path, message, content, sha=None, branch=None, committer=None, author=None): |
| 279 | +def update_contents(self:GhApi, path, message, committer, author, content, sha=None, branch=None): |
| 280 | + if not branch: branch = api.repos.get()['default_branch'] |
276 | 281 | if sha is None: sha = self.list_files()[path].sha |
277 | | - return self.create_or_update_file(path, message, content, |
278 | | - sha=sha, branch=branch, committer=committer, author=author) |
| 282 | + return self.create_or_update_file(path, message, committer=committer, author=author, content=content, sha=sha, branch=branch) |
279 | 283 |
|
280 | 284 | # %% ../00_core.ipynb 117 |
281 | 285 | @patch |
|
0 commit comments