ghapi 2.0.0__tar.gz → 2.0.2__tar.gz
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.
- {ghapi-2.0.0/ghapi.egg-info → ghapi-2.0.2}/PKG-INFO +56 -162
- {ghapi-2.0.0 → ghapi-2.0.2}/README.md +52 -159
- ghapi-2.0.2/ghapi/__init__.py +1 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/_modidx.py +5 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/actions.py +7 -10
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/auth.py +4 -6
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/core.py +72 -21
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/event.py +5 -6
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/gh_spec.py +43 -6
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/graphql.py +1 -4
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/page.py +18 -1
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/skill.py +47 -5
- {ghapi-2.0.0 → ghapi-2.0.2/ghapi.egg-info}/PKG-INFO +56 -162
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi.egg-info/requires.txt +3 -2
- {ghapi-2.0.0 → ghapi-2.0.2}/pyproject.toml +2 -2
- ghapi-2.0.0/ghapi/__init__.py +0 -1
- {ghapi-2.0.0 → ghapi-2.0.2}/CONTRIBUTING.md +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/LICENSE +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/MANIFEST.in +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/all.py +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/build_lib.py +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/cli.py +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/py.typed +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi/templates.py +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi.egg-info/SOURCES.txt +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi.egg-info/dependency_links.txt +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi.egg-info/entry_points.txt +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/ghapi.egg-info/top_level.txt +0 -0
- {ghapi-2.0.0 → ghapi-2.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ghapi
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A python client for the GitHub API
|
|
5
5
|
Author-email: Jeremy Howard <info@fast.ai>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,14 +15,15 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: fastcore>=1.14.
|
|
18
|
+
Requires-Dist: fastcore>=1.14.5
|
|
19
19
|
Requires-Dist: fastspec>=0.1.0
|
|
20
20
|
Provides-Extra: dev
|
|
21
21
|
Requires-Dist: fastgit; extra == "dev"
|
|
22
22
|
Requires-Dist: matplotlib; extra == "dev"
|
|
23
23
|
Requires-Dist: nbclassic; extra == "dev"
|
|
24
24
|
Requires-Dist: nbdev; extra == "dev"
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: pyyaml; extra == "dev"
|
|
26
|
+
Requires-Dist: pysym2md>=0.0.6; extra == "dev"
|
|
26
27
|
Requires-Dist: llms-txt>=0.0.6; extra == "dev"
|
|
27
28
|
Dynamic: license-file
|
|
28
29
|
|
|
@@ -31,49 +32,20 @@ Dynamic: license-file
|
|
|
31
32
|
|
|
32
33
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
33
34
|
|
|
34
|
-
> **ghapi v2 (July 2026) is now async by default.** Every API call is
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
|
|
45
|
-
API](https://docs.github.com/rest). Because we automatically convert the
|
|
46
|
-
[OpenAPI
|
|
47
|
-
spec](https://docs.github.com/rest/overview/openapi-description) to a
|
|
48
|
-
Pythonic API, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) is always
|
|
49
|
-
up to date with the latest changes to GitHub APIs. Furthermore, because
|
|
50
|
-
this is all built dynamically from a compact pre-parsed copy of the
|
|
51
|
-
spec, the package stays small and is always up to date.
|
|
52
|
-
|
|
53
|
-
Using [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), you can automate
|
|
54
|
-
nearly anything that you can do through the GitHub web interface or
|
|
55
|
-
through the `git` client, such as:
|
|
56
|
-
|
|
57
|
-
- Open, list, comment on, or modify
|
|
58
|
-
[issues](https://guides.github.com/features/issues/) or [pull
|
|
59
|
-
requests](https://docs.github.com/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
|
|
60
|
-
- Create, list, or modify [git
|
|
61
|
-
tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) or [GitHub
|
|
62
|
-
releases](https://docs.github.com/github/administering-a-repository/managing-releases-in-a-repository),
|
|
63
|
-
including uploading release assets
|
|
64
|
-
- Configure and run GitHub
|
|
65
|
-
[Actions](https://github.com/features/actions) and
|
|
66
|
-
[webhooks](https://docs.github.com/developers/webhooks-and-events/about-webhooks)
|
|
67
|
-
- Set up GitHub [users](https://docs.github.com/rest/reference/users)
|
|
68
|
-
and
|
|
69
|
-
[organizations](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/about-organizations)
|
|
70
|
-
- Manage your
|
|
71
|
-
[deployments](https://docs.github.com/rest/guides/delivering-deployments)
|
|
35
|
+
> **ghapi v2 (July 2026) is now async by default.** Every API call is now awaited: `res = await api.repos.get()`. Top-level `await` works directly in Jupyter and modern REPLs; in scripts, use [`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run). For sync code (which should be largely compatible with v1), use `GhApi(sync=True)`. See the [Sync usage](https://ghapi.fast.ai/core.html#sync-usage) section of the docs for details. To stay on the old version, pin `ghapi<2`.
|
|
36
|
+
|
|
37
|
+
[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) provides 100% always-updated coverage of the entire [GitHub API](https://docs.github.com/rest). Because we automatically convert the [OpenAPI spec](https://docs.github.com/rest/overview/openapi-description) to a Pythonic API, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) is always up to date with the latest changes to GitHub APIs. Furthermore, because this is all built dynamically from a compact pre-parsed copy of the spec, the package stays small and is always up to date.
|
|
38
|
+
|
|
39
|
+
Using [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), you can automate nearly anything that you can do through the GitHub web interface or through the `git` client, such as:
|
|
40
|
+
|
|
41
|
+
- Open, list, comment on, or modify [issues](https://guides.github.com/features/issues/) or [pull requests](https://docs.github.com/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
|
|
42
|
+
- Create, list, or modify [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) or [GitHub releases](https://docs.github.com/github/administering-a-repository/managing-releases-in-a-repository), including uploading release assets
|
|
43
|
+
- Configure and run GitHub [Actions](https://github.com/features/actions) and [webhooks](https://docs.github.com/developers/webhooks-and-events/about-webhooks)
|
|
44
|
+
- Set up GitHub [users](https://docs.github.com/rest/reference/users) and [organizations](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/about-organizations)
|
|
45
|
+
- Manage your [deployments](https://docs.github.com/rest/guides/delivering-deployments)
|
|
72
46
|
- …and much, much more.
|
|
73
47
|
|
|
74
|
-
There are two ways to use
|
|
75
|
-
[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi): either through Python,
|
|
76
|
-
or from the command line. An overview of each is provided below.
|
|
48
|
+
There are two ways to use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi): either through Python, or from the command line. An overview of each is provided below.
|
|
77
49
|
|
|
78
50
|
## Installation
|
|
79
51
|
|
|
@@ -81,8 +53,7 @@ To install, run `pip install ghapi`.
|
|
|
81
53
|
|
|
82
54
|
## How to use - Python
|
|
83
55
|
|
|
84
|
-
Throughout this documentation, you will see code inputs and outputs
|
|
85
|
-
shown in this format:
|
|
56
|
+
Throughout this documentation, you will see code inputs and outputs shown in this format:
|
|
86
57
|
|
|
87
58
|
``` python
|
|
88
59
|
1+1
|
|
@@ -90,33 +61,18 @@ shown in this format:
|
|
|
90
61
|
|
|
91
62
|
2
|
|
92
63
|
|
|
93
|
-
We recommend reading the documentation on the [official
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
All of the documentation is available directly as Jupyter Notebooks, for
|
|
99
|
-
instance the current page you’re reading is available as a notebook
|
|
100
|
-
[here](https://github.com/AnswerDotAI/ghapi/blob/main/nbs/index.ipynb).
|
|
101
|
-
To open any page as an interactive notebook in Google Colab, click the
|
|
102
|
-
*Colab* badge at the top of the page.
|
|
103
|
-
|
|
104
|
-
To access the GitHub API, first create a
|
|
105
|
-
[`GhApi`](https://ghapi.fast.ai/core.html#ghapi) object. Note that as of
|
|
106
|
-
v2, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) is async: every
|
|
107
|
-
endpoint call is `await`ed. In Jupyter and modern Python REPLs top-level
|
|
108
|
-
`await` just works, as shown below; in scripts, wrap your code in a
|
|
109
|
-
function run with
|
|
110
|
-
[`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run).
|
|
64
|
+
We recommend reading the documentation on the [official site](https://ghapi.fast.ai/), rather than on GitHub, since not all the functionality described on this page is available through the GitHub viewer.
|
|
65
|
+
|
|
66
|
+
All of the documentation is available directly as Jupyter Notebooks, for instance the current page you’re reading is available as a notebook [here](https://github.com/AnswerDotAI/ghapi/blob/main/nbs/index.ipynb). To open any page as an interactive notebook in Google Colab, click the *Colab* badge at the top of the page.
|
|
67
|
+
|
|
68
|
+
To access the GitHub API, first create a [`GhApi`](https://ghapi.fast.ai/core.html#ghapi) object. Note that as of v2, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) is async: every endpoint call is `await`ed. In Jupyter and modern Python REPLs top-level `await` just works, as shown below; in scripts, wrap your code in a function run with [`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run).
|
|
111
69
|
|
|
112
70
|
``` python
|
|
113
71
|
from ghapi.all import GhApi
|
|
114
72
|
api = GhApi()
|
|
115
73
|
```
|
|
116
74
|
|
|
117
|
-
Every part of the API includes documentation directly in the `api`
|
|
118
|
-
object itself. For instance, here’s how to explore the groups of
|
|
119
|
-
functionality provided by the API by displaying the object:
|
|
75
|
+
Every part of the API includes documentation directly in the `api` object itself. For instance, here’s how to explore the groups of functionality provided by the API by displaying the object:
|
|
120
76
|
|
|
121
77
|
``` python
|
|
122
78
|
api
|
|
@@ -175,8 +131,7 @@ api
|
|
|
175
131
|
|
|
176
132
|
</div>
|
|
177
133
|
|
|
178
|
-
Then we can explore the endpoints provided by the API in each group,
|
|
179
|
-
e.g. for the `git` group:
|
|
134
|
+
Then we can explore the endpoints provided by the API in each group, e.g. for the `git` group:
|
|
180
135
|
|
|
181
136
|
``` python
|
|
182
137
|
api.git
|
|
@@ -184,33 +139,19 @@ api.git
|
|
|
184
139
|
|
|
185
140
|
<div class="prose" markdown="1">
|
|
186
141
|
|
|
187
|
-
- [git.create_blob](https://docs.github.com/rest/git/blobs#create-a-blob)(owner,
|
|
188
|
-
|
|
189
|
-
- [git.
|
|
190
|
-
|
|
191
|
-
- [git.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
- [git.
|
|
195
|
-
|
|
196
|
-
- [git.
|
|
197
|
-
|
|
198
|
-
- [git.
|
|
199
|
-
|
|
200
|
-
- [git.create_ref](https://docs.github.com/rest/git/refs#create-a-reference)(owner,
|
|
201
|
-
repo, ref, sha): *Create a reference*
|
|
202
|
-
- [git.update_ref](https://docs.github.com/rest/git/refs#update-a-reference)(owner,
|
|
203
|
-
repo, ref, sha, force): *Update a reference*
|
|
204
|
-
- [git.delete_ref](https://docs.github.com/rest/git/refs#delete-a-reference)(owner,
|
|
205
|
-
repo, ref): *Delete a reference*
|
|
206
|
-
- [git.create_tag](https://docs.github.com/rest/git/tags#create-a-tag-object)(owner,
|
|
207
|
-
repo, tag, message, object, type, tagger): *Create a tag object*
|
|
208
|
-
- [git.get_tag](https://docs.github.com/rest/git/tags#get-a-tag)(owner,
|
|
209
|
-
repo, tag_sha): *Get a tag*
|
|
210
|
-
- [git.create_tree](https://docs.github.com/rest/git/trees#create-a-tree)(owner,
|
|
211
|
-
repo, tree, base_tree): *Create a tree*
|
|
212
|
-
- [git.get_tree](https://docs.github.com/rest/git/trees#get-a-tree)(owner,
|
|
213
|
-
repo, tree_sha, recursive): *Get a tree*
|
|
142
|
+
- [git.create_blob](https://docs.github.com/rest/git/blobs#create-a-blob)(owner, repo, content, encoding): *Create a blob*
|
|
143
|
+
- [git.get_blob](https://docs.github.com/rest/git/blobs#get-a-blob)(owner, repo, file_sha): *Get a blob*
|
|
144
|
+
- [git.create_commit](https://docs.github.com/rest/git/commits#create-a-commit)(owner, repo, message, tree, parents, author, committer, signature): *Create a commit*
|
|
145
|
+
- [git.get_commit](https://docs.github.com/rest/git/commits#get-a-commit-object)(owner, repo, commit_sha): *Get a commit object*
|
|
146
|
+
- [git.list_matching_refs](https://docs.github.com/rest/git/refs#list-matching-references)(owner, repo, ref): *List matching references*
|
|
147
|
+
- [git.get_ref](https://docs.github.com/rest/git/refs#get-a-reference)(owner, repo, ref): *Get a reference*
|
|
148
|
+
- [git.create_ref](https://docs.github.com/rest/git/refs#create-a-reference)(owner, repo, ref, sha): *Create a reference*
|
|
149
|
+
- [git.update_ref](https://docs.github.com/rest/git/refs#update-a-reference)(owner, repo, ref, sha, force): *Update a reference*
|
|
150
|
+
- [git.delete_ref](https://docs.github.com/rest/git/refs#delete-a-reference)(owner, repo, ref): *Delete a reference*
|
|
151
|
+
- [git.create_tag](https://docs.github.com/rest/git/tags#create-a-tag-object)(owner, repo, tag, message, object, type, tagger): *Create a tag object*
|
|
152
|
+
- [git.get_tag](https://docs.github.com/rest/git/tags#get-a-tag)(owner, repo, tag_sha): *Get a tag*
|
|
153
|
+
- [git.create_tree](https://docs.github.com/rest/git/trees#create-a-tree)(owner, repo, tree, base_tree): *Create a tree*
|
|
154
|
+
- [git.get_tree](https://docs.github.com/rest/git/trees#get-a-tree)(owner, repo, tree_sha, recursive): *Get a tree*
|
|
214
155
|
|
|
215
156
|
</div>
|
|
216
157
|
|
|
@@ -226,19 +167,14 @@ Get a reference
|
|
|
226
167
|
|
|
227
168
|
Docs: https://docs.github.com/rest/git/refs#get-a-reference
|
|
228
169
|
|
|
229
|
-
Parameters:
|
|
230
|
-
repository. The name is not case sensitive.
|
|
231
|
-
name of the repository without the `.git` extension. The name is not
|
|
232
|
-
|
|
233
|
-
information, see “[Git
|
|
234
|
-
References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)”
|
|
235
|
-
in the Git documentation.
|
|
170
|
+
Parameters:
|
|
171
|
+
- owner (str, required): The account owner of the repository. The name is not case sensitive.
|
|
172
|
+
- repo (str, required): The name of the repository without the `.git` extension. The name is not case sensitive.
|
|
173
|
+
- ref (str, required): The Git reference. For more information, see “[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)” in the Git documentation.
|
|
236
174
|
|
|
237
175
|
</div>
|
|
238
176
|
|
|
239
|
-
In Jupyter Notebook full tab completion, parameter lists, etc are
|
|
240
|
-
provided for all endpoints. Endpoints are called as standard Python
|
|
241
|
-
methods:
|
|
177
|
+
In Jupyter Notebook full tab completion, parameter lists, etc are provided for all endpoints. Endpoints are called as standard Python methods:
|
|
242
178
|
|
|
243
179
|
``` python
|
|
244
180
|
await api.git.get_ref(owner='fastai', repo='fastcore', ref='heads/master')
|
|
@@ -257,32 +193,15 @@ await api.git.get_ref(owner='fastai', repo='fastcore', ref='heads/master')
|
|
|
257
193
|
|
|
258
194
|
</div>
|
|
259
195
|
|
|
260
|
-
To use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) to access
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
token](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token),
|
|
264
|
-
which is a secret code used to access your account. If you don’t have
|
|
265
|
-
one, [click here](https://github.com/settings/tokens/new) to create one.
|
|
266
|
-
You’ll be asked to enter a name – choose anything you like, for instance
|
|
267
|
-
“*ghapi*”. You’ll also be asked to choose “scopes”; this limits what
|
|
268
|
-
you’ll be able to do with the API using this token. If you’re not sure,
|
|
269
|
-
click “*repo*” “*gist*”, “*notifications*”, and “*workflow*”. Then click
|
|
270
|
-
“Generate Token” at the bottom of the screen, and copy the token (the
|
|
271
|
-
long string of letters and numbers shown). You can easily do that by
|
|
272
|
-
clicking the little clipboard icon next to the token.
|
|
273
|
-
|
|
274
|
-
Rather than pasting that token into every script, it’s easiest to save
|
|
275
|
-
it as an environment variable. If you save it as `$GITHUB_TOKEN` then it
|
|
276
|
-
will be most convenient, so add this to the end of your `.bashrc` or
|
|
277
|
-
`.zshrc` file:
|
|
196
|
+
To use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) to access authenticated operations (other than when running through GitHub Actions), you will need a GitHub [personal access token](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token), which is a secret code used to access your account. If you don’t have one, [click here](https://github.com/settings/tokens/new) to create one. You’ll be asked to enter a name – choose anything you like, for instance “*ghapi*”. You’ll also be asked to choose “scopes”; this limits what you’ll be able to do with the API using this token. If you’re not sure, click “*repo*” “*gist*”, “*notifications*”, and “*workflow*”. Then click “Generate Token” at the bottom of the screen, and copy the token (the long string of letters and numbers shown). You can easily do that by clicking the little clipboard icon next to the token.
|
|
197
|
+
|
|
198
|
+
Rather than pasting that token into every script, it’s easiest to save it as an environment variable. If you save it as `$GITHUB_TOKEN` then it will be most convenient, so add this to the end of your `.bashrc` or `.zshrc` file:
|
|
278
199
|
|
|
279
200
|
export GITHUB_TOKEN=xxx
|
|
280
201
|
|
|
281
|
-
…replacing the `xxx` with the token you just copied. (Don’t forget to
|
|
282
|
-
`source` that file after you change it.), pass a \[GitHub token\].
|
|
202
|
+
…replacing the `xxx` with the token you just copied. (Don’t forget to `source` that file after you change it.), pass a \[GitHub token\].
|
|
283
203
|
|
|
284
|
-
As well as your `token`, you can also pass any parameters you want
|
|
285
|
-
auto-inserted into relevant methods, such as `owner` and `repo`:
|
|
204
|
+
As well as your `token`, you can also pass any parameters you want auto-inserted into relevant methods, such as `owner` and `repo`:
|
|
286
205
|
|
|
287
206
|
``` python
|
|
288
207
|
api = GhApi(owner='fastai', repo='fastcore', token=github_token)
|
|
@@ -307,8 +226,7 @@ await api.git.get_ref('heads/master')
|
|
|
307
226
|
|
|
308
227
|
</div>
|
|
309
228
|
|
|
310
|
-
Now that we’ve provided our token, we can use authenticated endpoints
|
|
311
|
-
such as creating an issue:
|
|
229
|
+
Now that we’ve provided our token, we can use authenticated endpoints such as creating an issue:
|
|
312
230
|
|
|
313
231
|
``` python
|
|
314
232
|
issue = await api.issues.create("Remember to check out GhApi!")
|
|
@@ -322,52 +240,29 @@ await api.issues.update(issue.number, state='closed')
|
|
|
322
240
|
|
|
323
241
|
## How to use - command line
|
|
324
242
|
|
|
325
|
-
You can use [`GhApi`](https://ghapi.fast.ai/core.html#ghapi) via the
|
|
326
|
-
command line, and can access nearly everything in the [GitHub
|
|
327
|
-
API](https://docs.github.com/rest). We provide an overview here of one
|
|
328
|
-
of the command line programs,
|
|
329
|
-
[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) – see the full CLI docs
|
|
330
|
-
page for details on all the programs available.
|
|
243
|
+
You can use [`GhApi`](https://ghapi.fast.ai/core.html#ghapi) via the command line, and can access nearly everything in the [GitHub API](https://docs.github.com/rest). We provide an overview here of one of the command line programs, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) – see the full CLI docs page for details on all the programs available.
|
|
331
244
|
|
|
332
|
-
We strongly recommend enabling tab completion for
|
|
333
|
-
[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), which you can do by
|
|
334
|
-
placing the following command at the end of your `~/.bashrc` or
|
|
335
|
-
`~/.zshrc` file:
|
|
245
|
+
We strongly recommend enabling tab completion for [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), which you can do by placing the following command at the end of your `~/.bashrc` or `~/.zshrc` file:
|
|
336
246
|
|
|
337
247
|
``` bash
|
|
338
248
|
eval "$(completion-ghapi --install)"
|
|
339
249
|
```
|
|
340
250
|
|
|
341
|
-
To get started with the [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi)
|
|
342
|
-
command, first find the name of the operation you wish to perform, for
|
|
343
|
-
instance by searching the [full API
|
|
344
|
-
reference](https://ghapi.fast.ai/fullapi.html).
|
|
251
|
+
To get started with the [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) command, first find the name of the operation you wish to perform, for instance by searching the [full API reference](https://ghapi.fast.ai/fullapi.html).
|
|
345
252
|
|
|
346
|
-
To use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), pass the method
|
|
347
|
-
name (exactly the same as you’d use in the Python API) as the first
|
|
348
|
-
parameter, followed by any positional parameters required, and then
|
|
349
|
-
keyword arguments with “`--`” before each parameter name.
|
|
253
|
+
To use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), pass the method name (exactly the same as you’d use in the Python API) as the first parameter, followed by any positional parameters required, and then keyword arguments with “`--`” before each parameter name.
|
|
350
254
|
|
|
351
|
-
For instance, [git.get_ref](https://ghapi.fast.ai/fullapi.html#git)
|
|
352
|
-
takes three parameters: `owner`, `repo`, and `ref`. If we wish to pass
|
|
353
|
-
the first two as positional parameters, and the last as a named
|
|
354
|
-
argument, then we’d call:
|
|
255
|
+
For instance, [git.get_ref](https://ghapi.fast.ai/fullapi.html#git) takes three parameters: `owner`, `repo`, and `ref`. If we wish to pass the first two as positional parameters, and the last as a named argument, then we’d call:
|
|
355
256
|
|
|
356
257
|
``` bash
|
|
357
258
|
ghapi git.get_ref fastai ghapi-test --ref heads/master
|
|
358
259
|
```
|
|
359
260
|
|
|
360
|
-
If you have enabled tab completion, then after you’ve typed `ghapi g`
|
|
361
|
-
try pressing <kbd>Tab</kbd>, and you’ll see all the operation groups
|
|
362
|
-
available in the GitHub API that start with `g`. If you keep typing,
|
|
363
|
-
e.g. `ghapi git.`, and hit <kbd>Tab</kbd> again, you’ll now see all the
|
|
364
|
-
operations available in the `git` group, i.e:
|
|
261
|
+
If you have enabled tab completion, then after you’ve typed `ghapi g` try pressing <kbd>Tab</kbd>, and you’ll see all the operation groups available in the GitHub API that start with `g`. If you keep typing, e.g. `ghapi git.`, and hit <kbd>Tab</kbd> again, you’ll now see all the operations available in the `git` group, i.e:
|
|
365
262
|
|
|
366
263
|
git.create_blob git.create_commit git.create_ref git.create_tag git.create_tree git.delete_ref git.get_blob git.get_commit git.get_ref git.get_tag git.get_tree git.list_matching_refs git.name git.update_ref git.verbs
|
|
367
264
|
|
|
368
|
-
If you pass just `--help` after the operation name, you’ll see a full
|
|
369
|
-
list of all parameters accepted, and a link to the official GitHub
|
|
370
|
-
documentation.
|
|
265
|
+
If you pass just `--help` after the operation name, you’ll see a full list of all parameters accepted, and a link to the official GitHub documentation.
|
|
371
266
|
|
|
372
267
|
``` bash
|
|
373
268
|
ghapi git.get_ref --help
|
|
@@ -375,8 +270,7 @@ ghapi git.get_ref --help
|
|
|
375
270
|
>>> https://docs.github.com/rest/reference/git#get-a-reference
|
|
376
271
|
```
|
|
377
272
|
|
|
378
|
-
In addition to `--help` and the GitHub operation parameters, you can
|
|
379
|
-
also pass the following:
|
|
273
|
+
In addition to `--help` and the GitHub operation parameters, you can also pass the following:
|
|
380
274
|
|
|
381
275
|
- `--headers`: A list of extra headers to pass, JSON-encoded
|
|
382
276
|
- `--token`: A GitHub authentation token
|