Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated ( #3286 )
2021-03-30 16:51:00 +02:00
Mislav Marohnić
4e24f36495
Declare --jq, --template, --silent options mutually exclusive
2021-03-04 17:29:59 +01:00
Mislav Marohnić
d89756c94c
Add test for api --jq
2021-03-04 17:10:48 +01:00
Mislav Marohnić
06eeea0737
Change the api --filter flag to api --jq
2021-03-04 17:05:31 +01:00
Mislav Marohnić
eb08774370
Assert that executeTemplate is invoked
2021-03-04 16:48:06 +01:00
Mislav Marohnić
0f27084f57
Add flag parsing test for api --template
2021-03-04 15:01:59 +01:00
Mislav Marohnić
07cb5e9e17
Merge remote-tracking branch 'origin' into api-template
2021-03-04 14:53:08 +01:00
Mislav Marohnić
440b59f8c3
Add the api --preview flag to opt into GitHub API previews
...
This was previously available manually via the `-H` flag, but it was
verbose, especially when opting into multiple previews.
2021-03-03 20:12:51 +01:00
Mislav Marohnić
bf97c6e273
Add template functions, documentation, tests
2021-03-02 20:07:04 +01:00
Mislav Marohnić
e32e6406a7
Add test for api --cache behavior
2021-03-01 16:04:19 +01:00
wilso199
3ecb9de1a7
Adding a hostname flag option for use with gh api
2020-10-21 16:31:20 +00:00
Francisco Miamoto
bba2d6d204
improve test cases
2020-08-12 09:09:37 -03:00
Francisco Miamoto
b83342856b
use factory method for branch
...
Also, improve the handling for the branch placeholder
2020-08-12 09:01:17 -03:00
Francisco Miamoto
9ebcec9aaf
handle a detached head
2020-08-12 08:52:39 -03:00
Francisco Miamoto
0c10f67cd5
add branch placeholder for api calls
2020-08-12 08:52:39 -03:00
Martín Montes
27765f9987
Generalize REST error parsing
2020-08-07 14:22:20 +02:00
AliabbasMerchant
7a04bf1672
api --silent Changes:
...
Show Response Headers (if requested) even with `--silent` flag
Shift silent tests to `Test_apiRun`
Changed usage string of `--silent` flag
2020-06-30 19:18:28 +05:30
AliabbasMerchant
aa43c55f60
Skip printing headers when --silent in api
2020-06-29 07:13:06 +05:30
AliabbasMerchant
5e56e31384
Added Test for --silent flag in api
2020-06-29 00:30:24 +05:30
Mislav Marohnić
c945fb4336
Automatically add per_page=100 to paginated REST requests
...
Most endpoints respect this parameter by default. Those that don't will
just ignore it. The `per_page=100` parameter is not added if there is
already a `per_page` parameter specified in the request.
2020-06-23 18:42:57 +02:00
Mislav Marohnić
f4ecd365a6
api command: add GraphQL support for --paginate
2020-06-17 18:02:20 +02:00
Mislav Marohnić
3f940c98f1
Add assertion for 1st api request before pagination
2020-06-16 18:19:39 +02:00
Mislav Marohnić
7907def880
api command: add support for REST pagination
2020-06-16 18:16:49 +02:00
Mislav Marohnić
3f6d0bff45
Switch to :owner/:repo syntax for placeholders
2020-06-11 21:46:27 +02:00
Mislav Marohnić
acf0046718
api command: support {owner} and {repo} placeholders
...
When `{owner}` and `{repo}` strings are found in request path (for REST
requests) or `query` (for GraphQL), they are replaced with values from
the repository of the current working directory.
2020-06-11 15:00:29 +02:00
Mislav Marohnić
74a39f3ed1
Turns out we do need explicit Content-Length for file uploads
...
This reverts commit 141388fd23 .
2020-06-10 18:18:49 +02:00
Nate Smith
bd7e6bf00c
Merge branch 'trunk' into api-raw-body
2020-06-10 11:00:59 -05:00
Nate Smith
096bf6bb79
Merge pull request #1115 from cli/api-errors
...
Print HTTP errors on stderr in `api` command
2020-06-10 10:35:04 -05:00
Mislav Marohnić
141388fd23
Turns out, Go will automatically set Content-Length
2020-06-10 16:29:50 +02:00
Mislav Marohnić
b329919b19
api command: support raw body passed in via --input <file>
...
This is to support file uploads or to pass in JSON bodies constructed
elsewhere.
2020-06-10 15:53:06 +02:00
Mislav Marohnić
4165793fae
Extract printing response headers, include status line
2020-06-08 15:39:35 +02:00
Mislav Marohnić
d57b5171cf
Print HTTP errors on stderr in api command
...
Most API errors are present in the response body itself, which will be
sent to stdout normally, but if stdout is redirected somewhere (as it's
common with scripts), failed HTTP requests will likely sabotage the rest
of the script, but no useful info will be shown on stderr.
This makes it so all REST and GraphQL errors are always shown on stderr.
Additionally, this makes sure that the command exits with a nonzero
status on any GraphQL errors.
2020-06-05 18:24:24 +02:00
Mislav Marohnić
ea3a55c3d6
Ensure that cobra command tests don't write to system stdout/stderr
2020-05-20 16:28:35 +02:00
Mislav Marohnić
292b428465
Add test for showing response headers
2020-05-20 16:28:27 +02:00
Mislav Marohnić
bef62faaea
Make NewCmdApi testable
2020-05-20 15:21:35 +02:00
Mislav Marohnić
f58e0bf710
Add api tests
2020-05-20 15:21:32 +02:00