@scalar/snippetz 0.2.7 → 0.2.9
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/dist/clients.d.ts +6 -0
- package/dist/clients.d.ts.map +1 -0
- package/dist/clients.js +150 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts +8 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js +62 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts +29 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.js +74 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.js +22 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts +2 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts +7 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.js +18 -0
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts +5 -0
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/httpsnippet.d.ts +10 -0
- package/dist/httpsnippet-lite/esm/httpsnippet.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +45 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +189 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +169 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +49 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts +41 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js +124 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts +22 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.js +77 -0
- package/dist/httpsnippet-lite/esm/targets/http/target.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/http/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +47 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +46 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +73 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts +67 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +47 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +91 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +88 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts +68 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +86 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +73 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +83 -0
- package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts +87 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +58 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +132 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +68 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/curl/client.js +134 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.js +126 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts +3 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +37 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts +75 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts +10 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js +53 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +15 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts +45 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +15 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts +9 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +63 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts +19 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +95 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/python/requests/client.js +177 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts +44 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +127 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts +27 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts +16 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +72 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts +26 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +118 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts +57 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +54 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts +17 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +76 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts +15 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +137 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts +25 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/esm/targets/targets.d.ts +731 -0
- package/dist/httpsnippet-lite/esm/targets/targets.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/libcurl.d.ts +1 -1
- package/dist/plugins/c/libcurl/libcurl.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/libcurl.js +3 -2
- package/dist/plugins/clojure/clj_http/clj_http.d.ts +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js +3 -2
- package/dist/plugins/csharp/httpclient/httpclient.d.ts +1 -1
- package/dist/plugins/csharp/httpclient/httpclient.d.ts.map +1 -1
- package/dist/plugins/csharp/httpclient/httpclient.js +3 -2
- package/dist/plugins/csharp/restsharp/restsharp.d.ts +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js +3 -2
- package/dist/plugins/go/native/native.d.ts +1 -1
- package/dist/plugins/go/native/native.d.ts.map +1 -1
- package/dist/plugins/go/native/native.js +3 -2
- package/dist/plugins/http/http11/http11.d.ts +1 -1
- package/dist/plugins/http/http11/http11.d.ts.map +1 -1
- package/dist/plugins/http/http11/http11.js +3 -2
- package/dist/plugins/java/asynchttp/asynchttp.d.ts +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js +3 -2
- package/dist/plugins/java/nethttp/nethttp.d.ts +1 -1
- package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/nethttp.js +3 -2
- package/dist/plugins/java/okhttp/okhttp.d.ts +1 -1
- package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/okhttp.js +3 -2
- package/dist/plugins/java/unirest/unirest.d.ts +1 -1
- package/dist/plugins/java/unirest/unirest.d.ts.map +1 -1
- package/dist/plugins/java/unirest/unirest.js +3 -2
- package/dist/plugins/js/axios/axios.d.ts +1 -1
- package/dist/plugins/js/axios/axios.d.ts.map +1 -1
- package/dist/plugins/js/axios/axios.js +3 -2
- package/dist/plugins/js/fetch/fetch.d.ts +1 -1
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +3 -2
- package/dist/plugins/js/jquery/jquery.d.ts +1 -1
- package/dist/plugins/js/jquery/jquery.d.ts.map +1 -1
- package/dist/plugins/js/jquery/jquery.js +3 -2
- package/dist/plugins/js/ofetch/ofetch.d.ts +1 -1
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +3 -2
- package/dist/plugins/js/xhr/xhr.d.ts +1 -1
- package/dist/plugins/js/xhr/xhr.d.ts.map +1 -1
- package/dist/plugins/js/xhr/xhr.js +3 -2
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js +3 -2
- package/dist/plugins/node/axios/axios.d.ts +1 -1
- package/dist/plugins/node/axios/axios.d.ts.map +1 -1
- package/dist/plugins/node/axios/axios.js +3 -2
- package/dist/plugins/node/fetch/fetch.d.ts +1 -1
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +3 -2
- package/dist/plugins/node/ofetch/ofetch.d.ts +1 -1
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +3 -2
- package/dist/plugins/node/undici/undici.d.ts +1 -1
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +3 -2
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +3 -2
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js +3 -2
- package/dist/plugins/php/curl/curl.d.ts +1 -1
- package/dist/plugins/php/curl/curl.d.ts.map +1 -1
- package/dist/plugins/php/curl/curl.js +3 -2
- package/dist/plugins/php/guzzle/guzzle.d.ts +1 -1
- package/dist/plugins/php/guzzle/guzzle.d.ts.map +1 -1
- package/dist/plugins/php/guzzle/guzzle.js +3 -2
- package/dist/plugins/powershell/restmethod/restmethod.d.ts +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js +3 -2
- package/dist/plugins/powershell/webrequest/webrequest.d.ts +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js +3 -2
- package/dist/plugins/python/python3/python3.d.ts +1 -1
- package/dist/plugins/python/python3/python3.d.ts.map +1 -1
- package/dist/plugins/python/python3/python3.js +3 -2
- package/dist/plugins/python/requests/requests.d.ts +1 -1
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js +3 -2
- package/dist/plugins/r/httr/httr.d.ts +1 -1
- package/dist/plugins/r/httr/httr.d.ts.map +1 -1
- package/dist/plugins/r/httr/httr.js +3 -2
- package/dist/plugins/ruby/native/native.d.ts +1 -1
- package/dist/plugins/ruby/native/native.d.ts.map +1 -1
- package/dist/plugins/ruby/native/native.js +3 -2
- package/dist/plugins/shell/curl/curl.d.ts +1 -1
- package/dist/plugins/shell/curl/curl.d.ts.map +1 -1
- package/dist/plugins/shell/curl/curl.js +1 -0
- package/dist/plugins/shell/httpie/httpie.d.ts +1 -1
- package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/httpie.js +3 -2
- package/dist/plugins/shell/wget/wget.d.ts +1 -1
- package/dist/plugins/shell/wget/wget.d.ts.map +1 -1
- package/dist/plugins/shell/wget/wget.js +3 -2
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +3 -2
- package/dist/snippetz.d.ts +4 -6
- package/dist/snippetz.d.ts.map +1 -1
- package/dist/snippetz.js +10 -91
- package/dist/{core/types.d.ts → types/index.d.ts} +15 -4
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.test-d.d.ts +2 -0
- package/dist/types/index.test-d.d.ts.map +1 -0
- package/dist/utils/arrayToObject.d.ts.map +1 -0
- package/dist/utils/convertWithHttpSnippetLite.d.ts +6 -0
- package/dist/utils/convertWithHttpSnippetLite.d.ts.map +1 -0
- package/dist/utils/convertWithHttpSnippetLite.js +95 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/needsQuotes.d.ts.map +1 -0
- package/dist/utils/objectToString.d.ts.map +1 -0
- package/package.json +11 -7
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.test-d.d.ts +0 -2
- package/dist/core/types.test-d.d.ts.map +0 -1
- package/dist/core/utils/arrayToObject.d.ts.map +0 -1
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts +0 -7
- package/dist/core/utils/convertWithHttpSnippetLite.d.ts.map +0 -1
- package/dist/core/utils/convertWithHttpSnippetLite.js +0 -83
- package/dist/core/utils/needsQuotes.d.ts.map +0 -1
- package/dist/core/utils/objectToString.d.ts.map +0 -1
- /package/dist/{core/utils → utils}/arrayToObject.d.ts +0 -0
- /package/dist/{core/utils → utils}/arrayToObject.js +0 -0
- /package/dist/{core/utils → utils}/needsQuotes.d.ts +0 -0
- /package/dist/{core/utils → utils}/needsQuotes.js +0 -0
- /package/dist/{core/utils → utils}/objectToString.d.ts +0 -0
- /package/dist/{core/utils → utils}/objectToString.js +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const go: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
extname: string;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
clientsById: {
|
|
9
|
+
native: {
|
|
10
|
+
info: {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
link: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
convert: ({ postData, method, allHeaders, fullUrl }: {
|
|
17
|
+
postData: any;
|
|
18
|
+
method: any;
|
|
19
|
+
allHeaders: any;
|
|
20
|
+
fullUrl: any;
|
|
21
|
+
}, options?: {}) => any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/go/target.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAUd,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request follows the request message format in accordance to RFC 7230, Section 3.
|
|
3
|
+
* Each section is prepended with the RFC and section number.
|
|
4
|
+
* See more at https://tools.ietf.org/html/rfc7230#section-3.
|
|
5
|
+
*/
|
|
6
|
+
export declare const http11: {
|
|
7
|
+
info: {
|
|
8
|
+
key: string;
|
|
9
|
+
title: string;
|
|
10
|
+
link: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }: {
|
|
14
|
+
method: any;
|
|
15
|
+
fullUrl: any;
|
|
16
|
+
uriObj: any;
|
|
17
|
+
httpVersion: any;
|
|
18
|
+
allHeaders: any;
|
|
19
|
+
postData: any;
|
|
20
|
+
}, options: any) => string;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/http/http1.1/client.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CA4DlB,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* HTTP code snippet generator to generate raw HTTP/1.1 request strings,
|
|
8
|
+
* in accordance to the RFC 7230 (and RFC 7231) specifications.
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @irvinlim
|
|
12
|
+
*
|
|
13
|
+
* For any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const CRLF = '\r\n';
|
|
16
|
+
/**
|
|
17
|
+
* Request follows the request message format in accordance to RFC 7230, Section 3.
|
|
18
|
+
* Each section is prepended with the RFC and section number.
|
|
19
|
+
* See more at https://tools.ietf.org/html/rfc7230#section-3.
|
|
20
|
+
*/
|
|
21
|
+
const http11 = {
|
|
22
|
+
info: {
|
|
23
|
+
key: 'http1.1',
|
|
24
|
+
title: 'HTTP/1.1',
|
|
25
|
+
link: 'https://tools.ietf.org/html/rfc7230',
|
|
26
|
+
description: 'HTTP/1.1 request string in accordance with RFC 7230',
|
|
27
|
+
},
|
|
28
|
+
convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }, options) => {
|
|
29
|
+
const opts = {
|
|
30
|
+
absoluteURI: false,
|
|
31
|
+
autoContentLength: true,
|
|
32
|
+
autoHost: true,
|
|
33
|
+
...options,
|
|
34
|
+
};
|
|
35
|
+
// RFC 7230 Section 3. Message Format
|
|
36
|
+
// All lines have no indentation, and should be terminated with CRLF.
|
|
37
|
+
const { blank, push, join } = new CodeBuilder({ indent: '', join: CRLF });
|
|
38
|
+
// RFC 7230 Section 5.3. Request Target
|
|
39
|
+
// Determines if the Request-Line should use 'absolute-form' or 'origin-form'.
|
|
40
|
+
// Basically it means whether the "http://domain.com" will prepend the full url.
|
|
41
|
+
const requestUrl = opts.absoluteURI ? fullUrl : uriObj.path;
|
|
42
|
+
// RFC 7230 Section 3.1.1. Request-Line
|
|
43
|
+
push(`${method} ${requestUrl} ${httpVersion}`);
|
|
44
|
+
const headerKeys = Object.keys(allHeaders);
|
|
45
|
+
// RFC 7231 Section 5. Header Fields
|
|
46
|
+
headerKeys.forEach((key) => {
|
|
47
|
+
// Capitalize header keys, even though it's not required by the spec.
|
|
48
|
+
const keyCapitalized = key
|
|
49
|
+
.toLowerCase()
|
|
50
|
+
.replace(/(^|-)(\w)/g, (input) => input.toUpperCase());
|
|
51
|
+
push(`${keyCapitalized}: ${allHeaders[key]}`);
|
|
52
|
+
});
|
|
53
|
+
// RFC 7230 Section 5.4. Host
|
|
54
|
+
// Automatically set Host header if option is on and on header already exists.
|
|
55
|
+
if (opts.autoHost && !headerKeys.includes('host')) {
|
|
56
|
+
push(`Host: ${uriObj.host}`);
|
|
57
|
+
}
|
|
58
|
+
// RFC 7230 Section 3.3.3. Message Body Length
|
|
59
|
+
// Automatically set Content-Length header if option is on, postData is present and no header already exists.
|
|
60
|
+
if (opts.autoContentLength &&
|
|
61
|
+
(postData === null || postData === void 0 ? void 0 : postData.text) &&
|
|
62
|
+
!headerKeys.includes('content-length')) {
|
|
63
|
+
push(`Content-Length: ${postData.text.length}`);
|
|
64
|
+
}
|
|
65
|
+
// Add extra line after header section.
|
|
66
|
+
blank();
|
|
67
|
+
// Separate header section and message body section.
|
|
68
|
+
const headerSection = join();
|
|
69
|
+
// RFC 7230 Section 3.3. Message Body
|
|
70
|
+
const messageBody = (postData === null || postData === void 0 ? void 0 : postData.text) || '';
|
|
71
|
+
// RFC 7230 Section 3. Message Format
|
|
72
|
+
// Extra CRLF separating the headers from the body.
|
|
73
|
+
return `${headerSection}${CRLF}${messageBody}`;
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { http11 };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const http: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
extname: null;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
clientsById: {
|
|
9
|
+
'http1.1': {
|
|
10
|
+
info: {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
link: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
convert: ({ method, fullUrl, uriObj, httpVersion, allHeaders, postData }: {
|
|
17
|
+
method: any;
|
|
18
|
+
fullUrl: any;
|
|
19
|
+
uriObj: any;
|
|
20
|
+
httpVersion: any;
|
|
21
|
+
allHeaders: any;
|
|
22
|
+
postData: any;
|
|
23
|
+
}, options: any) => string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/http/target.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAUhB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const asynchttp: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ method, allHeaders, postData, fullUrl }: {
|
|
9
|
+
method: any;
|
|
10
|
+
allHeaders: any;
|
|
11
|
+
postData: any;
|
|
12
|
+
fullUrl: any;
|
|
13
|
+
}, options: any) => any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/java/asynchttp/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAiCrB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
import { escapeForDoubleQuotes } from '../../../helpers/escape.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* Asynchronous Http and WebSocket Client library for Java
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @windard
|
|
12
|
+
*
|
|
13
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const asynchttp = {
|
|
16
|
+
info: {
|
|
17
|
+
key: 'asynchttp',
|
|
18
|
+
title: 'AsyncHttp',
|
|
19
|
+
link: 'https://github.com/AsyncHttpClient/async-http-client',
|
|
20
|
+
description: 'Asynchronous Http and WebSocket Client library for Java',
|
|
21
|
+
},
|
|
22
|
+
convert: ({ method, allHeaders, postData, fullUrl }, options) => {
|
|
23
|
+
const opts = {
|
|
24
|
+
indent: ' ',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
const { blank, push, join } = new CodeBuilder({ indent: opts.indent });
|
|
28
|
+
push('AsyncHttpClient client = new DefaultAsyncHttpClient();');
|
|
29
|
+
push(`client.prepare("${method.toUpperCase()}", "${fullUrl}")`);
|
|
30
|
+
// Add headers, including the cookies
|
|
31
|
+
Object.keys(allHeaders).forEach((key) => {
|
|
32
|
+
push(`.setHeader("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`, 1);
|
|
33
|
+
});
|
|
34
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
35
|
+
push(`.setBody(${JSON.stringify(postData.text)})`, 1);
|
|
36
|
+
}
|
|
37
|
+
push('.execute()', 1);
|
|
38
|
+
push('.toCompletableFuture()', 1);
|
|
39
|
+
push('.thenAccept(System.out::println)', 1);
|
|
40
|
+
push('.join();', 1);
|
|
41
|
+
blank();
|
|
42
|
+
push('client.close();');
|
|
43
|
+
return join();
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { asynchttp };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const nethttp: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ allHeaders, fullUrl, method, postData }: {
|
|
9
|
+
allHeaders: any;
|
|
10
|
+
fullUrl: any;
|
|
11
|
+
method: any;
|
|
12
|
+
postData: any;
|
|
13
|
+
}, options: any) => any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/java/nethttp/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAoCnB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
import { escapeForDoubleQuotes } from '../../../helpers/escape.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* HTTP code snippet generator for Java using java.net.http.
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @wtetsu
|
|
12
|
+
*
|
|
13
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const nethttp = {
|
|
16
|
+
info: {
|
|
17
|
+
key: 'nethttp',
|
|
18
|
+
title: 'java.net.http',
|
|
19
|
+
link: 'https://openjdk.java.net/groups/net/httpclient/intro.html',
|
|
20
|
+
description: 'Java Standardized HTTP Client API',
|
|
21
|
+
},
|
|
22
|
+
convert: ({ allHeaders, fullUrl, method, postData }, options) => {
|
|
23
|
+
const opts = {
|
|
24
|
+
indent: ' ',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
const { push, join } = new CodeBuilder({ indent: opts.indent });
|
|
28
|
+
push('HttpRequest request = HttpRequest.newBuilder()');
|
|
29
|
+
push(`.uri(URI.create("${fullUrl}"))`, 2);
|
|
30
|
+
Object.keys(allHeaders).forEach((key) => {
|
|
31
|
+
push(`.header("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`, 2);
|
|
32
|
+
});
|
|
33
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
34
|
+
push(`.method("${method.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(postData.text)}))`, 2);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
push(`.method("${method.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`, 2);
|
|
38
|
+
}
|
|
39
|
+
push('.build();', 2);
|
|
40
|
+
push('HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());');
|
|
41
|
+
push('System.out.println(response.body());');
|
|
42
|
+
return join();
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { nethttp };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const okhttp: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ postData, method, fullUrl, allHeaders }: {
|
|
9
|
+
postData: any;
|
|
10
|
+
method: any;
|
|
11
|
+
fullUrl: any;
|
|
12
|
+
allHeaders: any;
|
|
13
|
+
}, options: any) => any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/java/okhttp/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;;;;;;;;;;;CA0DlB,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
import { escapeForDoubleQuotes } from '../../../helpers/escape.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* HTTP code snippet generator for Java using OkHttp.
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @shashiranjan84
|
|
12
|
+
*
|
|
13
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const okhttp = {
|
|
16
|
+
info: {
|
|
17
|
+
key: 'okhttp',
|
|
18
|
+
title: 'OkHttp',
|
|
19
|
+
link: 'http://square.github.io/okhttp/',
|
|
20
|
+
description: 'An HTTP Request Client Library',
|
|
21
|
+
},
|
|
22
|
+
convert: ({ postData, method, fullUrl, allHeaders }, options) => {
|
|
23
|
+
const opts = {
|
|
24
|
+
indent: ' ',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
const { push, blank, join } = new CodeBuilder({ indent: opts.indent });
|
|
28
|
+
const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
29
|
+
const methodsWithBody = ['POST', 'PUT', 'DELETE', 'PATCH'];
|
|
30
|
+
push('OkHttpClient client = new OkHttpClient();');
|
|
31
|
+
blank();
|
|
32
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
33
|
+
if (postData.boundary) {
|
|
34
|
+
push(`MediaType mediaType = MediaType.parse("${postData.mimeType}; boundary=${postData.boundary}");`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
push(`MediaType mediaType = MediaType.parse("${postData.mimeType}");`);
|
|
38
|
+
}
|
|
39
|
+
push(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(postData.text)});`);
|
|
40
|
+
}
|
|
41
|
+
push('Request request = new Request.Builder()');
|
|
42
|
+
push(`.url("${fullUrl}")`, 1);
|
|
43
|
+
if (!methods.includes(method.toUpperCase())) {
|
|
44
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
45
|
+
push(`.method("${method.toUpperCase()}", body)`, 1);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
push(`.method("${method.toUpperCase()}", null)`, 1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (methodsWithBody.includes(method.toUpperCase())) {
|
|
52
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
53
|
+
push(`.${method.toLowerCase()}(body)`, 1);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
push(`.${method.toLowerCase()}(null)`, 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
push(`.${method.toLowerCase()}()`, 1);
|
|
61
|
+
}
|
|
62
|
+
// Add headers, including the cookies
|
|
63
|
+
Object.keys(allHeaders).forEach((key) => {
|
|
64
|
+
push(`.addHeader("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`, 1);
|
|
65
|
+
});
|
|
66
|
+
push('.build();', 1);
|
|
67
|
+
blank();
|
|
68
|
+
push('Response response = client.newCall(request).execute();');
|
|
69
|
+
return join();
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { okhttp };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const java: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
extname: string;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
clientsById: {
|
|
9
|
+
asynchttp: {
|
|
10
|
+
info: {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
link: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
convert: ({ method, allHeaders, postData, fullUrl }: {
|
|
17
|
+
method: any;
|
|
18
|
+
allHeaders: any;
|
|
19
|
+
postData: any;
|
|
20
|
+
fullUrl: any;
|
|
21
|
+
}, options: any) => any;
|
|
22
|
+
};
|
|
23
|
+
nethttp: {
|
|
24
|
+
info: {
|
|
25
|
+
key: string;
|
|
26
|
+
title: string;
|
|
27
|
+
link: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
convert: ({ allHeaders, fullUrl, method, postData }: {
|
|
31
|
+
allHeaders: any;
|
|
32
|
+
fullUrl: any;
|
|
33
|
+
method: any;
|
|
34
|
+
postData: any;
|
|
35
|
+
}, options: any) => any;
|
|
36
|
+
};
|
|
37
|
+
okhttp: {
|
|
38
|
+
info: {
|
|
39
|
+
key: string;
|
|
40
|
+
title: string;
|
|
41
|
+
link: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
convert: ({ postData, method, fullUrl, allHeaders }: {
|
|
45
|
+
postData: any;
|
|
46
|
+
method: any;
|
|
47
|
+
fullUrl: any;
|
|
48
|
+
allHeaders: any;
|
|
49
|
+
}, options: any) => any;
|
|
50
|
+
};
|
|
51
|
+
unirest: {
|
|
52
|
+
info: {
|
|
53
|
+
key: string;
|
|
54
|
+
title: string;
|
|
55
|
+
link: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
convert: ({ method, allHeaders, postData, fullUrl }: {
|
|
59
|
+
method: any;
|
|
60
|
+
allHeaders: any;
|
|
61
|
+
postData: any;
|
|
62
|
+
fullUrl: any;
|
|
63
|
+
}, options: any) => any;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/java/target.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAahB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const unirest: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ method, allHeaders, postData, fullUrl }: {
|
|
9
|
+
method: any;
|
|
10
|
+
allHeaders: any;
|
|
11
|
+
postData: any;
|
|
12
|
+
fullUrl: any;
|
|
13
|
+
}, options: any) => any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/java/unirest/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAiCnB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
2
|
+
import { escapeForDoubleQuotes } from '../../../helpers/escape.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* HTTP code snippet generator for Java using Unirest.
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @shashiranjan84
|
|
12
|
+
*
|
|
13
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const unirest = {
|
|
16
|
+
info: {
|
|
17
|
+
key: 'unirest',
|
|
18
|
+
title: 'Unirest',
|
|
19
|
+
link: 'http://unirest.io/java.html',
|
|
20
|
+
description: 'Lightweight HTTP Request Client Library',
|
|
21
|
+
},
|
|
22
|
+
convert: ({ method, allHeaders, postData, fullUrl }, options) => {
|
|
23
|
+
const opts = {
|
|
24
|
+
indent: ' ',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
const { join, push } = new CodeBuilder({ indent: opts.indent });
|
|
28
|
+
const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'];
|
|
29
|
+
if (!methods.includes(method.toUpperCase())) {
|
|
30
|
+
push(`HttpResponse<String> response = Unirest.customMethod("${method.toUpperCase()}","${fullUrl}")`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
push(`HttpResponse<String> response = Unirest.${method.toLowerCase()}("${fullUrl}")`);
|
|
34
|
+
}
|
|
35
|
+
// Add headers, including the cookies
|
|
36
|
+
Object.keys(allHeaders).forEach((key) => {
|
|
37
|
+
push(`.header("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`, 1);
|
|
38
|
+
});
|
|
39
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
40
|
+
push(`.body(${JSON.stringify(postData.text)})`, 1);
|
|
41
|
+
}
|
|
42
|
+
push('.asString();', 1);
|
|
43
|
+
return join();
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { unirest };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const axios: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ allHeaders, method, url, queryObj, postData }: {
|
|
9
|
+
allHeaders: any;
|
|
10
|
+
method: any;
|
|
11
|
+
url: any;
|
|
12
|
+
queryObj: any;
|
|
13
|
+
postData: any;
|
|
14
|
+
}, options: any) => any;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/javascript/axios/client.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;CAgFjB,CAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import stringifyObject from 'stringify-object';
|
|
2
|
+
import { CodeBuilder } from '../../../helpers/code-builder.js';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* HTTP code snippet generator for Javascript & Node.js using Axios.
|
|
9
|
+
*
|
|
10
|
+
* @author
|
|
11
|
+
* @rohit-gohri
|
|
12
|
+
*
|
|
13
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
14
|
+
*/
|
|
15
|
+
const axios = {
|
|
16
|
+
info: {
|
|
17
|
+
key: 'axios',
|
|
18
|
+
title: 'Axios',
|
|
19
|
+
link: 'https://github.com/axios/axios',
|
|
20
|
+
description: 'Promise based HTTP client for the browser and node.js',
|
|
21
|
+
},
|
|
22
|
+
convert: ({ allHeaders, method, url, queryObj, postData }, options) => {
|
|
23
|
+
const opts = {
|
|
24
|
+
indent: ' ',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
const { blank, push, join, addPostProcessor } = new CodeBuilder({
|
|
28
|
+
indent: opts.indent,
|
|
29
|
+
});
|
|
30
|
+
push("import axios from 'axios';");
|
|
31
|
+
blank();
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
method,
|
|
34
|
+
url,
|
|
35
|
+
};
|
|
36
|
+
if (Object.keys(queryObj).length) {
|
|
37
|
+
requestOptions.params = queryObj;
|
|
38
|
+
}
|
|
39
|
+
if (Object.keys(allHeaders).length) {
|
|
40
|
+
requestOptions.headers = allHeaders;
|
|
41
|
+
}
|
|
42
|
+
switch (postData === null || postData === void 0 ? void 0 : postData.mimeType) {
|
|
43
|
+
case 'application/x-www-form-urlencoded':
|
|
44
|
+
if (postData.params) {
|
|
45
|
+
push('const encodedParams = new URLSearchParams();');
|
|
46
|
+
postData.params.forEach((param) => {
|
|
47
|
+
push(`encodedParams.set('${param.name}', '${param.value}');`);
|
|
48
|
+
});
|
|
49
|
+
blank();
|
|
50
|
+
requestOptions.data = 'encodedParams,';
|
|
51
|
+
addPostProcessor((code) => code.replace(/'encodedParams,'/, 'encodedParams,'));
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case 'application/json':
|
|
55
|
+
if (postData.jsonObj) {
|
|
56
|
+
requestOptions.data = postData.jsonObj;
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
case 'multipart/form-data':
|
|
60
|
+
if (!postData.params) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
push('const form = new FormData();');
|
|
64
|
+
postData.params.forEach((param) => {
|
|
65
|
+
push(`form.append('${param.name}', '${param.value || param.fileName || ''}');`);
|
|
66
|
+
});
|
|
67
|
+
blank();
|
|
68
|
+
requestOptions.data = '[form]';
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
72
|
+
requestOptions.data = postData.text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const optionString = stringifyObject(requestOptions, {
|
|
76
|
+
indent: ' ',
|
|
77
|
+
inlineCharacterLimit: 80,
|
|
78
|
+
}).replace('"[form]"', 'form');
|
|
79
|
+
push(`const options = ${optionString};`);
|
|
80
|
+
blank();
|
|
81
|
+
push('try {');
|
|
82
|
+
push('const { data } = await axios.request(options);', 1);
|
|
83
|
+
push('console.log(data);', 1);
|
|
84
|
+
push('} catch (error) {');
|
|
85
|
+
push('console.error(error);', 1);
|
|
86
|
+
push('}');
|
|
87
|
+
return join();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { axios };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const fetch: {
|
|
2
|
+
info: {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
convert: ({ method, allHeaders, postData, fullUrl }: {
|
|
9
|
+
method: any;
|
|
10
|
+
allHeaders: any;
|
|
11
|
+
postData: any;
|
|
12
|
+
fullUrl: any;
|
|
13
|
+
}, inputOpts: any) => any;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/javascript/fetch/client.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;CA6FjB,CAAA"}
|