@scalar/snippetz 0.5.5 → 0.6.2
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/index.js +5 -5
- package/dist/clients/index.js.map +1 -1
- package/dist/httpsnippet-lite/helpers/code-builder.d.ts +51 -0
- package/dist/httpsnippet-lite/helpers/code-builder.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/code-builder.js +29 -0
- package/dist/httpsnippet-lite/helpers/code-builder.js.map +7 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/escape.d.ts +22 -3
- package/dist/httpsnippet-lite/helpers/escape.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/escape.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/headers.d.ts +15 -0
- package/dist/httpsnippet-lite/helpers/headers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/headers.js +2 -13
- package/dist/httpsnippet-lite/helpers/headers.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/reducer.d.ts +2 -0
- package/dist/httpsnippet-lite/helpers/reducer.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/reducer.js +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/shell.d.ts +2 -2
- package/dist/httpsnippet-lite/helpers/shell.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/helpers → helpers}/shell.js +4 -4
- package/dist/httpsnippet-lite/helpers/shell.js.map +7 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.d.ts +33 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/snippet-request.js +1 -0
- package/dist/httpsnippet-lite/helpers/url.d.ts +4 -0
- package/dist/httpsnippet-lite/helpers/url.d.ts.map +1 -0
- package/dist/httpsnippet-lite/helpers/url.js +9 -0
- package/dist/httpsnippet-lite/helpers/url.js.map +7 -0
- package/dist/httpsnippet-lite/targets/c/libcurl/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/c/libcurl/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/c/libcurl/client.js +7 -13
- package/dist/httpsnippet-lite/targets/c/libcurl/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/clojure/clj_http/client.js +7 -3
- package/dist/httpsnippet-lite/targets/clojure/clj_http/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/csharp/restsharp/client.js +8 -18
- package/dist/httpsnippet-lite/targets/csharp/restsharp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/go/native/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/go/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/go/native/client.js +14 -35
- package/dist/httpsnippet-lite/targets/go/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/asynchttp/client.js +1 -4
- package/dist/httpsnippet-lite/targets/java/asynchttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/nethttp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/java/nethttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/nethttp/client.js +3 -6
- package/dist/httpsnippet-lite/targets/java/nethttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/okhttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/okhttp/client.js +5 -8
- package/dist/httpsnippet-lite/targets/java/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/java/unirest/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/java/unirest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/java/unirest/client.js +4 -8
- package/dist/httpsnippet-lite/targets/java/unirest/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/axios/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/javascript/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/axios/client.js +6 -10
- package/dist/httpsnippet-lite/targets/javascript/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/jquery/client.js +5 -11
- package/dist/httpsnippet-lite/targets/javascript/jquery/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/javascript/xhr/client.js +7 -15
- package/dist/httpsnippet-lite/targets/javascript/xhr/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/kotlin/okhttp/client.js +6 -9
- package/dist/httpsnippet-lite/targets/kotlin/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/node/axios/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/node/axios/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/node/axios/client.js +3 -5
- package/dist/httpsnippet-lite/targets/node/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/helpers.d.ts +5 -11
- package/dist/httpsnippet-lite/targets/objc/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/helpers.js +7 -10
- package/dist/httpsnippet-lite/targets/objc/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/objc/nsurlsession/client.js +14 -51
- package/dist/httpsnippet-lite/targets/objc/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/ocaml/cohttp/client.js +3 -5
- package/dist/httpsnippet-lite/targets/ocaml/cohttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/common.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/common.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/common.js +6 -12
- package/dist/httpsnippet-lite/targets/powershell/common.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/powershell/restmethod/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/powershell/webrequest/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/python/python3/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/python/python3/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/python/python3/client.js +4 -8
- package/dist/httpsnippet-lite/targets/python/python3/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/r/httr/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/r/httr/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/r/httr/client.js +5 -12
- package/dist/httpsnippet-lite/targets/r/httr/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/ruby/native/client.d.ts +3 -0
- package/dist/httpsnippet-lite/targets/ruby/native/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/ruby/native/client.js +2 -2
- package/dist/httpsnippet-lite/targets/ruby/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/shell/httpie/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/shell/httpie/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/shell/httpie/client.js +11 -11
- package/dist/httpsnippet-lite/targets/shell/httpie/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/shell/wget/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/shell/wget/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/shell/wget/client.js +6 -6
- package/dist/httpsnippet-lite/targets/shell/wget/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/swift/helpers.d.ts +15 -0
- package/dist/httpsnippet-lite/targets/swift/helpers.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/swift/helpers.js +9 -16
- package/dist/httpsnippet-lite/targets/swift/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.d.ts +12 -0
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.d.ts.map +1 -0
- package/dist/httpsnippet-lite/{esm/targets → targets}/swift/nsurlsession/client.js +11 -32
- package/dist/httpsnippet-lite/targets/swift/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/targets/target.d.ts +19 -0
- package/dist/httpsnippet-lite/targets/target.d.ts.map +1 -0
- package/dist/httpsnippet-lite/targets/target.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +2 -2
- package/dist/plugins/c/libcurl/index.d.ts +1 -1
- package/dist/plugins/c/libcurl/index.d.ts.map +1 -1
- package/dist/plugins/c/libcurl/index.js +4 -1
- package/dist/plugins/c/libcurl/index.js.map +2 -2
- package/dist/plugins/c/libcurl/libcurl.js +1 -1
- package/dist/plugins/c/libcurl/libcurl.js.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js +1 -1
- package/dist/plugins/clojure/clj_http/clj_http.js.map +2 -2
- package/dist/plugins/clojure/clj_http/index.d.ts +1 -1
- package/dist/plugins/clojure/clj_http/index.d.ts.map +1 -1
- package/dist/plugins/clojure/clj_http/index.js +4 -1
- package/dist/plugins/clojure/clj_http/index.js.map +2 -2
- package/dist/plugins/csharp/httpclient/index.d.ts +1 -1
- package/dist/plugins/csharp/httpclient/index.d.ts.map +1 -1
- package/dist/plugins/csharp/httpclient/index.js +4 -1
- package/dist/plugins/csharp/httpclient/index.js.map +2 -2
- package/dist/plugins/csharp/restsharp/index.d.ts +1 -1
- package/dist/plugins/csharp/restsharp/index.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/index.js +4 -1
- package/dist/plugins/csharp/restsharp/index.js.map +2 -2
- package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js +1 -1
- package/dist/plugins/csharp/restsharp/restsharp.js.map +2 -2
- package/dist/plugins/dart/http/index.d.ts +1 -1
- package/dist/plugins/dart/http/index.d.ts.map +1 -1
- package/dist/plugins/dart/http/index.js +4 -1
- package/dist/plugins/dart/http/index.js.map +2 -2
- package/dist/plugins/fsharp/httpclient/index.d.ts +1 -1
- package/dist/plugins/fsharp/httpclient/index.d.ts.map +1 -1
- package/dist/plugins/fsharp/httpclient/index.js +4 -1
- package/dist/plugins/fsharp/httpclient/index.js.map +2 -2
- package/dist/plugins/go/native/index.d.ts +1 -1
- package/dist/plugins/go/native/index.d.ts.map +1 -1
- package/dist/plugins/go/native/index.js +4 -1
- package/dist/plugins/go/native/index.js.map +2 -2
- package/dist/plugins/go/native/native.d.ts.map +1 -1
- package/dist/plugins/go/native/native.js +1 -1
- package/dist/plugins/go/native/native.js.map +2 -2
- package/dist/plugins/http/http11/index.d.ts +1 -1
- package/dist/plugins/http/http11/index.d.ts.map +1 -1
- package/dist/plugins/http/http11/index.js +4 -1
- package/dist/plugins/http/http11/index.js.map +2 -2
- package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js +1 -1
- package/dist/plugins/java/asynchttp/asynchttp.js.map +2 -2
- package/dist/plugins/java/asynchttp/index.d.ts +1 -1
- package/dist/plugins/java/asynchttp/index.d.ts.map +1 -1
- package/dist/plugins/java/asynchttp/index.js +4 -1
- package/dist/plugins/java/asynchttp/index.js.map +2 -2
- package/dist/plugins/java/nethttp/index.d.ts +1 -1
- package/dist/plugins/java/nethttp/index.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/index.js +4 -1
- package/dist/plugins/java/nethttp/index.js.map +2 -2
- package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -1
- package/dist/plugins/java/nethttp/nethttp.js +1 -1
- package/dist/plugins/java/nethttp/nethttp.js.map +2 -2
- package/dist/plugins/java/okhttp/index.d.ts +1 -1
- package/dist/plugins/java/okhttp/index.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/index.js +4 -1
- package/dist/plugins/java/okhttp/index.js.map +2 -2
- package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/java/okhttp/okhttp.js +1 -1
- package/dist/plugins/java/okhttp/okhttp.js.map +2 -2
- package/dist/plugins/java/unirest/index.d.ts +1 -1
- package/dist/plugins/java/unirest/index.d.ts.map +1 -1
- package/dist/plugins/java/unirest/index.js +4 -1
- package/dist/plugins/java/unirest/index.js.map +2 -2
- package/dist/plugins/java/unirest/unirest.d.ts.map +1 -1
- package/dist/plugins/java/unirest/unirest.js +1 -1
- package/dist/plugins/java/unirest/unirest.js.map +2 -2
- package/dist/plugins/js/axios/axios.js +1 -1
- package/dist/plugins/js/axios/axios.js.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +1 -1
- package/dist/plugins/js/fetch/fetch.js.map +2 -2
- package/dist/plugins/js/jquery/index.d.ts +1 -1
- package/dist/plugins/js/jquery/index.d.ts.map +1 -1
- package/dist/plugins/js/jquery/index.js +4 -1
- package/dist/plugins/js/jquery/index.js.map +2 -2
- package/dist/plugins/js/jquery/jquery.d.ts.map +1 -1
- package/dist/plugins/js/jquery/jquery.js +1 -1
- package/dist/plugins/js/jquery/jquery.js.map +2 -2
- package/dist/plugins/js/ofetch/index.d.ts +1 -1
- package/dist/plugins/js/ofetch/index.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/index.js +4 -1
- package/dist/plugins/js/ofetch/index.js.map +2 -2
- package/dist/plugins/js/xhr/index.d.ts +1 -1
- package/dist/plugins/js/xhr/index.d.ts.map +1 -1
- package/dist/plugins/js/xhr/index.js +4 -1
- package/dist/plugins/js/xhr/index.js.map +2 -2
- package/dist/plugins/js/xhr/xhr.d.ts.map +1 -1
- package/dist/plugins/js/xhr/xhr.js +1 -1
- package/dist/plugins/js/xhr/xhr.js.map +2 -2
- package/dist/plugins/kotlin/okhttp/index.d.ts +1 -1
- package/dist/plugins/kotlin/okhttp/index.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/index.js +4 -1
- package/dist/plugins/kotlin/okhttp/index.js.map +2 -2
- package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js +1 -1
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +2 -2
- package/dist/plugins/node/axios/axios.js +1 -1
- package/dist/plugins/node/axios/axios.js.map +1 -1
- package/dist/plugins/node/axios/index.d.ts +1 -1
- package/dist/plugins/node/axios/index.d.ts.map +1 -1
- package/dist/plugins/node/axios/index.js +4 -1
- package/dist/plugins/node/axios/index.js.map +2 -2
- package/dist/plugins/node/fetch/fetch.js +1 -1
- package/dist/plugins/node/fetch/fetch.js.map +2 -2
- package/dist/plugins/node/fetch/index.d.ts +1 -1
- package/dist/plugins/node/fetch/index.d.ts.map +1 -1
- package/dist/plugins/node/fetch/index.js +4 -1
- package/dist/plugins/node/fetch/index.js.map +2 -2
- package/dist/plugins/node/ofetch/index.d.ts +1 -1
- package/dist/plugins/node/ofetch/index.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/index.js +4 -1
- package/dist/plugins/node/ofetch/index.js.map +2 -2
- package/dist/plugins/node/undici/index.d.ts +1 -1
- package/dist/plugins/node/undici/index.d.ts.map +1 -1
- package/dist/plugins/node/undici/index.js +4 -1
- package/dist/plugins/node/undici/index.js.map +2 -2
- package/dist/plugins/node/undici/undici.js +1 -1
- package/dist/plugins/node/undici/undici.js.map +2 -2
- package/dist/plugins/objc/nsurlsession/index.d.ts +1 -1
- package/dist/plugins/objc/nsurlsession/index.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/index.js +4 -1
- package/dist/plugins/objc/nsurlsession/index.js.map +2 -2
- package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +1 -1
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +2 -2
- package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js +1 -1
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +2 -2
- package/dist/plugins/ocaml/cohttp/index.d.ts +1 -1
- package/dist/plugins/ocaml/cohttp/index.d.ts.map +1 -1
- package/dist/plugins/ocaml/cohttp/index.js +4 -1
- package/dist/plugins/ocaml/cohttp/index.js.map +2 -2
- package/dist/plugins/php/curl/index.d.ts +1 -1
- package/dist/plugins/php/curl/index.d.ts.map +1 -1
- package/dist/plugins/php/curl/index.js +4 -1
- package/dist/plugins/php/curl/index.js.map +2 -2
- package/dist/plugins/php/guzzle/index.d.ts +1 -1
- package/dist/plugins/php/guzzle/index.d.ts.map +1 -1
- package/dist/plugins/php/guzzle/index.js +4 -1
- package/dist/plugins/php/guzzle/index.js.map +2 -2
- package/dist/plugins/powershell/restmethod/index.d.ts +1 -1
- package/dist/plugins/powershell/restmethod/index.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/index.js +4 -1
- package/dist/plugins/powershell/restmethod/index.js.map +2 -2
- package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js +1 -1
- package/dist/plugins/powershell/restmethod/restmethod.js.map +2 -2
- package/dist/plugins/powershell/webrequest/index.d.ts +1 -1
- package/dist/plugins/powershell/webrequest/index.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/index.js +4 -1
- package/dist/plugins/powershell/webrequest/index.js.map +2 -2
- package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js +1 -1
- package/dist/plugins/powershell/webrequest/webrequest.js.map +2 -2
- package/dist/plugins/python/httpx/async.d.ts.map +1 -1
- package/dist/plugins/python/httpx/async.js.map +2 -2
- package/dist/plugins/python/httpx/index.d.ts +2 -2
- package/dist/plugins/python/httpx/index.d.ts.map +1 -1
- package/dist/plugins/python/httpx/index.js +6 -2
- package/dist/plugins/python/httpx/index.js.map +2 -2
- package/dist/plugins/python/httpx/sync.d.ts.map +1 -1
- package/dist/plugins/python/httpx/sync.js.map +2 -2
- package/dist/plugins/python/python3/index.d.ts +1 -1
- package/dist/plugins/python/python3/index.d.ts.map +1 -1
- package/dist/plugins/python/python3/index.js +4 -1
- package/dist/plugins/python/python3/index.js.map +2 -2
- package/dist/plugins/python/python3/python3.d.ts.map +1 -1
- package/dist/plugins/python/python3/python3.js +1 -1
- package/dist/plugins/python/python3/python3.js.map +2 -2
- package/dist/plugins/python/requests/index.d.ts +1 -1
- package/dist/plugins/python/requests/index.d.ts.map +1 -1
- package/dist/plugins/python/requests/index.js +4 -1
- package/dist/plugins/python/requests/index.js.map +2 -2
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js.map +2 -2
- package/dist/plugins/r/httr/httr.d.ts.map +1 -1
- package/dist/plugins/r/httr/httr.js +1 -1
- package/dist/plugins/r/httr/httr.js.map +2 -2
- package/dist/plugins/r/httr/index.d.ts +1 -1
- package/dist/plugins/r/httr/index.d.ts.map +1 -1
- package/dist/plugins/r/httr/index.js +4 -1
- package/dist/plugins/r/httr/index.js.map +2 -2
- package/dist/plugins/ruby/native/index.d.ts +1 -1
- package/dist/plugins/ruby/native/index.d.ts.map +1 -1
- package/dist/plugins/ruby/native/index.js +4 -1
- package/dist/plugins/ruby/native/index.js.map +2 -2
- package/dist/plugins/ruby/native/native.d.ts.map +1 -1
- package/dist/plugins/ruby/native/native.js +1 -1
- package/dist/plugins/ruby/native/native.js.map +2 -2
- package/dist/plugins/rust/reqwest/index.d.ts +1 -1
- package/dist/plugins/rust/reqwest/index.d.ts.map +1 -1
- package/dist/plugins/rust/reqwest/index.js +4 -1
- package/dist/plugins/rust/reqwest/index.js.map +2 -2
- package/dist/plugins/shell/curl/index.d.ts +1 -1
- package/dist/plugins/shell/curl/index.d.ts.map +1 -1
- package/dist/plugins/shell/curl/index.js +4 -1
- package/dist/plugins/shell/curl/index.js.map +2 -2
- package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/httpie.js +1 -1
- package/dist/plugins/shell/httpie/httpie.js.map +2 -2
- package/dist/plugins/shell/httpie/index.d.ts +1 -1
- package/dist/plugins/shell/httpie/index.d.ts.map +1 -1
- package/dist/plugins/shell/httpie/index.js +4 -1
- package/dist/plugins/shell/httpie/index.js.map +2 -2
- package/dist/plugins/shell/wget/index.d.ts +1 -1
- package/dist/plugins/shell/wget/index.d.ts.map +1 -1
- package/dist/plugins/shell/wget/index.js +4 -1
- package/dist/plugins/shell/wget/index.js.map +2 -2
- package/dist/plugins/shell/wget/wget.d.ts.map +1 -1
- package/dist/plugins/shell/wget/wget.js +1 -1
- package/dist/plugins/shell/wget/wget.js.map +2 -2
- package/dist/plugins/swift/nsurlsession/index.d.ts +1 -1
- package/dist/plugins/swift/nsurlsession/index.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/index.js +4 -1
- package/dist/plugins/swift/nsurlsession/index.js.map +2 -2
- package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +1 -1
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +2 -2
- package/dist/snippetz.d.ts +2 -2
- package/dist/snippetz.d.ts.map +1 -1
- package/dist/snippetz.js.map +2 -2
- package/dist/utils/convertWithHttpSnippetLite.js +1 -1
- package/dist/utils/convertWithHttpSnippetLite.js.map +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +2 -2
- package/package.json +4 -3
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts +0 -8
- package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/escape.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/escape.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/form-data.js +0 -59
- package/dist/httpsnippet-lite/esm/helpers/form-data.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/helpers/headers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/headers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts +0 -2
- package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/reducer.js +0 -20
- package/dist/httpsnippet-lite/esm/helpers/reducer.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/shell.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/shell.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts +0 -5
- package/dist/httpsnippet-lite/esm/helpers/url.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/url.js +0 -20
- package/dist/httpsnippet-lite/esm/helpers/url.js.map +0 -7
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/helpers/utils.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/helpers/utils.js +0 -16
- package/dist/httpsnippet-lite/esm/helpers/utils.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/c/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/c/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/c/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts +0 -27
- package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/go/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/go/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/go/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts +0 -67
- package/dist/httpsnippet-lite/esm/targets/java/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/java/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts +0 -55
- package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js +0 -100
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/node/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/node/target.js +0 -24
- package/dist/httpsnippet-lite/esm/targets/node/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/objc/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/objc/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts +0 -3
- package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +0 -72
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js +0 -85
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js +0 -127
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/php/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/php/target.js +0 -22
- package/dist/httpsnippet-lite/esm/targets/php/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts +0 -10
- package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts +0 -45
- package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts +0 -18
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts +0 -9
- package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +0 -68
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts +0 -19
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts +0 -29
- package/dist/httpsnippet-lite/esm/targets/python/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/python/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/python/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts +0 -27
- package/dist/httpsnippet-lite/esm/targets/r/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/r/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/r/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts +0 -16
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts +0 -26
- package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts +0 -42
- package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/target.js +0 -20
- package/dist/httpsnippet-lite/esm/targets/shell/target.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts +0 -17
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts +0 -15
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js.map +0 -7
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts +0 -25
- package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts.map +0 -1
- package/dist/httpsnippet-lite/esm/targets/swift/target.js +0 -16
- package/dist/httpsnippet-lite/esm/targets/swift/target.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/escape.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js +0 -28
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/headers.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/shell.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/shell.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/url.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/url.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/helpers/utils.d.js +0 -1
- package/dist/httpsnippet-lite/types/helpers/utils.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/httpsnippet.d.js +0 -19
- package/dist/httpsnippet-lite/types/httpsnippet.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/c/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/c/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/go/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/go/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/http/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/http/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/php/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/php/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/python/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/python/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/r/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/r/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js.map +0 -7
- package/dist/httpsnippet-lite/types/targets/targets.d.js +0 -1
- package/dist/httpsnippet-lite/types/targets/targets.d.js.map +0 -7
- /package/dist/httpsnippet-lite/{esm/helpers → helpers}/escape.js +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/code-builder.d.js.map → helpers/reducer.js.map} +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/escape.d.js.map → helpers/snippet-request.js.map} +0 -0
- /package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/restmethod/client.js +0 -0
- /package/dist/httpsnippet-lite/{esm/targets → targets}/powershell/webrequest/client.js +0 -0
- /package/dist/httpsnippet-lite/{types/helpers/headers.d.js.map → targets/target.js.map} +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import stringifyObject from "stringify-object";
|
|
2
|
-
import { CodeBuilder } from "
|
|
3
|
-
import { escapeForSingleQuotes } from "
|
|
4
|
-
import {
|
|
5
|
-
getHeader,
|
|
6
|
-
getHeaderName,
|
|
7
|
-
hasHeader
|
|
8
|
-
} from "../../../helpers/headers.js";
|
|
2
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
3
|
+
import { escapeForSingleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
4
|
+
import { getHeader, getHeaderName, hasHeader } from "../../../../httpsnippet-lite/helpers/headers.js";
|
|
9
5
|
const xhr = {
|
|
10
6
|
info: {
|
|
11
7
|
key: "xhr",
|
|
@@ -24,21 +20,19 @@ const xhr = {
|
|
|
24
20
|
switch (postData === null || postData === void 0 ? void 0 : postData.mimeType) {
|
|
25
21
|
case "application/json":
|
|
26
22
|
push(
|
|
27
|
-
`const data = JSON.stringify(${stringifyObject(postData
|
|
23
|
+
`const data = JSON.stringify(${stringifyObject(postData?.jsonObj, {
|
|
28
24
|
indent: opts.indent
|
|
29
25
|
})});`
|
|
30
26
|
);
|
|
31
27
|
blank();
|
|
32
28
|
break;
|
|
33
29
|
case "multipart/form-data":
|
|
34
|
-
if (!postData
|
|
30
|
+
if (!postData?.params) {
|
|
35
31
|
break;
|
|
36
32
|
}
|
|
37
33
|
push("const data = new FormData();");
|
|
38
34
|
postData.params.forEach((param) => {
|
|
39
|
-
push(
|
|
40
|
-
`data.append('${param.name}', '${param.value || param.fileName || ""}');`
|
|
41
|
-
);
|
|
35
|
+
push(`data.append('${param.name}', '${param.value || param.fileName || ""}');`);
|
|
42
36
|
});
|
|
43
37
|
if (hasHeader(allHeaders, "content-type")) {
|
|
44
38
|
if ((_a = getHeader(allHeaders, "content-type")) === null || _a === void 0 ? void 0 : _a.includes("boundary")) {
|
|
@@ -69,9 +63,7 @@ const xhr = {
|
|
|
69
63
|
blank();
|
|
70
64
|
push(`xhr.open('${method}', '${fullUrl}');`);
|
|
71
65
|
Object.keys(allHeaders).forEach((key) => {
|
|
72
|
-
push(
|
|
73
|
-
`xhr.setRequestHeader('${key}', '${escapeForSingleQuotes(allHeaders[key])}');`
|
|
74
|
-
);
|
|
66
|
+
push(`xhr.setRequestHeader('${key}', '${escapeForSingleQuotes(allHeaders[key])}');`);
|
|
75
67
|
});
|
|
76
68
|
blank();
|
|
77
69
|
push("xhr.send(data);");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/javascript/xhr/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for native XMLHttpRequest\n *\n * @author\n * @AhmadNassri\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\nimport stringifyObject from 'stringify-object'\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForSingleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport { getHeader, getHeaderName, hasHeader } from '@/httpsnippet-lite/helpers/headers'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const xhr: Client = {\n info: {\n key: 'xhr',\n title: 'XMLHttpRequest',\n link: 'https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest',\n description: 'W3C Standard API that provides scripted client functionality',\n },\n convert: ({ postData, allHeaders, method, fullUrl }, options) => {\n let _a\n const opts = {\n indent: ' ',\n cors: true,\n ...options,\n }\n const { blank, push, join } = new CodeBuilder({ indent: opts.indent })\n switch (postData === null || postData === void 0 ? void 0 : postData.mimeType) {\n case 'application/json':\n push(\n `const data = JSON.stringify(${stringifyObject(postData?.jsonObj, {\n indent: opts.indent,\n })});`,\n )\n blank()\n break\n case 'multipart/form-data':\n if (!postData?.params) {\n break\n }\n push('const data = new FormData();')\n postData.params.forEach((param) => {\n push(`data.append('${param.name}', '${param.value || param.fileName || ''}');`)\n })\n // remove the contentType header\n if (hasHeader(allHeaders, 'content-type')) {\n if (\n (_a = getHeader(allHeaders, 'content-type')) === null || _a === void 0 ? void 0 : _a.includes('boundary')\n ) {\n const headerName = getHeaderName(allHeaders, 'content-type')\n if (headerName) {\n delete allHeaders[headerName]\n }\n }\n }\n blank()\n break\n default:\n push(\n `const data = ${(postData === null || postData === void 0 ? void 0 : postData.text) ? `'${postData!.text}'` : 'null'};`,\n )\n blank()\n }\n push('const xhr = new XMLHttpRequest();')\n if (opts.cors) {\n push('xhr.withCredentials = true;')\n }\n blank()\n push(\"xhr.addEventListener('readystatechange', function () {\")\n push('if (this.readyState === this.DONE) {', 1)\n push('console.log(this.responseText);', 2)\n push('}', 1)\n push('});')\n blank()\n push(`xhr.open('${method}', '${fullUrl}');`)\n Object.keys(allHeaders).forEach((key) => {\n push(`xhr.setRequestHeader('${key}', '${escapeForSingleQuotes(allHeaders[key] as string)}');`)\n })\n blank()\n push('xhr.send(data);')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AASA,OAAO,qBAAqB;AAE5B,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,WAAW,eAAe,iBAAiB;AAG7C,MAAM,MAAc;AAAA,EACzB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,UAAU,YAAY,QAAQ,QAAQ,GAAG,YAAY;AAC/D,QAAI;AACJ,UAAM,OAAO;AAAA,MACX,QAAQ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CAAC,QAAQ;AACvC,WAAK,yBAAyB,GAAG,OAAO,sBAAsB,WAAW,GAAG,CAAW,CAAC,KAAK;AAAA,IAC/F,CAAC;AACD,UAAM;AACN,SAAK,iBAAiB;AACtB,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* HTTP code snippet generator for Kotlin using OkHttp.
|
|
4
|
+
*
|
|
5
|
+
* @author
|
|
6
|
+
* @seanghay
|
|
7
|
+
*
|
|
8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const okhttp: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/kotlin/okhttp/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,MAAM,EAAE,MAuEpB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { escapeForDoubleQuotes } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeForDoubleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
3
3
|
const okhttp = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "okhttp",
|
|
@@ -26,8 +26,8 @@ const okhttp = {
|
|
|
26
26
|
push(".build()", 1);
|
|
27
27
|
blank();
|
|
28
28
|
} else if (postData.mimeType === "multipart/form-data" && postData.params) {
|
|
29
|
-
push(
|
|
30
|
-
push(
|
|
29
|
+
push("val body = MultipartBody.Builder()");
|
|
30
|
+
push(".setType(MultipartBody.FORM)", 1);
|
|
31
31
|
postData.params.forEach((param) => {
|
|
32
32
|
if (param.fileName !== void 0) {
|
|
33
33
|
push(
|
|
@@ -38,7 +38,7 @@ const okhttp = {
|
|
|
38
38
|
push(`.addFormDataPart("${param.name}", "${param.value}")`, 1);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
push(
|
|
41
|
+
push(".build()", 1);
|
|
42
42
|
blank();
|
|
43
43
|
} else {
|
|
44
44
|
push(`val mediaType = MediaType.parse("${postData.mimeType}")`);
|
|
@@ -63,10 +63,7 @@ const okhttp = {
|
|
|
63
63
|
push(`.${method.toLowerCase()}()`, 1);
|
|
64
64
|
}
|
|
65
65
|
Object.keys(allHeaders).forEach((key) => {
|
|
66
|
-
push(
|
|
67
|
-
`.addHeader("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`,
|
|
68
|
-
1
|
|
69
|
-
);
|
|
66
|
+
push(`.addHeader("${key}", "${escapeForDoubleQuotes(allHeaders[key])}")`, 1);
|
|
70
67
|
});
|
|
71
68
|
push(".build()", 1);
|
|
72
69
|
blank();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/kotlin/okhttp/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for Kotlin using OkHttp.\n *\n * @author\n * @seanghay\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForDoubleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const okhttp: Client = {\n info: {\n key: 'okhttp',\n title: 'OkHttp',\n link: 'http://square.github.io/okhttp/',\n description: 'An HTTP Request Client Library',\n },\n convert: ({ postData, fullUrl, method, allHeaders }, options) => {\n const opts = {\n indent: ' ',\n ...options,\n }\n const { blank, join, push } = new CodeBuilder({ indent: opts.indent })\n const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD']\n const methodsWithBody = ['POST', 'PUT', 'DELETE', 'PATCH']\n push('val client = OkHttpClient()')\n blank()\n if (postData !== null && postData !== void 0) {\n if (postData.mimeType === 'application/x-www-form-urlencoded' && postData.params) {\n push('val formBody = FormBody.Builder()')\n postData.params.forEach((param) => {\n push(`.addEncoded(\"${param.name}\", \"${param.value}\")`, 1)\n })\n push('.build()', 1)\n blank()\n } else if (postData.mimeType === 'multipart/form-data' && postData.params) {\n push('val body = MultipartBody.Builder()')\n push('.setType(MultipartBody.FORM)', 1)\n postData.params.forEach((param) => {\n if (param.fileName !== undefined) {\n push(\n `.addFormDataPart(\"${param.name}\", \"${param.fileName}\", RequestBody.create(MediaType.parse(\"application/octet-stream\"), File(\"${param.fileName}\")))`,\n 1,\n )\n } else if (param.value !== undefined) {\n push(`.addFormDataPart(\"${param.name}\", \"${param.value}\")`, 1)\n }\n })\n push('.build()', 1)\n blank()\n } else {\n push(`val mediaType = MediaType.parse(\"${postData.mimeType}\")`)\n push(`val body = RequestBody.create(mediaType, ${JSON.stringify(postData.text)})`)\n }\n }\n push('val request = Request.Builder()')\n push(`.url(\"${fullUrl}\")`, 1)\n if (!methods.includes(method.toUpperCase())) {\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n push(`.method(\"${method.toUpperCase()}\", body)`, 1)\n } else {\n push(`.method(\"${method.toUpperCase()}\", null)`, 1)\n }\n } else if (methodsWithBody.includes(method.toUpperCase())) {\n if (postData === null || postData === void 0 ? void 0 : postData.text || postData.params) {\n push(`.${method.toLowerCase()}(body)`, 1)\n } else {\n push(`.${method.toLowerCase()}(null)`, 1)\n }\n } else {\n push(`.${method.toLowerCase()}()`, 1)\n }\n // Add headers, including the cookies\n Object.keys(allHeaders).forEach((key) => {\n push(`.addHeader(\"${key}\", \"${escapeForDoubleQuotes(allHeaders[key] as string)}\")`, 1)\n })\n push('.build()', 1)\n blank()\n push('val response = client.newCall(request).execute()')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAG/B,MAAM,SAAiB;AAAA,EAC5B,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,UAAU,SAAS,QAAQ,WAAW,GAAG,YAAY;AAC/D,UAAM,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,GAAG;AAAA,IACL;AACA,UAAM,EAAE,OAAO,MAAM,KAAK,IAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,OAAO,CAAC;AACrE,UAAM,UAAU,CAAC,OAAO,QAAQ,OAAO,UAAU,SAAS,MAAM;AAChE,UAAM,kBAAkB,CAAC,QAAQ,OAAO,UAAU,OAAO;AACzD,SAAK,6BAA6B;AAClC,UAAM;AACN,QAAI,aAAa,QAAQ,aAAa,QAAQ;AAC5C,UAAI,SAAS,aAAa,uCAAuC,SAAS,QAAQ;AAChF,aAAK,mCAAmC;AACxC,iBAAS,OAAO,QAAQ,CAAC,UAAU;AACjC,eAAK,gBAAgB,MAAM,IAAI,OAAO,MAAM,KAAK,MAAM,CAAC;AAAA,QAC1D,CAAC;AACD,aAAK,YAAY,CAAC;AAClB,cAAM;AAAA,MACR,WAAW,SAAS,aAAa,yBAAyB,SAAS,QAAQ;AACzE,aAAK,oCAAoC;AACzC,aAAK,gCAAgC,CAAC;AACtC,iBAAS,OAAO,QAAQ,CAAC,UAAU;AACjC,cAAI,MAAM,aAAa,QAAW;AAChC;AAAA,cACE,qBAAqB,MAAM,IAAI,OAAO,MAAM,QAAQ,4EAA4E,MAAM,QAAQ;AAAA,cAC9I;AAAA,YACF;AAAA,UACF,WAAW,MAAM,UAAU,QAAW;AACpC,iBAAK,qBAAqB,M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client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,KAAK,EAAE,MAwEnB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import stringifyObject from "stringify-object";
|
|
2
|
-
import { CodeBuilder } from "
|
|
2
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
3
3
|
const axios = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "axios",
|
|
@@ -37,14 +37,12 @@ const axios = {
|
|
|
37
37
|
});
|
|
38
38
|
blank();
|
|
39
39
|
reqOpts.data = "encodedParams,";
|
|
40
|
-
addPostProcessor(
|
|
41
|
-
(code) => code.replace(/'encodedParams,'/, "encodedParams,")
|
|
42
|
-
);
|
|
40
|
+
addPostProcessor((code) => code.replace(/'encodedParams,'/, "encodedParams,"));
|
|
43
41
|
}
|
|
44
42
|
break;
|
|
45
43
|
case "application/json":
|
|
46
44
|
blank();
|
|
47
|
-
if (postData
|
|
45
|
+
if (postData?.jsonObj) {
|
|
48
46
|
reqOpts.data = postData.jsonObj;
|
|
49
47
|
}
|
|
50
48
|
break;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/node/axios/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for Javascript & Node.js using Axios.\n *\n * @author\n * @rohit-gohri\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\nimport stringifyObject from 'stringify-object'\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport type { ReducedHelperObject } from '@/httpsnippet-lite/helpers/reducer'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const axios: Client = {\n info: {\n key: 'axios',\n title: 'Axios',\n link: 'https://github.com/axios/axios',\n description: 'Promise based HTTP client for the browser and node.js',\n },\n convert: ({ method, url, queryObj, allHeaders, postData }, options) => {\n const opts = {\n indent: ' ',\n ...options,\n }\n const { blank, join, push, addPostProcessor } = new CodeBuilder({\n indent: opts.indent,\n })\n push(\"const axios = require('axios').default;\")\n const reqOpts: {\n method: string\n url: string\n params?: ReducedHelperObject\n headers?: ReducedHelperObject\n data?: string | ReducedHelperObject\n } = {\n method,\n url,\n }\n if (Object.keys(queryObj).length) {\n reqOpts.params = queryObj\n }\n if (Object.keys(allHeaders).length) {\n reqOpts.headers = allHeaders\n }\n switch (postData === null || postData === void 0 ? void 0 : postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n if (postData!.params) {\n push(\"const { URLSearchParams } = require('url');\")\n blank()\n push('const encodedParams = new URLSearchParams();')\n postData!.params.forEach((param) => {\n push(`encodedParams.set('${param.name}', '${param.value}');`)\n })\n blank()\n reqOpts.data = 'encodedParams,'\n addPostProcessor((code) => code.replace(/'encodedParams,'/, 'encodedParams,'))\n }\n break\n case 'application/json':\n blank()\n if (postData?.jsonObj) {\n reqOpts.data = postData.jsonObj\n }\n break\n default:\n blank()\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n reqOpts.data = postData!.text\n }\n }\n const stringifiedOptions = stringifyObject(reqOpts, {\n indent: ' ',\n inlineCharacterLimit: 80,\n })\n push(`const options = ${stringifiedOptions};`)\n blank()\n push('try {')\n push('const { data } = await axios.request(options);', 1)\n push('console.log(data);', 1)\n push('} catch (error) {')\n push('console.error(error);', 1)\n push('}')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AASA,OAAO,qBAAqB;AAE5B,SAAS,mBAAmB;AAIrB,MAAM,QAAgB;AAAA,EAC3B,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,QAAQ,KAAK,UAAU,YAAY,SAAS,GAAG,YAAY;AACrE,UAAM,OAAO;AAAA,MACX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G;AACR,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create a string corresponding to a valid declaration and initialization of an Objective-C object literal.
|
|
3
3
|
*
|
|
4
|
-
* @param nsClass Class of the
|
|
4
|
+
* @param nsClass Class of the literal
|
|
5
5
|
* @param name Desired name of the instance
|
|
6
|
-
* @param parameters Key-value object of parameters to translate to an Objective-C object
|
|
7
|
-
* @param indent If true, will declare the
|
|
8
|
-
* @return A valid Objective-C declaration and initialization of an Objective-C object
|
|
6
|
+
* @param parameters Key-value object of parameters to translate to an Objective-C object literal
|
|
7
|
+
* @param indent If true, will declare the literal by indenting each new key/value pair.
|
|
8
|
+
* @return A valid Objective-C declaration and initialization of an Objective-C object literal.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* nsDeclaration('NSDictionary', 'params', {a: 'b', c: 'd'}, true)
|
|
@@ -17,11 +17,5 @@
|
|
|
17
17
|
* // returns:
|
|
18
18
|
* NSDictionary *params = @{ @"a": @"b", @"c": @"d" };
|
|
19
19
|
*/
|
|
20
|
-
export declare const nsDeclaration: (nsClass:
|
|
21
|
-
/**
|
|
22
|
-
* Create a valid Objective-C string of a literal value according to its type.
|
|
23
|
-
*
|
|
24
|
-
* @param value Any JavaScript literal
|
|
25
|
-
*/
|
|
26
|
-
export declare const literalRepresentation: (value: any, indentation: any) => any;
|
|
20
|
+
export declare const nsDeclaration: (nsClass: string, name: string, parameters: unknown, indent: boolean) => string;
|
|
27
21
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/targets/objc/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,EAAE,YAAY,OAAO,EAAE,QAAQ,OAAO,KAAG,MAInG,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
const nsDeclaration = (nsClass, name, parameters, indent) => {
|
|
2
2
|
const opening = `${nsClass} *${name} = `;
|
|
3
|
-
const literal = literalRepresentation(
|
|
4
|
-
parameters,
|
|
5
|
-
indent ? opening.length : void 0
|
|
6
|
-
);
|
|
3
|
+
const literal = literalRepresentation(parameters, indent ? opening.length : void 0);
|
|
7
4
|
return `${opening}${literal};`;
|
|
8
5
|
};
|
|
9
6
|
const literalRepresentation = (value, indentation) => {
|
|
@@ -13,15 +10,16 @@ const literalRepresentation = (value, indentation) => {
|
|
|
13
10
|
case "[object Number]":
|
|
14
11
|
return `@${value}`;
|
|
15
12
|
case "[object Array]": {
|
|
16
|
-
const valuesRepresentation = value.map(
|
|
17
|
-
(value2) => literalRepresentation(value2)
|
|
18
|
-
);
|
|
13
|
+
const valuesRepresentation = value.map((value2) => literalRepresentation(value2));
|
|
19
14
|
return `@[ ${valuesRepresentation.join(join)} ]`;
|
|
20
15
|
}
|
|
21
16
|
case "[object Object]": {
|
|
22
17
|
const keyValuePairs = [];
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const _value = value;
|
|
19
|
+
for (const key in _value) {
|
|
20
|
+
if (Object.hasOwn(_value, key)) {
|
|
21
|
+
keyValuePairs.push(`@"${key}": ${literalRepresentation(_value[key])}`);
|
|
22
|
+
}
|
|
25
23
|
}
|
|
26
24
|
return `@{ ${keyValuePairs.join(join)} }`;
|
|
27
25
|
}
|
|
@@ -35,7 +33,6 @@ const literalRepresentation = (value, indentation) => {
|
|
|
35
33
|
}
|
|
36
34
|
};
|
|
37
35
|
export {
|
|
38
|
-
literalRepresentation,
|
|
39
36
|
nsDeclaration
|
|
40
37
|
};
|
|
41
38
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/httpsnippet-lite/targets/objc/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Create a string corresponding to a valid declaration and initialization of an Objective-C object literal.\n *\n * @param nsClass Class of the literal\n * @param name Desired name of the instance\n * @param parameters Key-value object of parameters to translate to an Objective-C object literal\n * @param indent If true, will declare the literal by indenting each new key/value pair.\n * @return A valid Objective-C declaration and initialization of an Objective-C object literal.\n *\n * @example\n * nsDeclaration('NSDictionary', 'params', {a: 'b', c: 'd'}, true)\n * // returns:\n * NSDictionary *params = @{ @\"a\": @\"b\",\n * @\"c\": @\"d\" };\n *\n * nsDeclaration('NSDictionary', 'params', {a: 'b', c: 'd'})\n * // returns:\n * NSDictionary *params = @{ @\"a\": @\"b\", @\"c\": @\"d\" };\n */\nexport const nsDeclaration = (nsClass: string, name: string, parameters: unknown, indent: boolean): string => {\n const opening = `${nsClass} *${name} = `\n const literal = literalRepresentation(parameters, indent ? opening.length : undefined)\n return `${opening}${literal};`\n}\n\n/**\n * Create a valid Objective-C string of a literal value according to its type.\n *\n * @param value Any JavaScript literal\n */\nconst literalRepresentation = (value: unknown, indentation?: number): string => {\n const join = indentation === undefined ? ', ' : `,\\n ${' '.repeat(indentation)}`\n switch (Object.prototype.toString.call(value)) {\n case '[object Number]':\n return `@${value}`\n case '[object Array]': {\n const valuesRepresentation = (value as Array<unknown>).map((value) => literalRepresentation(value))\n return `@[ ${valuesRepresentation.join(join)} ]`\n }\n case '[object Object]': {\n const keyValuePairs = []\n const _value = value as Record<string, unknown>\n for (const key in _value) {\n if (Object.hasOwn(_value, key)) {\n keyValuePairs.push(`@\"${key}\": ${literalRepresentation(_value[key])}`)\n }\n }\n return `@{ ${keyValuePairs.join(join)} }`\n }\n case '[object Boolean]':\n return value ? '@YES' : '@NO'\n default:\n if (value === null || value === undefined) {\n return ''\n }\n return `@\"${value.toString().replace(/\"/g, '\\\\\"')}\"`\n }\n}\n"],
|
|
5
|
+
"mappings": "AAmBO,MAAM,gBAAgB,CAA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8
|
+
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
9
|
+
*/
|
|
10
|
+
import type { Client } from '../../../../httpsnippet-lite/targets/target.js';
|
|
11
|
+
export declare const nsurlsession: Client;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/objc/nsurlsession/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,YAAY,EAAE,MA+H1B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { nsDeclaration } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { nsDeclaration } from "../../../../httpsnippet-lite/targets/objc/helpers.js";
|
|
3
3
|
const nsurlsession = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "nsurlsession",
|
|
@@ -37,9 +37,7 @@ const nsurlsession = {
|
|
|
37
37
|
`NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${head.name}=${head.value}" dataUsingEncoding:NSUTF8StringEncoding]];`
|
|
38
38
|
);
|
|
39
39
|
tail.forEach(({ name, value }) => {
|
|
40
|
-
push(
|
|
41
|
-
`[postData appendData:[@"&${name}=${value}" dataUsingEncoding:NSUTF8StringEncoding]];`
|
|
42
|
-
);
|
|
40
|
+
push(`[postData appendData:[@"&${name}=${value}" dataUsingEncoding:NSUTF8StringEncoding]];`);
|
|
43
41
|
});
|
|
44
42
|
} else {
|
|
45
43
|
req.hasBody = false;
|
|
@@ -47,29 +45,13 @@ const nsurlsession = {
|
|
|
47
45
|
break;
|
|
48
46
|
case "application/json":
|
|
49
47
|
if (postData.jsonObj) {
|
|
50
|
-
push(
|
|
51
|
-
nsDeclaration(
|
|
52
|
-
"NSDictionary",
|
|
53
|
-
"parameters",
|
|
54
|
-
postData.jsonObj,
|
|
55
|
-
opts.pretty
|
|
56
|
-
)
|
|
57
|
-
);
|
|
48
|
+
push(nsDeclaration("NSDictionary", "parameters", postData.jsonObj, opts.pretty));
|
|
58
49
|
blank();
|
|
59
|
-
push(
|
|
60
|
-
"NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"
|
|
61
|
-
);
|
|
50
|
+
push("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];");
|
|
62
51
|
}
|
|
63
52
|
break;
|
|
64
53
|
case "multipart/form-data":
|
|
65
|
-
push(
|
|
66
|
-
nsDeclaration(
|
|
67
|
-
"NSArray",
|
|
68
|
-
"parameters",
|
|
69
|
-
postData.params || [],
|
|
70
|
-
opts.pretty
|
|
71
|
-
)
|
|
72
|
-
);
|
|
54
|
+
push(nsDeclaration("NSArray", "parameters", postData.params || [], opts.pretty));
|
|
73
55
|
push(`NSString *boundary = @"${postData.boundary}";`);
|
|
74
56
|
blank();
|
|
75
57
|
push("NSError *error;");
|
|
@@ -81,10 +63,7 @@ const nsurlsession = {
|
|
|
81
63
|
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',
|
|
82
64
|
2
|
|
83
65
|
);
|
|
84
|
-
push(
|
|
85
|
-
'[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];',
|
|
86
|
-
2
|
|
87
|
-
);
|
|
66
|
+
push('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];', 2);
|
|
88
67
|
push(
|
|
89
68
|
'[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',
|
|
90
69
|
2
|
|
@@ -93,17 +72,12 @@ const nsurlsession = {
|
|
|
93
72
|
push('NSLog(@"%@", error);', 3);
|
|
94
73
|
push("}", 2);
|
|
95
74
|
push("} else {", 1);
|
|
96
|
-
push(
|
|
97
|
-
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];',
|
|
98
|
-
2
|
|
99
|
-
);
|
|
75
|
+
push('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];', 2);
|
|
100
76
|
push('[body appendFormat:@"%@", param[@"value"]];', 2);
|
|
101
77
|
push("}", 1);
|
|
102
78
|
push("}");
|
|
103
79
|
push('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];');
|
|
104
|
-
push(
|
|
105
|
-
"NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];"
|
|
106
|
-
);
|
|
80
|
+
push("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");
|
|
107
81
|
break;
|
|
108
82
|
default:
|
|
109
83
|
blank();
|
|
@@ -113,15 +87,9 @@ const nsurlsession = {
|
|
|
113
87
|
}
|
|
114
88
|
}
|
|
115
89
|
blank();
|
|
116
|
-
push(
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
push(
|
|
120
|
-
" cachePolicy:NSURLRequestUseProtocolCachePolicy"
|
|
121
|
-
);
|
|
122
|
-
push(
|
|
123
|
-
` timeoutInterval:${opts.timeout.toFixed(1)}];`
|
|
124
|
-
);
|
|
90
|
+
push(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${fullUrl}"]`);
|
|
91
|
+
push(" cachePolicy:NSURLRequestUseProtocolCachePolicy");
|
|
92
|
+
push(` timeoutInterval:${opts.timeout.toFixed(1)}];`);
|
|
125
93
|
push(`[request setHTTPMethod:@"${method}"];`);
|
|
126
94
|
if (req.hasHeaders) {
|
|
127
95
|
push("[request setAllHTTPHeaderFields:headers];");
|
|
@@ -131,9 +99,7 @@ const nsurlsession = {
|
|
|
131
99
|
}
|
|
132
100
|
blank();
|
|
133
101
|
push("NSURLSession *session = [NSURLSession sharedSession];");
|
|
134
|
-
push(
|
|
135
|
-
"NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"
|
|
136
|
-
);
|
|
102
|
+
push("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request");
|
|
137
103
|
push(
|
|
138
104
|
" completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"
|
|
139
105
|
);
|
|
@@ -144,10 +110,7 @@ const nsurlsession = {
|
|
|
144
110
|
" NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",
|
|
145
111
|
2
|
|
146
112
|
);
|
|
147
|
-
push(
|
|
148
|
-
' NSLog(@"%@", httpResponse);',
|
|
149
|
-
2
|
|
150
|
-
);
|
|
113
|
+
push(' NSLog(@"%@", httpResponse);', 2);
|
|
151
114
|
push(" }", 1);
|
|
152
115
|
push(" }];");
|
|
153
116
|
push("[dataTask resume];");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/objc/nsurlsession/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for Objective-C using NSURLSession.\n *\n * @author\n * @thibaultCha\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\n\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { nsDeclaration } from '@/httpsnippet-lite/targets/objc/helpers'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const nsurlsession: Client = {\n info: {\n key: 'nsurlsession',\n title: 'NSURLSession',\n link: 'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',\n description: \"Foundation's NSURLSession request\",\n },\n convert: ({ allHeaders, postData, method, fullUrl }, options) => {\n let _a\n const opts = {\n indent: ' ',\n pretty: true,\n timeout: 10,\n ...options,\n }\n const { push, join, blank } = new CodeBuilder({ indent: opts.indent })\n // Markers for headers to be created as literal objects and later be set on the NSURLRequest if exist\n const req = {\n hasHeaders: false,\n hasBody: false,\n }\n // We just want to make sure people understand that is the only dependency\n push('#import <Foundation/Foundation.h>')\n if (Object.keys(allHeaders).length) {\n req.hasHeaders = true\n blank()\n push(nsDeclaration('NSDictionary', 'headers', allHeaders, opts.pretty))\n }\n if (postData && (postData.text || postData.jsonObj || postData.params)) {\n req.hasBody = true\n switch (postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n if ((_a = postData.params) === null || _a === void 0 ? void 0 : _a.length) {\n // By appending parameters one by one in the resulting snippet,\n // we make it easier for the user to edit it according to his or her needs after pasting.\n // The user can just add/remove lines adding/removing body parameters.\n blank()\n const [head, ...tail] = postData.params!\n push(\n `NSMutableData *postData = [[NSMutableData alloc] initWithData:[@\"${head!.name}=${head!.value}\" dataUsingEncoding:NSUTF8StringEncoding]];`,\n )\n tail.forEach(({ name, value }) => {\n push(`[postData appendData:[@\"&${name}=${value}\" dataUsingEncoding:NSUTF8StringEncoding]];`)\n })\n } else {\n req.hasBody = false\n }\n break\n case 'application/json':\n if (postData.jsonObj) {\n push(nsDeclaration('NSDictionary', 'parameters', postData.jsonObj, opts.pretty))\n blank()\n push('NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];')\n }\n break\n case 'multipart/form-data':\n // By appending multipart parameters one by one in the resulting snippet,\n // we make it easier for the user to edit it according to his or her needs after pasting.\n // The user can just edit the parameters NSDictionary or put this part of a snippet in a multipart builder method.\n push(nsDeclaration('NSArray', 'parameters', postData.params || [], opts.pretty))\n push(`NSString *boundary = @\"${postData.boundary}\";`)\n blank()\n push('NSError *error;')\n push('NSMutableString *body = [NSMutableString string];')\n push('for (NSDictionary *param in parameters) {')\n push('[body appendFormat:@\"--%@\\\\r\\\\n\", boundary];', 1)\n push('if (param[@\"fileName\"]) {', 1)\n push(\n '[body appendFormat:@\"Content-Disposition:form-data; name=\\\\\"%@\\\\\"; filename=\\\\\"%@\\\\\"\\\\r\\\\n\", param[@\"name\"], param[@\"fileName\"]];',\n 2,\n )\n push('[body appendFormat:@\"Content-Type: %@\\\\r\\\\n\\\\r\\\\n\", param[@\"contentType\"]];', 2)\n push(\n '[body appendFormat:@\"%@\", [NSString stringWithContentsOfFile:param[@\"fileName\"] encoding:NSUTF8StringEncoding error:&error]];',\n 2,\n )\n push('if (error) {', 2)\n push('NSLog(@\"%@\", error);', 3)\n push('}', 2)\n push('} else {', 1)\n push('[body appendFormat:@\"Content-Disposition:form-data; name=\\\\\"%@\\\\\"\\\\r\\\\n\\\\r\\\\n\", param[@\"name\"]];', 2)\n push('[body appendFormat:@\"%@\", param[@\"value\"]];', 2)\n push('}', 1)\n push('}')\n push('[body appendFormat:@\"\\\\r\\\\n--%@--\\\\r\\\\n\", boundary];')\n push('NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];')\n break\n default:\n blank()\n push(\n `NSData *postData = [[NSData alloc] initWithData:[@\"${postData.text}\" dataUsingEncoding:NSUTF8StringEncoding]];`,\n )\n }\n }\n blank()\n push(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"${fullUrl}\"]`)\n // NSURLRequestUseProtocolCachePolicy is the default policy, let's just always set it to avoid confusion.\n push(' cachePolicy:NSURLRequestUseProtocolCachePolicy')\n push(` timeoutInterval:${opts.timeout.toFixed(1)}];`)\n push(`[request setHTTPMethod:@\"${method}\"];`)\n if (req.hasHeaders) {\n push('[request setAllHTTPHeaderFields:headers];')\n }\n if (req.hasBody) {\n push('[request setHTTPBody:postData];')\n }\n blank()\n // Retrieving the shared session will be less verbose than creating a new one.\n push('NSURLSession *session = [NSURLSession sharedSession];')\n push('NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request')\n push(\n ' completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {',\n )\n push(' if (error) {', 1)\n push(' NSLog(@\"%@\", error);', 2)\n push(' } else {', 1)\n // Casting the NSURLResponse to NSHTTPURLResponse so the user can see the status .\n push(\n ' NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;',\n 2,\n )\n push(' NSLog(@\"%@\", httpResponse);', 2)\n push(' }', 1)\n push(' }];')\n push('[dataTask resume];')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAGvB,MAAM,eAAuB;AAAA,EAClC,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,CAAC,EAAE,YAAY,UAAU,QAAQ,QAAQ,GAAG,YAAY;AAC/D,QAAI;AACJ,UAAM,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AACA,UAAM,EAAE,MAAM,MAAM,MAAM,IAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,OAAO,CAAC;AAErE,UAAM,MAAM;AAAA,MACV,YAAY;AAAA,MACZ,SAAS;AAAA,IACX;AAEA,SAAK,mCAAmC;AACxC,QAAI,OAAO,KAAK,UAAU,EAAE,QAAQ;AAClC,UAAI,aAAa;AACjB,YAAM;AACN,WAAK,cAAc,gBAAgB,WAAW,YAAY,KAAK,MAAM,CAAC;AAAA,IACxE;AACA,QAAI,aAAa,SAAS,QAAQ,SAAS,WAAW,SAAS,SAAS;AACtE,UAAI,UAAU;AACd,cAAQ,SAAS,UAAU;AAAA,QACzB,KAAK;AACH,eAAK,KAAK,SAAS,YAAY,QAAQ,OAAO,SAAS,SAAS,GAAG,QAAQ;AAIzE,kBAAM;AACN,kBAAM,CAAC,MAAM,GAAG,IAAI,IAAI,SAAS;AACjC;AAAA,cACE,oEAAoE,KAAM,IAAI,IAAI,KAAM,KAAK;AAAA,YAC/F;AACA,iBAAK,QAAQ,CAAC,EAAE,MAAM,MAAM,MAAM;AAChC,mBAAK,4BAA4B,IAAI,IAAI,KAAK,6CAA6C;AAAA,YA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;AAC5E;AAAA,MACE;AAAA,IACF;AACA,SAAK,4DAA4D,CAAC;AAClE,SAAK,oEAAoE,CAAC;AAC1E,SAAK,wDAAwD,CAAC;AAE9D;AAAA,MACE;AAAA,MACA;AAAA,IACF;AACA,SAAK,2EAA2E,CAAC;AACjF,SAAK,iDAAiD,CAAC;AACvD,SAAK,iDAAiD;AACtD,SAAK,oBAAoB;AACzB,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/ocaml/cohttp/client.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,eAAO,MAAM,MAAM,EAAE,MAkDpB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { escapeForDoubleQuotes } from "
|
|
1
|
+
import { CodeBuilder } from "../../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeForDoubleQuotes } from "../../../../httpsnippet-lite/helpers/escape.js";
|
|
3
3
|
const cohttp = {
|
|
4
4
|
info: {
|
|
5
5
|
key: "cohttp",
|
|
@@ -32,9 +32,7 @@ const cohttp = {
|
|
|
32
32
|
push("] in");
|
|
33
33
|
}
|
|
34
34
|
if (postData === null || postData === void 0 ? void 0 : postData.text) {
|
|
35
|
-
push(
|
|
36
|
-
`let body = Cohttp_lwt_body.of_string ${JSON.stringify(postData.text)} in`
|
|
37
|
-
);
|
|
35
|
+
push(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(postData.text)} in`);
|
|
38
36
|
}
|
|
39
37
|
blank();
|
|
40
38
|
const h = headers.length ? "~headers " : "";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/ocaml/cohttp/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @description\n * HTTP code snippet generator for OCaml using CoHTTP.\n *\n * @author\n * @SGrondin\n *\n * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.\n */\nimport { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeForDoubleQuotes } from '@/httpsnippet-lite/helpers/escape'\nimport type { Client } from '@/httpsnippet-lite/targets/target'\n\nexport const cohttp: Client = {\n info: {\n key: 'cohttp',\n title: 'CoHTTP',\n link: 'https://github.com/mirage/ocaml-cohttp',\n description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml',\n },\n convert: ({ fullUrl, allHeaders, postData, method }, options) => {\n const opts = {\n indent: ' ',\n ...options,\n }\n const methods = ['get', 'post', 'head', 'delete', 'patch', 'put', 'options']\n const { push, blank, join } = new CodeBuilder({ indent: opts.indent })\n push('open Cohttp_lwt_unix')\n push('open Cohttp')\n push('open Lwt')\n blank()\n push(`let uri = Uri.of_string \"${fullUrl}\" in`)\n // Add headers, including the cookies\n const headers = Object.keys(allHeaders)\n if (headers.length === 1) {\n push(\n `let headers = Header.add (Header.init ()) \"${headers[0]}\" \"${escapeForDoubleQuotes(allHeaders[headers[0]!] as string)}\" in`,\n )\n } else if (headers.length > 1) {\n push('let headers = Header.add_list (Header.init ()) [')\n headers.forEach((key) => {\n push(`(\"${key}\", \"${escapeForDoubleQuotes(allHeaders[key] as string)}\");`, 1)\n })\n push('] in')\n }\n // Add body\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n // Just text\n push(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(postData!.text)} in`)\n }\n // Do the request\n blank()\n const h = headers.length ? '~headers ' : ''\n const b = (postData === null || postData === void 0 ? void 0 : postData.text) ? '~body ' : ''\n const m = methods.includes(method.toLowerCase())\n ? `\\`${method.toUpperCase()}`\n : `(Code.method_of_string \"${method}\")`\n push(`Client.call ${h}${b}${m} uri`)\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AAa,SAAS,SAAS,SAAS,QAAQ,WAAW;AAC3F,UAAM,IAAI,QAAQ,SAAS,OAAO,YAAY,CAAC,IAC3C,KAAK,OAAO,YAAY,CAAC,KACzB,2BAA2B,MAAM;AACrC,SAAK,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM;AAEnC,SAAK,+BAA+B;AACpC,SAAK,kCAAkC,CAAC;AACxC,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/httpsnippet-lite/targets/powershell/common.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAElE,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,KAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAsDxF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CodeBuilder } from "
|
|
2
|
-
import { escapeString } from "
|
|
3
|
-
import { getHeader } from "
|
|
1
|
+
import { CodeBuilder } from "../../../httpsnippet-lite/helpers/code-builder.js";
|
|
2
|
+
import { escapeString } from "../../../httpsnippet-lite/helpers/escape.js";
|
|
3
|
+
import { getHeader } from "../../../httpsnippet-lite/helpers/headers.js";
|
|
4
4
|
const generatePowershellConvert = (command) => {
|
|
5
5
|
const convert = ({
|
|
6
6
|
method,
|
|
@@ -22,17 +22,13 @@ const generatePowershellConvert = (command) => {
|
|
|
22
22
|
push("$headers=@{}");
|
|
23
23
|
headers.forEach((key) => {
|
|
24
24
|
if (key !== "connection") {
|
|
25
|
-
push(
|
|
26
|
-
`$headers.Add("${key}", "${escapeString(headersObj[key], { escapeChar: "`" })}")`
|
|
27
|
-
);
|
|
25
|
+
push(`$headers.Add("${key}", "${escapeString(headersObj[key], { escapeChar: "`" })}")`);
|
|
28
26
|
}
|
|
29
27
|
});
|
|
30
28
|
commandOptions.push("-Headers $headers");
|
|
31
29
|
}
|
|
32
30
|
if (cookies.length) {
|
|
33
|
-
push(
|
|
34
|
-
"$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"
|
|
35
|
-
);
|
|
31
|
+
push("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession");
|
|
36
32
|
cookies.forEach((cookie) => {
|
|
37
33
|
push("$cookie = New-Object System.Net.Cookie");
|
|
38
34
|
push(`$cookie.Name = '${cookie.name}'`);
|
|
@@ -51,9 +47,7 @@ const generatePowershellConvert = (command) => {
|
|
|
51
47
|
);
|
|
52
48
|
commandOptions.push(`-Body '${postData.text}'`);
|
|
53
49
|
}
|
|
54
|
-
push(
|
|
55
|
-
`$response = ${command} -Uri '${fullUrl}' -Method ${method} ${commandOptions.join(" ")}`
|
|
56
|
-
);
|
|
50
|
+
push(`$response = ${command} -Uri '${fullUrl}' -Method ${method} ${commandOptions.join(" ")}`);
|
|
57
51
|
return join();
|
|
58
52
|
};
|
|
59
53
|
return convert;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/httpsnippet-lite/targets/powershell/common.ts"],
|
|
4
|
+
"sourcesContent": ["import { CodeBuilder } from '@/httpsnippet-lite/helpers/code-builder'\nimport { escapeString } from '@/httpsnippet-lite/helpers/escape'\nimport { getHeader } from '@/httpsnippet-lite/helpers/headers'\nimport type { Converter } from '@/httpsnippet-lite/targets/target'\n\nexport const generatePowershellConvert = (command: string): Converter<Record<string, any>> => {\n const convert: Converter<Record<string, any>> = ({\n method,\n headersObj,\n cookies,\n uriObj,\n fullUrl,\n postData,\n allHeaders,\n }) => {\n const { push, join } = new CodeBuilder()\n const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']\n if (!methods.includes(method.toUpperCase())) {\n return 'Method not supported'\n }\n const commandOptions = []\n // Add headers, including the cookies\n const headers = Object.keys(headersObj)\n // construct headers\n if (headers.length) {\n push('$headers=@{}')\n headers.forEach((key) => {\n if (key !== 'connection') {\n // Not allowed\n push(`$headers.Add(\"${key}\", \"${escapeString(headersObj[key] as string, { escapeChar: '`' })}\")`)\n }\n })\n commandOptions.push('-Headers $headers')\n }\n // construct cookies\n if (cookies.length) {\n push('$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession')\n cookies.forEach((cookie) => {\n push('$cookie = New-Object System.Net.Cookie')\n push(`$cookie.Name = '${cookie.name}'`)\n push(`$cookie.Value = '${cookie.value}'`)\n push(`$cookie.Domain = '${uriObj.host}'`)\n push('$session.Cookies.Add($cookie)')\n })\n commandOptions.push('-WebSession $session')\n }\n if (postData === null || postData === void 0 ? void 0 : postData.text) {\n commandOptions.push(\n `-ContentType '${escapeString(getHeader(allHeaders, 'content-type') as string, {\n delimiter: \"'\",\n escapeChar: '`',\n })}'`,\n )\n commandOptions.push(`-Body '${postData!.text}'`)\n }\n push(`$response = ${command} -Uri '${fullUrl}' -Method ${method} ${commandOptions.join(' ')}`)\n return join()\n }\n return convert\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAGnB,MAAM,4BAA4B,CAAC,YAAoD;AAC5F,QAAM,UAA0C,CAAC;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAM;AACJ,UAAM,EAAE,MAAM,KAAK,IAAI,IAAI,YAAY;AACvC,UAAM,UAAU,CAAC,OAAO,QAAQ,OAAO,UAAU,SAAS,QAAQ,SAAS;AAC3E,QAAI,CAAC,QAAQ,SAAS,OAAO,YAAY,CAAC,GAAG;AAC3C,aAAO;AAAA,IACT;AACA,UAAM,iBAAiB,CAAC;AAExB,UAAM,UAAU,OAAO,KAAK,UAAU;AAEtC,QAAI,QAAQ,QAAQ;AAClB,WAAK,cAAc;AACnB,cAAQ,QAAQ,CAAC,QAAQ;AACvB,YAAI,QAAQ,cAAc;AAExB,eAAK,iBAAiB,GAAG,OAAO,aAAa,WAAW,GAAG,GAAa,EAAE,YAAY,IAAI,CAAC,CAAC,IAAI;AAAA,QAClG;AAAA,MACF,CAAC;AACD,qBAAe,KAAK,mBAAmB;AAAA,IACzC;AAEA,QAAI,QAAQ,QAAQ;AAClB,WAAK,uEAAuE;AAC5E,cAAQ,QAAQ,CAAC,WAAW;AAC1B,aAAK,wCAAwC;AAC7C,aAAK,mBAAmB,OAAO,IAAI,GAAG;AACtC,aAAK,oBAAoB,OAAO,KAAK,GAAG;AACxC,aAAK,qBAAqB,OAAO,IAAI,GAAG;AACxC,aAAK,+BAA+B;AAAA,MACtC,CAAC;AACD,qBAAe,KAAK,sBAAsB;AAAA,IAC5C;AACA,QAAI,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,MAAM;AACrE,qBAAe;AAAA,QACb,iBAAiB,aAAa,UAAU,YAAY,cAAc,GAAa;AAAA,UAC7E,WAAW;AAAA,UACX,YAAY;AAAA,QACd,CAAC,CAAC;AAAA,MACJ;AACA,qBAAe,KAAK,UAAU,SAAU,IAAI,GAAG;AAAA,IACjD;AACA,SAAK,eAAe,OAAO,UAAU,OAAO,aAAa,MAAM,IAAI,eAAe,KAAK,GAAG,CAAC,EAAE;AAC7F,WAAO,KAAK;AAAA,EACd;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/powershell/restmethod/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAIlE,eAAO,MAAM,UAAU,EAAE,MAQxB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/powershell/restmethod/client.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Client } from '@/httpsnippet-lite/targets/target.js'\n\nimport { generatePowershellConvert } from '../common.js'\n\nexport const restmethod: Client = {\n info: {\n key: 'restmethod',\n title: 'Invoke-RestMethod',\n link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod',\n description: 'Powershell Invoke-RestMethod client',\n },\n convert: generatePowershellConvert('Invoke-RestMethod'),\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,iCAAiC;AAEnC,MAAM,aAAqB;AAAA,EAChC,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,0BAA0B,mBAAmB;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/targets/powershell/webrequest/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAIlE,eAAO,MAAM,UAAU,EAAE,MAQxB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/targets/powershell/webrequest/client.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Client } from '@/httpsnippet-lite/targets/target.js'\n\nimport { generatePowershellConvert } from '../common.js'\n\nexport const webrequest: Client = {\n info: {\n key: 'webrequest',\n title: 'Invoke-WebRequest',\n link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest',\n description: 'Powershell Invoke-WebRequest client',\n },\n convert: generatePowershellConvert('Invoke-WebRequest'),\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,iCAAiC;AAEnC,MAAM,aAAqB;AAAA,EAChC,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,SAAS,0BAA0B,mBAAmB;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|