You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/api.go
+4-2
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ var body string
21
21
varprettyPrintbool
22
22
varautoPaginateint=0
23
23
varportint
24
+
varverbosebool
24
25
25
26
vargenerateCountint
26
27
@@ -89,6 +90,7 @@ func init() {
89
90
90
91
apiCmd.PersistentFlags().StringArrayVarP(&queryParameters, "query-params", "q", nil, "Available multiple times. Passes in query parameters to endpoints using the format of `key=value`.")
91
92
apiCmd.PersistentFlags().StringVarP(&body, "body", "b", "", "Passes a body to the request. Alteratively supports CURL-like references to files using the format of `@data,json`.")
93
+
apiCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Whether to display HTTP request and header information above the response of the API call.")
92
94
93
95
// default here is false to enable -p commands to toggle off without explicitly defining -p=false as -p false will not work. The below commands invert the bool to pass the true default. Deprecated, so marking as hidden in favor of the unformatted flag.
94
96
apiCmd.PersistentFlags().BoolVarP(&prettyPrint, "pretty-print", "p", false, "Whether to pretty-print API requests. Default is true.")
Copy file name to clipboardExpand all lines: docs/api.md
+1
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ Allows the user to make GET calls to endpoints on Helix. Requires a logged in to
37
37
|`--query-param`|`-q`| Query parameters for the endpoint in `key=value` format. Multiple can be entered to give multiple parameters. |`get -q login=ninja`| N |
38
38
|`--unformatted`|`-u`| Whether to return unformatted responses. Default is `false`. |`get -u`| N |
39
39
|`--autopaginate`|`-P`| Whether to autopaginate the response from Twitch, and optionally the number of pages to limit. **WARNING** This flag can cause extremely large payloads and cause issues with some terminals. Default is to not autopaginate, however if provided, the default is gets all responses. |`get -P=10`| N |
40
+
|`--verbose`|`-v`| Whether to display HTTP request and header information above the response of the API call. |`get -v`| N |
Copy file name to clipboardExpand all lines: internal/api/api.go
+54-1
Original file line number
Diff line number
Diff line change
@@ -30,11 +30,18 @@ type clientInformation struct {
30
30
}
31
31
32
32
// NewRequest is used to request data from the Twitch API using a HTTP GET request- this function is a wrapper for the apiRequest function that handles the network call
33
-
funcNewRequest(methodstring, pathstring, queryParameters []string, body []byte, prettyPrintbool, autopaginate*int) error {
0 commit comments