git0 0.2.5 → 0.2.7
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.
- package/bun.lock +159 -0
- package/docs/404.html +2 -3
- package/docs/Footer/index.html +2 -3
- package/docs/assets/js/1df93b7f.d8c05d2c.js +2 -0
- package/docs/assets/js/22dd74f7.237398b4.js +1 -0
- package/docs/assets/js/28ab763d.5714aa16.js +1 -0
- package/docs/assets/js/299d276b.1a1baa1c.js +1 -0
- package/docs/assets/js/68cef36b.c312447e.js +1 -0
- package/docs/assets/js/c3a618e1.965a31da.js +1 -0
- package/docs/assets/js/{main.c71c09a5.js → main.cf858a7d.js} +2 -2
- package/docs/assets/js/runtime~main.7520dc36.js +1 -0
- package/docs/functions/git0/index.html +48 -0
- package/docs/functions/github-api/index.html +149 -0
- package/docs/functions/index.html +4 -5
- package/docs/functions/modules/index.html +30 -0
- package/docs/index.html +3 -4
- package/docs/lunr-index-1749613752315.json +1 -0
- package/docs/lunr-index.json +1 -1
- package/docs/search-doc-1749613752315.json +1 -0
- package/docs/search-doc.json +1 -1
- package/docs/sitemap.xml +1 -1
- package/docs-config/.docusaurus/DONT-EDIT-THIS-FOLDER +5 -0
- package/docs-config/.docusaurus/client-manifest.json +259 -0
- package/docs-config/.docusaurus/client-modules.js +8 -0
- package/docs-config/.docusaurus/codeTranslations.json +1 -0
- package/docs-config/.docusaurus/docusaurus-lunr-search/default/__plugin.json +4 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/__mdx-loader-dependency.json +1 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/__plugin.json +4 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/p/docs-175.json +1 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/p/index-466.json +1 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-git-0-1-md-d3e.json +19 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-git-0-md-299.json +19 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-github-api-md-28a.json +23 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-globals-md-4a8.json +19 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-index-md-c3a.json +23 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-functions-modules-md-68c.json +19 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-docs/default/site-src-index-md-d14.json +21 -0
- package/docs-config/.docusaurus/docusaurus-plugin-content-pages/default/__plugin.json +4 -0
- package/docs-config/.docusaurus/docusaurus-plugin-google-gtag/default/__plugin.json +4 -0
- package/docs-config/.docusaurus/docusaurus.config.mjs +378 -0
- package/docs-config/.docusaurus/globalData.json +65 -0
- package/docs-config/.docusaurus/i18n.json +17 -0
- package/docs-config/.docusaurus/lunr.client.js +5 -0
- package/docs-config/.docusaurus/registry.js +15 -0
- package/docs-config/.docusaurus/routes.js +61 -0
- package/docs-config/.docusaurus/routesChunkNames.json +45 -0
- package/docs-config/.docusaurus/site-metadata.json +51 -0
- package/docs-config/.docusaurus/site-storage.json +4 -0
- package/docs-config/bun.lock +6139 -0
- package/docs-config/config/customize-docs.js +4 -2
- package/docs-config/docusaurus.config.ts +0 -9
- package/docs-config/src/functions/git0.md +101 -0
- package/docs-config/src/functions/github-api.md +744 -0
- package/docs-config/src/functions/modules.md +4 -0
- package/docs-config/src/functions/typedoc-sidebar.cjs +12 -1
- package/docs-config/src/pages/index.tsx +289 -279
- package/docs-config/tsconfig.json +1 -1
- package/package.json +10 -7
- package/src/git0.js +380 -0
- package/src/github-api.js +473 -0
- package/docs/assets/js/1df93b7f.dfdf0ef3.js +0 -2
- package/docs/assets/js/22dd74f7.5e857962.js +0 -1
- package/docs/assets/js/4a829dc8.728a4445.js +0 -1
- package/docs/assets/js/c3a618e1.50a89e4d.js +0 -1
- package/docs/assets/js/d140250a.62af53aa.js +0 -1
- package/docs/assets/js/runtime~main.ef55418f.js +0 -1
- package/docs/functions/globals/index.html +0 -57
- package/docs/lunr-index-1749601667754.json +0 -1
- package/docs/search-doc-1749601667754.json +0 -1
- package/docs-config/src/functions/globals.md +0 -153
- package/docs-config/src/index.md +0 -127
- package/docs-config/tailwind.config.js +0 -13
- package/git0.js +0 -646
- /package/docs/assets/js/{1df93b7f.dfdf0ef3.js.LICENSE.txt → 1df93b7f.d8c05d2c.js.LICENSE.txt} +0 -0
- /package/docs/assets/js/{main.c71c09a5.js.LICENSE.txt → main.cf858a7d.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
[Documentation](modules.md) / github-api
|
|
2
|
+
|
|
3
|
+
## default
|
|
4
|
+
|
|
5
|
+
Defined in: [src/github-api.js:17](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L17)
|
|
6
|
+
|
|
7
|
+
GitHub API client for downloading repositories, searching, and managing releases
|
|
8
|
+
GithubAPI
|
|
9
|
+
|
|
10
|
+
### Example
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const github = new GithubAPI();
|
|
14
|
+
const repos = await github.searchRepositories('nodejs');
|
|
15
|
+
await github.downloadRepo('user/repo', './my-downloads');
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Constructors
|
|
19
|
+
|
|
20
|
+
#### Constructor
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
new default(options?: object): default;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Defined in: [src/github-api.js:36](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L36)
|
|
27
|
+
|
|
28
|
+
Creates a new GithubAPI instance
|
|
29
|
+
|
|
30
|
+
##### Parameters
|
|
31
|
+
|
|
32
|
+
<table>
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th>Parameter</th>
|
|
36
|
+
<th>Type</th>
|
|
37
|
+
<th>Description</th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>
|
|
43
|
+
|
|
44
|
+
`options?`
|
|
45
|
+
|
|
46
|
+
</td>
|
|
47
|
+
<td>
|
|
48
|
+
|
|
49
|
+
\{ `baseURL?`: `string`; `debug?`: `boolean`; `token?`: `string`; \}
|
|
50
|
+
|
|
51
|
+
</td>
|
|
52
|
+
<td>
|
|
53
|
+
|
|
54
|
+
Configuration options
|
|
55
|
+
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
<tr>
|
|
59
|
+
<td>
|
|
60
|
+
|
|
61
|
+
`options.baseURL?`
|
|
62
|
+
|
|
63
|
+
</td>
|
|
64
|
+
<td>
|
|
65
|
+
|
|
66
|
+
`string`
|
|
67
|
+
|
|
68
|
+
</td>
|
|
69
|
+
<td>
|
|
70
|
+
|
|
71
|
+
GitHub API base URL
|
|
72
|
+
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
<tr>
|
|
76
|
+
<td>
|
|
77
|
+
|
|
78
|
+
`options.debug?`
|
|
79
|
+
|
|
80
|
+
</td>
|
|
81
|
+
<td>
|
|
82
|
+
|
|
83
|
+
`boolean`
|
|
84
|
+
|
|
85
|
+
</td>
|
|
86
|
+
<td>
|
|
87
|
+
|
|
88
|
+
Enable debug logging
|
|
89
|
+
|
|
90
|
+
</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td>
|
|
94
|
+
|
|
95
|
+
`options.token?`
|
|
96
|
+
|
|
97
|
+
</td>
|
|
98
|
+
<td>
|
|
99
|
+
|
|
100
|
+
`string`
|
|
101
|
+
|
|
102
|
+
</td>
|
|
103
|
+
<td>
|
|
104
|
+
|
|
105
|
+
GitHub personal access token (defaults to GITHUB_TOKEN env var)
|
|
106
|
+
|
|
107
|
+
</td>
|
|
108
|
+
</tr>
|
|
109
|
+
</tbody>
|
|
110
|
+
</table>
|
|
111
|
+
|
|
112
|
+
##### Returns
|
|
113
|
+
|
|
114
|
+
[`default`](#default)
|
|
115
|
+
|
|
116
|
+
##### Example
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
// Use default settings with environment token
|
|
120
|
+
|
|
121
|
+
// Use custom token
|
|
122
|
+
const github = new GithubAPI({ token: 'ghp_xxxxxxxxxxxx' });
|
|
123
|
+
|
|
124
|
+
// Enable debug mode
|
|
125
|
+
const github = new GithubAPI({ debug: true });
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Properties
|
|
129
|
+
|
|
130
|
+
#### baseURL
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
baseURL: string;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Defined in: [src/github-api.js:39](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L39)
|
|
137
|
+
|
|
138
|
+
#### client()
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
client: (path: any, options?: object) => Promise<{
|
|
142
|
+
[key: string]: unknown;
|
|
143
|
+
}>;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Defined in: [src/github-api.js:41](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L41)
|
|
147
|
+
|
|
148
|
+
##### Parameters
|
|
149
|
+
|
|
150
|
+
<table>
|
|
151
|
+
<thead>
|
|
152
|
+
<tr>
|
|
153
|
+
<th>Parameter</th>
|
|
154
|
+
<th>Type</th>
|
|
155
|
+
</tr>
|
|
156
|
+
</thead>
|
|
157
|
+
<tbody>
|
|
158
|
+
<tr>
|
|
159
|
+
<td>
|
|
160
|
+
|
|
161
|
+
`path`
|
|
162
|
+
|
|
163
|
+
</td>
|
|
164
|
+
<td>
|
|
165
|
+
|
|
166
|
+
`any`
|
|
167
|
+
|
|
168
|
+
</td>
|
|
169
|
+
</tr>
|
|
170
|
+
<tr>
|
|
171
|
+
<td>
|
|
172
|
+
|
|
173
|
+
`options?`
|
|
174
|
+
|
|
175
|
+
</td>
|
|
176
|
+
<td>
|
|
177
|
+
|
|
178
|
+
\{ \}
|
|
179
|
+
|
|
180
|
+
</td>
|
|
181
|
+
</tr>
|
|
182
|
+
</tbody>
|
|
183
|
+
</table>
|
|
184
|
+
|
|
185
|
+
##### Returns
|
|
186
|
+
|
|
187
|
+
`Promise`<\{
|
|
188
|
+
[`key`: `string`]: `unknown`;
|
|
189
|
+
\}>
|
|
190
|
+
|
|
191
|
+
#### debug
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
debug: boolean;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Defined in: [src/github-api.js:38](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L38)
|
|
198
|
+
|
|
199
|
+
#### token
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
token: string;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Defined in: [src/github-api.js:37](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L37)
|
|
206
|
+
|
|
207
|
+
#### DEFAULT\_RESULTS\_PER\_PAGE
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
static DEFAULT_RESULTS_PER_PAGE: number = 10;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Defined in: [src/github-api.js:19](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L19)
|
|
214
|
+
|
|
215
|
+
##### Constant
|
|
216
|
+
|
|
217
|
+
Number of results to return per page for repository searches
|
|
218
|
+
|
|
219
|
+
### Methods
|
|
220
|
+
|
|
221
|
+
#### downloadPackage()
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
downloadPackage(packageURL: any, downloadPath: string): Promise<string>;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Defined in: [src/github-api.js:188](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L188)
|
|
228
|
+
|
|
229
|
+
Downloads a release asset from GitHub and provides installation instructions
|
|
230
|
+
|
|
231
|
+
##### Parameters
|
|
232
|
+
|
|
233
|
+
<table>
|
|
234
|
+
<thead>
|
|
235
|
+
<tr>
|
|
236
|
+
<th>Parameter</th>
|
|
237
|
+
<th>Type</th>
|
|
238
|
+
<th>Description</th>
|
|
239
|
+
</tr>
|
|
240
|
+
</thead>
|
|
241
|
+
<tbody>
|
|
242
|
+
<tr>
|
|
243
|
+
<td>
|
|
244
|
+
|
|
245
|
+
`packageURL`
|
|
246
|
+
|
|
247
|
+
</td>
|
|
248
|
+
<td>
|
|
249
|
+
|
|
250
|
+
`any`
|
|
251
|
+
|
|
252
|
+
</td>
|
|
253
|
+
<td>
|
|
254
|
+
|
|
255
|
+
Download URL for the asset
|
|
256
|
+
|
|
257
|
+
</td>
|
|
258
|
+
</tr>
|
|
259
|
+
<tr>
|
|
260
|
+
<td>
|
|
261
|
+
|
|
262
|
+
`downloadPath`
|
|
263
|
+
|
|
264
|
+
</td>
|
|
265
|
+
<td>
|
|
266
|
+
|
|
267
|
+
`string`
|
|
268
|
+
|
|
269
|
+
</td>
|
|
270
|
+
<td>
|
|
271
|
+
|
|
272
|
+
Directory to download the asset to
|
|
273
|
+
|
|
274
|
+
</td>
|
|
275
|
+
</tr>
|
|
276
|
+
</tbody>
|
|
277
|
+
</table>
|
|
278
|
+
|
|
279
|
+
##### Returns
|
|
280
|
+
|
|
281
|
+
`Promise`<`string`>
|
|
282
|
+
|
|
283
|
+
Path to the downloaded file
|
|
284
|
+
|
|
285
|
+
##### Throws
|
|
286
|
+
|
|
287
|
+
When download fails
|
|
288
|
+
|
|
289
|
+
##### Example
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
const asset = 'https://github.com/user/repo/releases/download/v1.0.0/myapp-v1.0.0-linux-x64'
|
|
293
|
+
const downloadPath = await github.downloadPackage(asset, './downloads/myapp');
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### downloadRepo()
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
downloadRepo(repo: string, targetDir?: string): Promise<string>;
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Defined in: [src/github-api.js:69](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L69)
|
|
303
|
+
|
|
304
|
+
Downloads a GitHub repository as a tarball and extracts it to a local directory
|
|
305
|
+
|
|
306
|
+
##### Parameters
|
|
307
|
+
|
|
308
|
+
<table>
|
|
309
|
+
<thead>
|
|
310
|
+
<tr>
|
|
311
|
+
<th>Parameter</th>
|
|
312
|
+
<th>Type</th>
|
|
313
|
+
<th>Default value</th>
|
|
314
|
+
<th>Description</th>
|
|
315
|
+
</tr>
|
|
316
|
+
</thead>
|
|
317
|
+
<tbody>
|
|
318
|
+
<tr>
|
|
319
|
+
<td>
|
|
320
|
+
|
|
321
|
+
`repo`
|
|
322
|
+
|
|
323
|
+
</td>
|
|
324
|
+
<td>
|
|
325
|
+
|
|
326
|
+
`string`
|
|
327
|
+
|
|
328
|
+
</td>
|
|
329
|
+
<td>
|
|
330
|
+
|
|
331
|
+
`undefined`
|
|
332
|
+
|
|
333
|
+
</td>
|
|
334
|
+
<td>
|
|
335
|
+
|
|
336
|
+
Repository URL or owner/name format
|
|
337
|
+
|
|
338
|
+
</td>
|
|
339
|
+
</tr>
|
|
340
|
+
<tr>
|
|
341
|
+
<td>
|
|
342
|
+
|
|
343
|
+
`targetDir?`
|
|
344
|
+
|
|
345
|
+
</td>
|
|
346
|
+
<td>
|
|
347
|
+
|
|
348
|
+
`string`
|
|
349
|
+
|
|
350
|
+
</td>
|
|
351
|
+
<td>
|
|
352
|
+
|
|
353
|
+
`null`
|
|
354
|
+
|
|
355
|
+
</td>
|
|
356
|
+
<td>
|
|
357
|
+
|
|
358
|
+
Target directory name (defaults to repo name)
|
|
359
|
+
|
|
360
|
+
</td>
|
|
361
|
+
</tr>
|
|
362
|
+
</tbody>
|
|
363
|
+
</table>
|
|
364
|
+
|
|
365
|
+
##### Returns
|
|
366
|
+
|
|
367
|
+
`Promise`<`string`>
|
|
368
|
+
|
|
369
|
+
Path to the extracted repository directory
|
|
370
|
+
|
|
371
|
+
##### Throws
|
|
372
|
+
|
|
373
|
+
When repository download fails
|
|
374
|
+
|
|
375
|
+
##### Example
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
// Download repository to current directory
|
|
379
|
+
const repoPath = await github.downloadRepo('https://github.com/user/repo');
|
|
380
|
+
|
|
381
|
+
// Download to specific directory
|
|
382
|
+
const repoPath = await github.downloadRepo('user/repo', 'my-custom-dir');
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### getCompatibleReleases()
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
getCompatibleReleases(owner: string, repo: string): Promise<any[]>;
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Defined in: [src/github-api.js:310](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L310)
|
|
392
|
+
|
|
393
|
+
Gets releases compatible with the current platform
|
|
394
|
+
|
|
395
|
+
##### Parameters
|
|
396
|
+
|
|
397
|
+
<table>
|
|
398
|
+
<thead>
|
|
399
|
+
<tr>
|
|
400
|
+
<th>Parameter</th>
|
|
401
|
+
<th>Type</th>
|
|
402
|
+
<th>Description</th>
|
|
403
|
+
</tr>
|
|
404
|
+
</thead>
|
|
405
|
+
<tbody>
|
|
406
|
+
<tr>
|
|
407
|
+
<td>
|
|
408
|
+
|
|
409
|
+
`owner`
|
|
410
|
+
|
|
411
|
+
</td>
|
|
412
|
+
<td>
|
|
413
|
+
|
|
414
|
+
`string`
|
|
415
|
+
|
|
416
|
+
</td>
|
|
417
|
+
<td>
|
|
418
|
+
|
|
419
|
+
Repository owner
|
|
420
|
+
|
|
421
|
+
</td>
|
|
422
|
+
</tr>
|
|
423
|
+
<tr>
|
|
424
|
+
<td>
|
|
425
|
+
|
|
426
|
+
`repo`
|
|
427
|
+
|
|
428
|
+
</td>
|
|
429
|
+
<td>
|
|
430
|
+
|
|
431
|
+
`string`
|
|
432
|
+
|
|
433
|
+
</td>
|
|
434
|
+
<td>
|
|
435
|
+
|
|
436
|
+
Repository name
|
|
437
|
+
|
|
438
|
+
</td>
|
|
439
|
+
</tr>
|
|
440
|
+
</tbody>
|
|
441
|
+
</table>
|
|
442
|
+
|
|
443
|
+
##### Returns
|
|
444
|
+
|
|
445
|
+
`Promise`<`any`[]>
|
|
446
|
+
|
|
447
|
+
Array of compatible releases
|
|
448
|
+
|
|
449
|
+
##### Example
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
const compatible = await github.getCompatibleReleases('user', 'repo');
|
|
453
|
+
console.log(`Found ${compatible.length} compatible releases`);
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
#### getCurrentPlatform()
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
getCurrentPlatform(): any;
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Defined in: [src/github-api.js:262](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L262)
|
|
463
|
+
|
|
464
|
+
Detects the current operating system and architecture
|
|
465
|
+
|
|
466
|
+
##### Returns
|
|
467
|
+
|
|
468
|
+
`any`
|
|
469
|
+
|
|
470
|
+
Platform information object
|
|
471
|
+
|
|
472
|
+
##### Example
|
|
473
|
+
|
|
474
|
+
```ts
|
|
475
|
+
const platform = github.getCurrentPlatform();
|
|
476
|
+
console.log(`Running on ${platform.os} ${platform.arch}`);
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
#### getReleases()
|
|
480
|
+
|
|
481
|
+
```ts
|
|
482
|
+
getReleases(owner: string, repo: string): Promise<any[]>;
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Defined in: [src/github-api.js:296](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L296)
|
|
486
|
+
|
|
487
|
+
Gets repository releases with platform categorization
|
|
488
|
+
|
|
489
|
+
##### Parameters
|
|
490
|
+
|
|
491
|
+
<table>
|
|
492
|
+
<thead>
|
|
493
|
+
<tr>
|
|
494
|
+
<th>Parameter</th>
|
|
495
|
+
<th>Type</th>
|
|
496
|
+
<th>Description</th>
|
|
497
|
+
</tr>
|
|
498
|
+
</thead>
|
|
499
|
+
<tbody>
|
|
500
|
+
<tr>
|
|
501
|
+
<td>
|
|
502
|
+
|
|
503
|
+
`owner`
|
|
504
|
+
|
|
505
|
+
</td>
|
|
506
|
+
<td>
|
|
507
|
+
|
|
508
|
+
`string`
|
|
509
|
+
|
|
510
|
+
</td>
|
|
511
|
+
<td>
|
|
512
|
+
|
|
513
|
+
Repository owner
|
|
514
|
+
|
|
515
|
+
</td>
|
|
516
|
+
</tr>
|
|
517
|
+
<tr>
|
|
518
|
+
<td>
|
|
519
|
+
|
|
520
|
+
`repo`
|
|
521
|
+
|
|
522
|
+
</td>
|
|
523
|
+
<td>
|
|
524
|
+
|
|
525
|
+
`string`
|
|
526
|
+
|
|
527
|
+
</td>
|
|
528
|
+
<td>
|
|
529
|
+
|
|
530
|
+
Repository name
|
|
531
|
+
|
|
532
|
+
</td>
|
|
533
|
+
</tr>
|
|
534
|
+
</tbody>
|
|
535
|
+
</table>
|
|
536
|
+
|
|
537
|
+
##### Returns
|
|
538
|
+
|
|
539
|
+
`Promise`<`any`[]>
|
|
540
|
+
|
|
541
|
+
Array of categorized releases
|
|
542
|
+
|
|
543
|
+
##### Example
|
|
544
|
+
|
|
545
|
+
```ts
|
|
546
|
+
const releases = await github.getReleases('microsoft', 'vscode');
|
|
547
|
+
console.log(`Found ${releases.length} releases`);
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
#### parseURL()
|
|
551
|
+
|
|
552
|
+
```ts
|
|
553
|
+
parseURL(query: string): any;
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Defined in: [src/github-api.js:241](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L241)
|
|
557
|
+
|
|
558
|
+
Parses a GitHub URL or shorthand repository reference
|
|
559
|
+
|
|
560
|
+
##### Parameters
|
|
561
|
+
|
|
562
|
+
<table>
|
|
563
|
+
<thead>
|
|
564
|
+
<tr>
|
|
565
|
+
<th>Parameter</th>
|
|
566
|
+
<th>Type</th>
|
|
567
|
+
<th>Description</th>
|
|
568
|
+
</tr>
|
|
569
|
+
</thead>
|
|
570
|
+
<tbody>
|
|
571
|
+
<tr>
|
|
572
|
+
<td>
|
|
573
|
+
|
|
574
|
+
`query`
|
|
575
|
+
|
|
576
|
+
</td>
|
|
577
|
+
<td>
|
|
578
|
+
|
|
579
|
+
`string`
|
|
580
|
+
|
|
581
|
+
</td>
|
|
582
|
+
<td>
|
|
583
|
+
|
|
584
|
+
GitHub URL or owner/repo format
|
|
585
|
+
|
|
586
|
+
</td>
|
|
587
|
+
</tr>
|
|
588
|
+
</tbody>
|
|
589
|
+
</table>
|
|
590
|
+
|
|
591
|
+
##### Returns
|
|
592
|
+
|
|
593
|
+
`any`
|
|
594
|
+
|
|
595
|
+
Parsed git URL object or false if invalid
|
|
596
|
+
|
|
597
|
+
##### Example
|
|
598
|
+
|
|
599
|
+
```ts
|
|
600
|
+
// Parse full URL
|
|
601
|
+
const parsed = github.parseURL('https://github.com/user/repo');
|
|
602
|
+
|
|
603
|
+
// Parse shorthand
|
|
604
|
+
const parsed = github.parseURL('user/repo');
|
|
605
|
+
|
|
606
|
+
if (parsed) {
|
|
607
|
+
console.log(`Owner: ${parsed.owner}, Name: ${parsed.name}`);
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
#### searchRepositories()
|
|
612
|
+
|
|
613
|
+
```ts
|
|
614
|
+
searchRepositories(query: string, options?: object): Promise<any[]>;
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Defined in: [src/github-api.js:130](https://github.com/vtempest/git0/blob/a8fc7e45afbaefca0c4e19627a1fa2d11f80f7e6/src/github-api.js#L130)
|
|
618
|
+
|
|
619
|
+
Searches for GitHub repositories by name and enriches results with release information
|
|
620
|
+
|
|
621
|
+
##### Parameters
|
|
622
|
+
|
|
623
|
+
<table>
|
|
624
|
+
<thead>
|
|
625
|
+
<tr>
|
|
626
|
+
<th>Parameter</th>
|
|
627
|
+
<th>Type</th>
|
|
628
|
+
<th>Description</th>
|
|
629
|
+
</tr>
|
|
630
|
+
</thead>
|
|
631
|
+
<tbody>
|
|
632
|
+
<tr>
|
|
633
|
+
<td>
|
|
634
|
+
|
|
635
|
+
`query`
|
|
636
|
+
|
|
637
|
+
</td>
|
|
638
|
+
<td>
|
|
639
|
+
|
|
640
|
+
`string`
|
|
641
|
+
|
|
642
|
+
</td>
|
|
643
|
+
<td>
|
|
644
|
+
|
|
645
|
+
Search query for repository names
|
|
646
|
+
|
|
647
|
+
</td>
|
|
648
|
+
</tr>
|
|
649
|
+
<tr>
|
|
650
|
+
<td>
|
|
651
|
+
|
|
652
|
+
`options?`
|
|
653
|
+
|
|
654
|
+
</td>
|
|
655
|
+
<td>
|
|
656
|
+
|
|
657
|
+
\{ `order?`: `string`; `perPage?`: `number`; `sort?`: `string`; \}
|
|
658
|
+
|
|
659
|
+
</td>
|
|
660
|
+
<td>
|
|
661
|
+
|
|
662
|
+
Search options
|
|
663
|
+
|
|
664
|
+
</td>
|
|
665
|
+
</tr>
|
|
666
|
+
<tr>
|
|
667
|
+
<td>
|
|
668
|
+
|
|
669
|
+
`options.order?`
|
|
670
|
+
|
|
671
|
+
</td>
|
|
672
|
+
<td>
|
|
673
|
+
|
|
674
|
+
`string`
|
|
675
|
+
|
|
676
|
+
</td>
|
|
677
|
+
<td>
|
|
678
|
+
|
|
679
|
+
Sort order (asc, desc)
|
|
680
|
+
|
|
681
|
+
</td>
|
|
682
|
+
</tr>
|
|
683
|
+
<tr>
|
|
684
|
+
<td>
|
|
685
|
+
|
|
686
|
+
`options.perPage?`
|
|
687
|
+
|
|
688
|
+
</td>
|
|
689
|
+
<td>
|
|
690
|
+
|
|
691
|
+
`number`
|
|
692
|
+
|
|
693
|
+
</td>
|
|
694
|
+
<td>
|
|
695
|
+
|
|
696
|
+
Number of results per page (defaults to DEFAULT_RESULTS_PER_PAGE)
|
|
697
|
+
|
|
698
|
+
</td>
|
|
699
|
+
</tr>
|
|
700
|
+
<tr>
|
|
701
|
+
<td>
|
|
702
|
+
|
|
703
|
+
`options.sort?`
|
|
704
|
+
|
|
705
|
+
</td>
|
|
706
|
+
<td>
|
|
707
|
+
|
|
708
|
+
`string`
|
|
709
|
+
|
|
710
|
+
</td>
|
|
711
|
+
<td>
|
|
712
|
+
|
|
713
|
+
Sort field (stars, forks, updated)
|
|
714
|
+
|
|
715
|
+
</td>
|
|
716
|
+
</tr>
|
|
717
|
+
</tbody>
|
|
718
|
+
</table>
|
|
719
|
+
|
|
720
|
+
##### Returns
|
|
721
|
+
|
|
722
|
+
`Promise`<`any`[]>
|
|
723
|
+
|
|
724
|
+
Array of repository objects with release information
|
|
725
|
+
|
|
726
|
+
##### Throws
|
|
727
|
+
|
|
728
|
+
When search fails
|
|
729
|
+
|
|
730
|
+
##### Example
|
|
731
|
+
|
|
732
|
+
```ts
|
|
733
|
+
const repos = await github.searchRepositories('nodejs');
|
|
734
|
+
repos.forEach(repo => {
|
|
735
|
+
console.log(`${repo.name}: ${repo.hasReleases ? 'Has releases' : 'No releases'}`);
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// Custom search options
|
|
739
|
+
const repos = await github.searchRepositories('react', {
|
|
740
|
+
perPage: 5,
|
|
741
|
+
sort: 'updated',
|
|
742
|
+
order: 'desc'
|
|
743
|
+
});
|
|
744
|
+
```
|