generated from fastai/nbdev_template
/
index.html
492 lines (380 loc) · 24.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
---
title: ghapi
keywords: fastai
sidebar: home_sidebar
summary: "A delightful and complete interface to GitHub's amazing API"
description: "A delightful and complete interface to GitHub's amazing API"
nb_path: "index.ipynb"
---
<!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: index.ipynb
# command to build the docs after a change: nbdev_build_docs
-->
<div class="container" id="notebook-container">
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><a href="/cli.html#ghapi"><code>ghapi</code></a> provides 100% always-updated coverage of the entire <a href="https://docs.github.com/en/free-pro-team@latest/rest">GitHub API</a>. Because we automatically convert the <a href="https://docs.github.com/en/free-pro-team@latest/rest/overview/openapi-description">OpenAPI spec</a> to a Pythonic API, <a href="/cli.html#ghapi"><code>ghapi</code></a> is always up to date with the latest changes to GitHub APIs. Furthermore, because this is all done dynamically, the entire package is only 35kB in size!</p>
<p>Using <a href="/cli.html#ghapi"><code>ghapi</code></a>, you can automate nearly anything that you can do through the GitHub web interface or through the <code>git</code> client, such as:</p>
<ul>
<li>Open, list, comment on, or modify <a href="https://guides.github.com/features/issues/">issues</a> or <a href="https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests">pull requests</a></li>
<li>Create, list, or modify <a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging">git tags</a> or <a href="https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository">GitHub releases</a>, including uploading release assets</li>
<li>Configure and run GitHub <a href="https://github.com/features/actions">Actions</a> and <a href="https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/about-webhooks">webhooks</a></li>
<li>Set up GitHub <a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/users">users</a> and <a href="https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-organizations-and-teams/about-organizations">organizations</a></li>
<li>Manage your <a href="https://docs.github.com/en/free-pro-team@latest/rest/guides/delivering-deployments">deployments</a></li>
<li>...and much, much more.</li>
</ul>
<p>There are two ways to use <a href="/cli.html#ghapi"><code>ghapi</code></a>: either through Python, or from the command line. An overview of each is provided below.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Installation">Installation<a class="anchor-link" href="#Installation"> </a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To install, run either <code>pip install ghapi</code> or <code>conda install -c fastai ghapi</code>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="How-to-use---Python">How to use - Python<a class="anchor-link" href="#How-to-use---Python"> </a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Throughout this documentation, you will see code inputs and outputs shown in this format:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="mi">1</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_text output_subarea output_execute_result">
<pre>2</pre>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>We recommend reading the documentation on the <a href="https://ghapi.fast.ai/">official site</a>, rather than on GitHub, since not all the functionality described on this page is available through the GitHub viewer.</p>
<p>All of the documentation is available directly as Jupyter Notebooks, for instance the current page you're reading is available as a notebook <a href="https://github.com/fastai/ghapi/blob/master/index.ipynb">here</a>. To open any page as an interactive notebook in Google Colab, click the <em>Colab</em> badge at the top of the page.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To access the GitHub API, first create a <a href="/core.html#GhApi"><code>GhApi</code></a> object:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">ghapi.all</span> <span class="kn">import</span> <span class="n">GhApi</span>
<span class="n">api</span> <span class="o">=</span> <span class="n">GhApi</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Every part of the API includes documentation directly in the <code>api</code> object itself. For instance, here's how to explore the groups of functionality provided by the API by displaying the object:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea output_execute_result">
<ul>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/actions">actions</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/activity">activity</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/apps">apps</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/billing">billing</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/checks">checks</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning">code_scanning</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/codes-of-conduct">codes_of_conduct</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/emojis">emojis</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin">enterprise_admin</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/gists">gists</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/git">git</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore">gitignore</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions">interactions</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/issues">issues</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses">licenses</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/markdown">markdown</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/meta">meta</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations">migrations</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth-authorizations">oauth_authorizations</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs">orgs</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/projects">projects</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls">pulls</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/rate-limit">rate_limit</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions">reactions</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/repos">repos</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/scim">scim</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/search">search</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/secret-scanning">secret_scanning</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/teams">teams</a></li>
<li><a href="https://docs.github.com/en/free-pro-team@latest/rest/reference/users">users</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Then we can explore the endpoints provided by the API in each group, e.g. for the <code>git</code> group:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span><span class="o">.</span><span class="n">git</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea output_execute_result">
<ul>
<li><a href="https://docs.github.com/rest/reference/git#create-a-blob">git.create_blob</a>(owner, repo, content, encoding): <em>Create a blob</em></li>
<li><a href="https://docs.github.com/rest/reference/git#get-a-blob">git.get_blob</a>(owner, repo, file_sha): <em>Get a blob</em></li>
<li><a href="https://docs.github.com/rest/reference/git#create-a-commit">git.create_commit</a>(owner, repo, message, tree, parents, author, committer, signature): <em>Create a commit</em></li>
<li><a href="https://docs.github.com/rest/reference/git#get-a-commit">git.get_commit</a>(owner, repo, commit_sha): <em>Get a commit</em></li>
<li><a href="https://docs.github.com/rest/reference/git#list-matching-references">git.list_matching_refs</a>(owner, repo, ref, per_page, page): <em>List matching references</em></li>
<li><a href="https://docs.github.com/rest/reference/git#get-a-reference">git.get_ref</a>(owner, repo, ref): <em>Get a reference</em></li>
<li><a href="https://docs.github.com/rest/reference/git#create-a-reference">git.create_ref</a>(owner, repo, ref, sha, key): <em>Create a reference</em></li>
<li><a href="https://docs.github.com/rest/reference/git#update-a-reference">git.update_ref</a>(owner, repo, ref, sha, force): <em>Update a reference</em></li>
<li><a href="https://docs.github.com/rest/reference/git#delete-a-reference">git.delete_ref</a>(owner, repo, ref): <em>Delete a reference</em></li>
<li><a href="https://docs.github.com/rest/reference/git#create-a-tag-object">git.create_tag</a>(owner, repo, tag, message, object, type, tagger): <em>Create a tag object</em></li>
<li><a href="https://docs.github.com/rest/reference/git#get-a-tag">git.get_tag</a>(owner, repo, tag_sha): <em>Get a tag</em></li>
<li><a href="https://docs.github.com/rest/reference/git#create-a-tree">git.create_tree</a>(owner, repo, tree, base_tree): <em>Create a tree</em></li>
<li><a href="https://docs.github.com/rest/reference/git#get-a-tree">git.get_tree</a>(owner, repo, tree_sha, recursive): <em>Get a tree</em></li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Here's how to learn about an endpoint you want to use, e.g.:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span><span class="o">.</span><span class="n">git</span><span class="o">.</span><span class="n">get_ref</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea output_execute_result">
<p><a href="https://docs.github.com/rest/reference/git#get-a-reference">git.get_ref</a>(owner, repo, ref): <em>Get a reference</em></p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>In Jupyter Notebook full tab completion, parameter lists, etc are provided for all endpoints. Endpoints are called as standard Python methods:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span><span class="o">.</span><span class="n">git</span><span class="o">.</span><span class="n">get_ref</span><span class="p">(</span><span class="n">owner</span><span class="o">=</span><span class="s1">'fastai'</span><span class="p">,</span> <span class="n">repo</span><span class="o">=</span><span class="s1">'fastcore'</span><span class="p">,</span> <span class="n">ref</span><span class="o">=</span><span class="s1">'heads/master'</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea output_execute_result">
<ul>
<li>ref: refs/heads/master</li>
<li>node_id: MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy</li>
<li>url: <a href="https://api.github.com/repos/fastai/fastcore/git/refs/heads/master">https://api.github.com/repos/fastai/fastcore/git/refs/heads/master</a></li>
<li>object: <ul>
<li>sha: 0e3084ed009baa51db38a640ae7c23d638af2756</li>
<li>type: commit</li>
<li>url: <a href="https://api.github.com/repos/fastai/fastcore/git/commits/0e3084ed009baa51db38a640ae7c23d638af2756">https://api.github.com/repos/fastai/fastcore/git/commits/0e3084ed009baa51db38a640ae7c23d638af2756</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To use <a href="/cli.html#ghapi"><code>ghapi</code></a> to access authenticated operations (other than when running through GitHub Actions), you will need a GitHub <a href="https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token">personal access token</a>, which is a secret code used to access your account. If you don't have one, <a href="https://github.com/settings/tokens/new">click here</a> to create one. You'll be asked to enter a name -- choose anything you like, for instance "<em>ghapi</em>". 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 "<em>repo</em>" "<em>gist</em>", "<em>notifications</em>", and "<em>workflow</em>". 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.</p>
<p>Rather than pasting that token into every script, it's easiest to save it as an environment variable. If you save it as <code>$GITHUB_TOKEN</code> then it will be most convenient, so add this to the end of your <code>.bashrc</code> or <code>.zshrc</code> file:</p>
<pre><code>export GITHUB_TOKEN=xxx
</code></pre>
<p>...replacing the <code>xxx</code> with the token you just copied. (Don't forget to <code>source</code> that file after you change it.), pass a [GitHub token].</p>
<p>As well as your <code>token</code>, you can also pass any parameters you want auto-inserted into relevant methods, such as <code>owner</code> and <code>repo</code>:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span> <span class="o">=</span> <span class="n">GhApi</span><span class="p">(</span><span class="n">owner</span><span class="o">=</span><span class="s1">'fastai'</span><span class="p">,</span> <span class="n">repo</span><span class="o">=</span><span class="s1">'fastcore'</span><span class="p">,</span> <span class="n">token</span><span class="o">=</span><span class="n">github_token</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>We can now repeat the previous method, but only need to pass <code>ref</code>:</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span><span class="o">.</span><span class="n">git</span><span class="o">.</span><span class="n">get_ref</span><span class="p">(</span><span class="s1">'heads/master'</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea output_execute_result">
<ul>
<li>ref: refs/heads/master</li>
<li>node_id: MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy</li>
<li>url: <a href="https://api.github.com/repos/fastai/fastcore/git/refs/heads/master">https://api.github.com/repos/fastai/fastcore/git/refs/heads/master</a></li>
<li>object: <ul>
<li>sha: 0e3084ed009baa51db38a640ae7c23d638af2756</li>
<li>type: commit</li>
<li>url: <a href="https://api.github.com/repos/fastai/fastcore/git/commits/0e3084ed009baa51db38a640ae7c23d638af2756">https://api.github.com/repos/fastai/fastcore/git/commits/0e3084ed009baa51db38a640ae7c23d638af2756</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Now that we've provided our token, we can use authenticated endpoints such as creating an issue:</p>
<div class="highlight"><pre><span></span><span class="n">issue</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">issues</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="s2">"Remember to check out GhApi!"</span><span class="p">)</span>
</pre></div>
<p>Since we've now checked out GhApi, let's close this issue. 😎</p>
<div class="highlight"><pre><span></span><span class="n">api</span><span class="o">.</span><span class="n">issues</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">issue</span><span class="o">.</span><span class="n">number</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="s1">'closed'</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="How-to-use---command-line">How to use - command line<a class="anchor-link" href="#How-to-use---command-line"> </a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>You can use <a href="/core.html#GhApi"><code>GhApi</code></a> via the command line, and can access nearly everything in the <a href="https://docs.github.com/en/free-pro-team@latest/rest">GitHub API</a>. We provide an overview here of one of the command line programs, <a href="/cli.html#ghapi"><code>ghapi</code></a> -- see the full CLI docs page for details on all the programs available.</p>
<p>We strongly recommend enabling tab completion for <a href="/cli.html#ghapi"><code>ghapi</code></a>, which you can do by placing the following command at the end of your <code>~/.bashrc</code> or <code>~/.zshrc</code> file:</p>
<div class="highlight"><pre><span></span><span class="nb">eval</span> <span class="s2">"</span><span class="k">$(</span>completion-ghapi --install<span class="k">)</span><span class="s2">"</span>
</pre></div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To get started with the <a href="/cli.html#ghapi"><code>ghapi</code></a> command, first find the name of the operation you wish to perform, for instance by searching the <a href="https://ghapi.fast.ai/fullapi.html">full API reference</a>.</p>
<p>To use <a href="/cli.html#ghapi"><code>ghapi</code></a>, 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 "<code>--</code>" before each parameter name.</p>
<p>For instance, <a href="https://ghapi.fast.ai/fullapi.html#git">git.get_ref</a> takes three parameters: <code>owner</code>, <code>repo</code>, and <code>ref</code>. If we wish to pass the first two as positional parameters, and the last as a named argument, then we'd call:</p>
<div class="highlight"><pre><span></span>ghapi git.get_ref fastai ghapi-test --ref heads/master
</pre></div>
<p>If you have enabled tab completion, then after you've typed <code>ghapi g</code> try pressing <kbd>Tab</kbd>, and you'll see all the operation groups available in the GitHub API that start with <code>g</code>. If you keep typing, e.g. <code>ghapi git.</code>, and hit <kbd>Tab</kbd> again, you'll now see all the operations available in the <code>git</code> group, i.e:</p>
<pre><code>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</code></pre>
<p>If you pass just <code>--help</code> after the operation name, you'll see a full list of all parameters accepted, and a link to the official GitHub documentation.</p>
<div class="highlight"><pre><span></span>ghapi --help
> >> git.get_ref<span class="o">(</span>owner, repo, ref<span class="o">)</span>
>>> https://docs.github.com/rest/reference/git#get-a-reference
</pre></div>
<p>In addition to <code>--help</code> and the GitHub operation parameters, you can also pass the following:</p>
<ul>
<li><code>--headers</code>: A list of extra headers to pass, JSON-encoded</li>
<li><code>--token</code>: A GitHub authentation token</li>
<li><code>--debug</code>: Print requests before sending them</li>
</ul>
</div>
</div>
</div>
</div>