@scalar/snippetz 0.2.19 → 0.3.0
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.js +153 -155
- package/dist/clients.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js +44 -59
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.js +41 -69
- package/dist/httpsnippet-lite/esm/helpers/escape.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js +59 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.js +23 -18
- package/dist/httpsnippet-lite/esm/helpers/headers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.js +13 -16
- package/dist/httpsnippet-lite/esm/helpers/shell.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js +16 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +72 -40
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +149 -166
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +165 -161
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +47 -46
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js +167 -116
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +41 -43
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +79 -84
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +76 -83
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +78 -79
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +70 -77
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js +100 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js +24 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +36 -52
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +157 -128
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +50 -65
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +72 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js +85 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js +127 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js +61 -49
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +68 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +71 -90
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +99 -124
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +69 -69
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +106 -113
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js +20 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +42 -51
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +51 -67
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +132 -133
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js +28 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js +19 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js.map +7 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +7 -0
- package/dist/plugins/c/libcurl/index.js +2 -1
- package/dist/plugins/c/libcurl/index.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.js +12 -15
- package/dist/plugins/c/libcurl/libcurl.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.test.js +208 -0
- package/dist/plugins/c/libcurl/libcurl.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.js +12 -15
- package/dist/plugins/clojure/clj_http/clj_http.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js +151 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/index.js +2 -1
- package/dist/plugins/clojure/clj_http/index.js.map +7 -0
- package/dist/plugins/csharp/httpclient/httpclient.js +12 -15
- package/dist/plugins/csharp/httpclient/httpclient.js.map +7 -0
- package/dist/plugins/csharp/httpclient/index.js +2 -1
- package/dist/plugins/csharp/httpclient/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/index.js +2 -1
- package/dist/plugins/csharp/restsharp/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/restsharp.js +12 -15
- package/dist/plugins/csharp/restsharp/restsharp.js.map +7 -0
- package/dist/plugins/dart/http/http.js +92 -96
- package/dist/plugins/dart/http/http.js.map +7 -0
- package/dist/plugins/dart/http/http.test.js +550 -0
- package/dist/plugins/dart/http/http.test.js.map +7 -0
- package/dist/plugins/dart/http/index.js +2 -1
- package/dist/plugins/dart/http/index.js.map +7 -0
- package/dist/plugins/go/native/index.js +2 -1
- package/dist/plugins/go/native/index.js.map +7 -0
- package/dist/plugins/go/native/native.js +12 -15
- package/dist/plugins/go/native/native.js.map +7 -0
- package/dist/plugins/go/native/native.test.js +366 -0
- package/dist/plugins/go/native/native.test.js.map +7 -0
- package/dist/plugins/http/http11/http11.js +84 -104
- package/dist/plugins/http/http11/http11.js.map +7 -0
- package/dist/plugins/http/http11/http11.test.js +175 -0
- package/dist/plugins/http/http11/http11.test.js.map +7 -0
- package/dist/plugins/http/http11/index.js +2 -1
- package/dist/plugins/http/http11/index.js.map +7 -0
- package/dist/plugins/java/asynchttp/asynchttp.js +12 -15
- package/dist/plugins/java/asynchttp/asynchttp.js.map +7 -0
- package/dist/plugins/java/asynchttp/index.js +2 -1
- package/dist/plugins/java/asynchttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/index.js +2 -1
- package/dist/plugins/java/nethttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/nethttp.js +12 -15
- package/dist/plugins/java/nethttp/nethttp.js.map +7 -0
- package/dist/plugins/java/okhttp/index.js +2 -1
- package/dist/plugins/java/okhttp/index.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.js +12 -15
- package/dist/plugins/java/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/java/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/java/unirest/index.js +2 -1
- package/dist/plugins/java/unirest/index.js.map +7 -0
- package/dist/plugins/java/unirest/unirest.js +12 -15
- package/dist/plugins/java/unirest/unirest.js.map +7 -0
- package/dist/plugins/js/axios/axios.js +12 -15
- package/dist/plugins/js/axios/axios.js.map +7 -0
- package/dist/plugins/js/axios/index.d.ts +1 -1
- package/dist/plugins/js/axios/index.d.ts.map +1 -1
- package/dist/plugins/js/axios/index.js +5 -1
- package/dist/plugins/js/axios/index.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +67 -60
- package/dist/plugins/js/fetch/fetch.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.test.js +214 -0
- package/dist/plugins/js/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/js/fetch/index.d.ts +1 -1
- package/dist/plugins/js/fetch/index.d.ts.map +1 -1
- package/dist/plugins/js/fetch/index.js +5 -1
- package/dist/plugins/js/fetch/index.js.map +7 -0
- package/dist/plugins/js/jquery/index.js +2 -1
- package/dist/plugins/js/jquery/index.js.map +7 -0
- package/dist/plugins/js/jquery/jquery.js +12 -15
- package/dist/plugins/js/jquery/jquery.js.map +7 -0
- package/dist/plugins/js/ofetch/index.js +2 -1
- package/dist/plugins/js/ofetch/index.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +44 -67
- package/dist/plugins/js/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/js/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/js/xhr/index.js +2 -1
- package/dist/plugins/js/xhr/index.js.map +7 -0
- package/dist/plugins/js/xhr/xhr.js +12 -15
- package/dist/plugins/js/xhr/xhr.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/index.js +2 -1
- package/dist/plugins/kotlin/okhttp/index.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.js +12 -15
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/node/axios/axios.js +12 -15
- package/dist/plugins/node/axios/axios.js.map +7 -0
- package/dist/plugins/node/axios/index.js +2 -1
- package/dist/plugins/node/axios/index.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +73 -59
- package/dist/plugins/node/fetch/fetch.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.test.js +200 -0
- package/dist/plugins/node/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/node/fetch/index.js +2 -1
- package/dist/plugins/node/fetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/index.js +2 -1
- package/dist/plugins/node/ofetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +44 -67
- package/dist/plugins/node/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/node/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/node/undici/index.js +2 -1
- package/dist/plugins/node/undici/index.js.map +7 -0
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +46 -62
- package/dist/plugins/node/undici/undici.js.map +7 -0
- package/dist/plugins/node/undici/undici.test.js +133 -0
- package/dist/plugins/node/undici/undici.test.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/index.js +2 -1
- package/dist/plugins/objc/nsurlsession/index.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/cohttp.js +12 -15
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/index.js +2 -1
- package/dist/plugins/ocaml/cohttp/index.js.map +7 -0
- package/dist/plugins/php/curl/curl.js +119 -157
- package/dist/plugins/php/curl/curl.js.map +7 -0
- package/dist/plugins/php/curl/curl.test.js +564 -0
- package/dist/plugins/php/curl/curl.test.js.map +7 -0
- package/dist/plugins/php/curl/index.js +2 -1
- package/dist/plugins/php/curl/index.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.js +115 -148
- package/dist/plugins/php/guzzle/guzzle.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.test.js +546 -0
- package/dist/plugins/php/guzzle/guzzle.test.js.map +7 -0
- package/dist/plugins/php/guzzle/index.js +2 -1
- package/dist/plugins/php/guzzle/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/index.js +2 -1
- package/dist/plugins/powershell/restmethod/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/restmethod.js +12 -15
- package/dist/plugins/powershell/restmethod/restmethod.js.map +7 -0
- package/dist/plugins/powershell/webrequest/index.js +2 -1
- package/dist/plugins/powershell/webrequest/index.js.map +7 -0
- package/dist/plugins/powershell/webrequest/webrequest.js +12 -15
- package/dist/plugins/powershell/webrequest/webrequest.js.map +7 -0
- package/dist/plugins/python/python3/index.js +2 -1
- package/dist/plugins/python/python3/index.js.map +7 -0
- package/dist/plugins/python/python3/python3.js +12 -15
- package/dist/plugins/python/python3/python3.js.map +7 -0
- package/dist/plugins/python/requests/index.js +2 -1
- package/dist/plugins/python/requests/index.js.map +7 -0
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js +98 -126
- package/dist/plugins/python/requests/requests.js.map +7 -0
- package/dist/plugins/python/requests/requests.test.js +419 -0
- package/dist/plugins/python/requests/requests.test.js.map +7 -0
- package/dist/plugins/r/httr/httr.js +12 -15
- package/dist/plugins/r/httr/httr.js.map +7 -0
- package/dist/plugins/r/httr/index.js +2 -1
- package/dist/plugins/r/httr/index.js.map +7 -0
- package/dist/plugins/ruby/native/index.js +2 -1
- package/dist/plugins/ruby/native/index.js.map +7 -0
- package/dist/plugins/ruby/native/native.js +12 -15
- package/dist/plugins/ruby/native/native.js.map +7 -0
- package/dist/plugins/ruby/native/native.test.js +240 -0
- package/dist/plugins/ruby/native/native.test.js.map +7 -0
- package/dist/plugins/shell/curl/curl.js +81 -114
- package/dist/plugins/shell/curl/curl.js.map +7 -0
- package/dist/plugins/shell/curl/curl.test.js +427 -0
- package/dist/plugins/shell/curl/curl.test.js.map +7 -0
- package/dist/plugins/shell/curl/index.js +2 -1
- package/dist/plugins/shell/curl/index.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.js +12 -15
- package/dist/plugins/shell/httpie/httpie.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.test.js +113 -0
- package/dist/plugins/shell/httpie/httpie.test.js.map +7 -0
- package/dist/plugins/shell/httpie/index.js +2 -1
- package/dist/plugins/shell/httpie/index.js.map +7 -0
- package/dist/plugins/shell/wget/index.js +2 -1
- package/dist/plugins/shell/wget/index.js.map +7 -0
- package/dist/plugins/shell/wget/wget.js +12 -15
- package/dist/plugins/shell/wget/wget.js.map +7 -0
- package/dist/plugins/shell/wget/wget.test.js +143 -0
- package/dist/plugins/shell/wget/wget.test.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/index.js +2 -1
- package/dist/plugins/swift/nsurlsession/index.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js +344 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js.map +7 -0
- package/dist/snippetz.js +27 -27
- package/dist/snippetz.js.map +7 -0
- package/dist/snippetz.test.js +79 -0
- package/dist/snippetz.test.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.js +101 -104
- package/dist/utils/convertWithHttpSnippetLite.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js +106 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js.map +7 -0
- package/dist/utils/create-search-params.d.ts +4 -0
- package/dist/utils/create-search-params.d.ts.map +1 -0
- package/dist/utils/create-search-params.js +11 -0
- package/dist/utils/create-search-params.js.map +7 -0
- package/dist/utils/create-search-params.test.js +49 -0
- package/dist/utils/create-search-params.test.js.map +7 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/needsQuotes.js +5 -8
- package/dist/utils/needsQuotes.js.map +7 -0
- package/dist/utils/objectToString.d.ts +8 -0
- package/dist/utils/objectToString.d.ts.map +1 -1
- package/dist/utils/objectToString.js +48 -54
- package/dist/utils/objectToString.js.map +7 -0
- package/package.json +147 -151
- package/dist/utils/arrayToObject.d.ts +0 -8
- package/dist/utils/arrayToObject.d.ts.map +0 -1
- package/dist/utils/arrayToObject.js +0 -14
|
@@ -1,131 +1,160 @@
|
|
|
1
|
-
import { CodeBuilder } from
|
|
2
|
-
import { nsDeclaration } from
|
|
3
|
-
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
* HTTP code snippet generator for Objective-C using NSURLSession.
|
|
8
|
-
*
|
|
9
|
-
* @author
|
|
10
|
-
* @thibaultCha
|
|
11
|
-
*
|
|
12
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
13
|
-
*/
|
|
1
|
+
import { CodeBuilder } from "../../../helpers/code-builder.js";
|
|
2
|
+
import { nsDeclaration } from "../helpers.js";
|
|
14
3
|
const nsurlsession = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
4
|
+
info: {
|
|
5
|
+
key: "nsurlsession",
|
|
6
|
+
title: "NSURLSession",
|
|
7
|
+
link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
|
|
8
|
+
description: "Foundation's NSURLSession request"
|
|
9
|
+
},
|
|
10
|
+
convert: ({ allHeaders, postData, method, fullUrl }, options) => {
|
|
11
|
+
let _a;
|
|
12
|
+
const opts = {
|
|
13
|
+
indent: " ",
|
|
14
|
+
pretty: true,
|
|
15
|
+
timeout: 10,
|
|
16
|
+
...options
|
|
17
|
+
};
|
|
18
|
+
const { push, join, blank } = new CodeBuilder({ indent: opts.indent });
|
|
19
|
+
const req = {
|
|
20
|
+
hasHeaders: false,
|
|
21
|
+
hasBody: false
|
|
22
|
+
};
|
|
23
|
+
push("#import <Foundation/Foundation.h>");
|
|
24
|
+
if (Object.keys(allHeaders).length) {
|
|
25
|
+
req.hasHeaders = true;
|
|
26
|
+
blank();
|
|
27
|
+
push(nsDeclaration("NSDictionary", "headers", allHeaders, opts.pretty));
|
|
28
|
+
}
|
|
29
|
+
if (postData && (postData.text || postData.jsonObj || postData.params)) {
|
|
30
|
+
req.hasBody = true;
|
|
31
|
+
switch (postData.mimeType) {
|
|
32
|
+
case "application/x-www-form-urlencoded":
|
|
33
|
+
if ((_a = postData.params) === null || _a === void 0 ? void 0 : _a.length) {
|
|
39
34
|
blank();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
35
|
+
const [head, ...tail] = postData.params;
|
|
36
|
+
push(
|
|
37
|
+
`NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${head.name}=${head.value}" dataUsingEncoding:NSUTF8StringEncoding]];`
|
|
38
|
+
);
|
|
39
|
+
tail.forEach(({ name, value }) => {
|
|
40
|
+
push(
|
|
41
|
+
`[postData appendData:[@"&${name}=${value}" dataUsingEncoding:NSUTF8StringEncoding]];`
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
req.hasBody = false;
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case "application/json":
|
|
49
|
+
if (postData.jsonObj) {
|
|
50
|
+
push(
|
|
51
|
+
nsDeclaration(
|
|
52
|
+
"NSDictionary",
|
|
53
|
+
"parameters",
|
|
54
|
+
postData.jsonObj,
|
|
55
|
+
opts.pretty
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
blank();
|
|
59
|
+
push(
|
|
60
|
+
"NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case "multipart/form-data":
|
|
65
|
+
push(
|
|
66
|
+
nsDeclaration(
|
|
67
|
+
"NSArray",
|
|
68
|
+
"parameters",
|
|
69
|
+
postData.params || [],
|
|
70
|
+
opts.pretty
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
push(`NSString *boundary = @"${postData.boundary}";`);
|
|
74
|
+
blank();
|
|
75
|
+
push("NSError *error;");
|
|
76
|
+
push("NSMutableString *body = [NSMutableString string];");
|
|
77
|
+
push("for (NSDictionary *param in parameters) {");
|
|
78
|
+
push('[body appendFormat:@"--%@\\r\\n", boundary];', 1);
|
|
79
|
+
push('if (param[@"fileName"]) {', 1);
|
|
80
|
+
push(
|
|
81
|
+
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',
|
|
82
|
+
2
|
|
83
|
+
);
|
|
84
|
+
push(
|
|
85
|
+
'[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];',
|
|
86
|
+
2
|
|
87
|
+
);
|
|
88
|
+
push(
|
|
89
|
+
'[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',
|
|
90
|
+
2
|
|
91
|
+
);
|
|
92
|
+
push("if (error) {", 2);
|
|
93
|
+
push('NSLog(@"%@", error);', 3);
|
|
94
|
+
push("}", 2);
|
|
95
|
+
push("} else {", 1);
|
|
96
|
+
push(
|
|
97
|
+
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];',
|
|
98
|
+
2
|
|
99
|
+
);
|
|
100
|
+
push('[body appendFormat:@"%@", param[@"value"]];', 2);
|
|
101
|
+
push("}", 1);
|
|
102
|
+
push("}");
|
|
103
|
+
push('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];');
|
|
104
|
+
push(
|
|
105
|
+
"NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];"
|
|
106
|
+
);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
blank();
|
|
110
|
+
push(
|
|
111
|
+
`NSData *postData = [[NSData alloc] initWithData:[@"${postData.text}" dataUsingEncoding:NSUTF8StringEncoding]];`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
blank();
|
|
116
|
+
push(
|
|
117
|
+
`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${fullUrl}"]`
|
|
118
|
+
);
|
|
119
|
+
push(
|
|
120
|
+
" cachePolicy:NSURLRequestUseProtocolCachePolicy"
|
|
121
|
+
);
|
|
122
|
+
push(
|
|
123
|
+
` timeoutInterval:${opts.timeout.toFixed(1)}];`
|
|
124
|
+
);
|
|
125
|
+
push(`[request setHTTPMethod:@"${method}"];`);
|
|
126
|
+
if (req.hasHeaders) {
|
|
127
|
+
push("[request setAllHTTPHeaderFields:headers];");
|
|
128
|
+
}
|
|
129
|
+
if (req.hasBody) {
|
|
130
|
+
push("[request setHTTPBody:postData];");
|
|
131
|
+
}
|
|
132
|
+
blank();
|
|
133
|
+
push("NSURLSession *session = [NSURLSession sharedSession];");
|
|
134
|
+
push(
|
|
135
|
+
"NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"
|
|
136
|
+
);
|
|
137
|
+
push(
|
|
138
|
+
" completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"
|
|
139
|
+
);
|
|
140
|
+
push(" if (error) {", 1);
|
|
141
|
+
push(' NSLog(@"%@", error);', 2);
|
|
142
|
+
push(" } else {", 1);
|
|
143
|
+
push(
|
|
144
|
+
" NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",
|
|
145
|
+
2
|
|
146
|
+
);
|
|
147
|
+
push(
|
|
148
|
+
' NSLog(@"%@", httpResponse);',
|
|
149
|
+
2
|
|
150
|
+
);
|
|
151
|
+
push(" }", 1);
|
|
152
|
+
push(" }];");
|
|
153
|
+
push("[dataTask resume];");
|
|
154
|
+
return join();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
export {
|
|
158
|
+
nsurlsession
|
|
129
159
|
};
|
|
130
|
-
|
|
131
|
-
export { nsurlsession };
|
|
160
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/httpsnippet-lite/esm/targets/objc/nsurlsession/client.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\n/**\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 */\nimport { CodeBuilder } from '../../../helpers/code-builder.js'\nimport { nsDeclaration } from '../helpers.js'\n\nexport const nsurlsession = {\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 (\n (_a = postData.params) === null || _a === void 0\n ? void 0\n : _a.length\n ) {\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(\n `[postData appendData:[@\"&${name}=${value}\" dataUsingEncoding:NSUTF8StringEncoding]];`,\n )\n })\n } else {\n req.hasBody = false\n }\n break\n case 'application/json':\n if (postData.jsonObj) {\n push(\n nsDeclaration(\n 'NSDictionary',\n 'parameters',\n postData.jsonObj,\n opts.pretty,\n ),\n )\n blank()\n push(\n 'NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];',\n )\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(\n nsDeclaration(\n 'NSArray',\n 'parameters',\n postData.params || [],\n opts.pretty,\n ),\n )\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(\n '[body appendFormat:@\"Content-Type: %@\\\\r\\\\n\\\\r\\\\n\", param[@\"contentType\"]];',\n 2,\n )\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(\n '[body appendFormat:@\"Content-Disposition:form-data; name=\\\\\"%@\\\\\"\\\\r\\\\n\\\\r\\\\n\", param[@\"name\"]];',\n 2,\n )\n push('[body appendFormat:@\"%@\", param[@\"value\"]];', 2)\n push('}', 1)\n push('}')\n push('[body appendFormat:@\"\\\\r\\\\n--%@--\\\\r\\\\n\", boundary];')\n push(\n 'NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];',\n )\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(\n `NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@\"${fullUrl}\"]`,\n )\n // NSURLRequestUseProtocolCachePolicy is the default policy, let's just always set it to avoid confusion.\n push(\n ' cachePolicy:NSURLRequestUseProtocolCachePolicy',\n )\n push(\n ` timeoutInterval:${opts.timeout.toFixed(1)}];`,\n )\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(\n 'NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request',\n )\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(\n ' NSLog(@\"%@\", httpResponse);',\n 2,\n )\n push(' }', 1)\n push(' }];')\n push('[dataTask resume];')\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAEvB,MAAM,eAAe;AAAA,EAC1B,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,eACG,KAAK,SAAS,YAAY,QAAQ,OAAO,SACtC,SACA,GAAG,QACP;AAIA,kBAAM;AACN,kBAAM,CAAC,MAAM,GAAG,IAAI,IAAI,SAAS;AACjC;AAAA,cACE,oEAAoE,KAAK,IAAI,IAAI,KAAK,KAAK;AAAA,YAC7F;AACA,iBAAK,QAAQ,CAAC,EAAE,MAAM,MAAM,MAAM;AAChC;AAAA,gBACE,4BAA4B,IAAI,IAAI,KAAK;AAAA,cAC3C;AAAA,YACF,CAAC;AAAA,UACH,OAAO;AACL,gBAAI,UAAU;AAAA,UAChB;AACA;AAAA,QACF,KAAK;AACH,cAAI,SAAS,SAAS;AACpB;AAAA,cACE;AAAA,gBACE;AAAA,gBACA;AAAA,gBACA,SAAS;AAAA,gBACT,KAAK;AAAA,cACP;AAAA,YACF;AACA,kBAAM;AACN;AAAA,cACE;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF,KAAK;AAIH;AAAA,YACE;AAAA,cACE;AAAA,cACA;AAAA,cACA,SAAS,UAAU,CAAC;AAAA,cACpB,KAAK;AAAA,YACP;AAAA,UACF;AACA,eAAK,0BAA0B,SAAS,QAAQ,IAAI;AACpD,gBAAM;AACN,eAAK,iBAAiB;AACtB,eAAK,mDAAmD;AACxD,eAAK,2CAA2C;AAChD,eAAK,gDAAgD,CAAC;AACtD,eAAK,6BAA6B,CAAC;AACnC;AAAA,YACE;AAAA,YACA;AAAA,UACF;AACA;AAAA,YACE;AAAA,YACA;AAAA,UACF;AACA;AAAA,YACE;AAAA,YACA;AAAA,UACF;AACA,eAAK,gBAAgB,CAAC;AACtB,eAAK,wBAAwB,CAAC;AAC9B,eAAK,KAAK,CAAC;AACX,eAAK,YAAY,CAAC;AAClB;AAAA,YACE;AAAA,YACA;AAAA,UACF;AACA,eAAK,+CAA+C,CAAC;AACrD,eAAK,KAAK,CAAC;AACX,eAAK,GAAG;AACR,eAAK,sDAAsD;AAC3D;AAAA,YACE;AAAA,UACF;AACA;AAAA,QACF;AACE,gBAAM;AACN;AAAA,YACE,sDAAsD,SAAS,IAAI;AAAA,UACrE;AAAA,MACJ;AAAA,IACF;AACA,UAAM;AACN;AAAA,MACE,6FAA6F,OAAO;AAAA,IACtG;AAEA;AAAA,MACE;AAAA,IACF;AACA;AAAA,MACE,sEAAsE,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAAA,IAC/F;AACA,SAAK,4BAA4B,MAAM,KAAK;AAC5C,QAAI,IAAI,YAAY;AAClB,WAAK,2CAA2C;AAAA,IAClD;AACA,QAAI,IAAI,SAAS;AACf,WAAK,iCAAiC;AAAA,IACxC;AACA,UAAM;AAEN,SAAK,uDAAuD;AAC5D;AAAA,MACE;AAAA,IACF;AACA;AAAA,MACE;AAAA,IACF;AACA,SAAK,4DAA4D,CAAC;AAClE,SAAK,oEAAoE,CAAC;AAC1E,SAAK,wDAAwD,CAAC;AAE9D;AAAA,MACE;AAAA,MACA;AAAA,IACF;AACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AACA,SAAK,iDAAiD,CAAC;AACvD,SAAK,iDAAiD;AACtD,SAAK,oBAAoB;AACzB,WAAO,KAAK;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { nsurlsession } from "./nsurlsession/client.js";
|
|
2
|
+
const objc = {
|
|
3
|
+
info: {
|
|
4
|
+
key: "objc",
|
|
5
|
+
title: "Objective-C",
|
|
6
|
+
extname: ".m",
|
|
7
|
+
default: "nsurlsession"
|
|
8
|
+
},
|
|
9
|
+
clientsById: {
|
|
10
|
+
nsurlsession
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
objc
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/esm/targets/objc/target.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\nimport { nsurlsession } from './nsurlsession/client.js'\n\nexport const objc = {\n info: {\n key: 'objc',\n title: 'Objective-C',\n extname: '.m',\n default: 'nsurlsession',\n },\n clientsById: {\n nsurlsession,\n },\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,oBAAoB;AAEtB,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,aAAa;AAAA,IACX;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,67 +1,52 @@
|
|
|
1
|
-
import { CodeBuilder } from
|
|
2
|
-
import { escapeForDoubleQuotes } from
|
|
3
|
-
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
* HTTP code snippet generator for OCaml using CoHTTP.
|
|
8
|
-
*
|
|
9
|
-
* @author
|
|
10
|
-
* @SGrondin
|
|
11
|
-
*
|
|
12
|
-
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
|
|
13
|
-
*/
|
|
1
|
+
import { CodeBuilder } from "../../../helpers/code-builder.js";
|
|
2
|
+
import { escapeForDoubleQuotes } from "../../../helpers/escape.js";
|
|
14
3
|
const cohttp = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
push(`Client.call ${h}${b}${m} uri`);
|
|
60
|
-
// Catch result
|
|
61
|
-
push('>>= fun (res, body_stream) ->');
|
|
62
|
-
push('(* Do stuff with the result *)', 1);
|
|
63
|
-
return join();
|
|
64
|
-
},
|
|
4
|
+
info: {
|
|
5
|
+
key: "cohttp",
|
|
6
|
+
title: "CoHTTP",
|
|
7
|
+
link: "https://github.com/mirage/ocaml-cohttp",
|
|
8
|
+
description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml"
|
|
9
|
+
},
|
|
10
|
+
convert: ({ fullUrl, allHeaders, postData, method }, options) => {
|
|
11
|
+
const opts = {
|
|
12
|
+
indent: " ",
|
|
13
|
+
...options
|
|
14
|
+
};
|
|
15
|
+
const methods = ["get", "post", "head", "delete", "patch", "put", "options"];
|
|
16
|
+
const { push, blank, join } = new CodeBuilder({ indent: opts.indent });
|
|
17
|
+
push("open Cohttp_lwt_unix");
|
|
18
|
+
push("open Cohttp");
|
|
19
|
+
push("open Lwt");
|
|
20
|
+
blank();
|
|
21
|
+
push(`let uri = Uri.of_string "${fullUrl}" in`);
|
|
22
|
+
const headers = Object.keys(allHeaders);
|
|
23
|
+
if (headers.length === 1) {
|
|
24
|
+
push(
|
|
25
|
+
`let headers = Header.add (Header.init ()) "${headers[0]}" "${escapeForDoubleQuotes(allHeaders[headers[0]])}" in`
|
|
26
|
+
);
|
|
27
|
+
} else if (headers.length > 1) {
|
|
28
|
+
push("let headers = Header.add_list (Header.init ()) [");
|
|
29
|
+
headers.forEach((key) => {
|
|
30
|
+
push(`("${key}", "${escapeForDoubleQuotes(allHeaders[key])}");`, 1);
|
|
31
|
+
});
|
|
32
|
+
push("] in");
|
|
33
|
+
}
|
|
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
|
+
);
|
|
38
|
+
}
|
|
39
|
+
blank();
|
|
40
|
+
const h = headers.length ? "~headers " : "";
|
|
41
|
+
const b = (postData === null || postData === void 0 ? void 0 : postData.text) ? "~body " : "";
|
|
42
|
+
const m = methods.includes(method.toLowerCase()) ? `\`${method.toUpperCase()}` : `(Code.method_of_string "${method}")`;
|
|
43
|
+
push(`Client.call ${h}${b}${m} uri`);
|
|
44
|
+
push(">>= fun (res, body_stream) ->");
|
|
45
|
+
push("(* Do stuff with the result *)", 1);
|
|
46
|
+
return join();
|
|
47
|
+
}
|
|
65
48
|
};
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
export {
|
|
50
|
+
cohttp
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/httpsnippet-lite/esm/targets/ocaml/cohttp/client.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\n/**\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 '../../../helpers/code-builder.js'\nimport { escapeForDoubleQuotes } from '../../../helpers/escape.js'\n\nexport const cohttp = {\n info: {\n key: 'cohttp',\n title: 'CoHTTP',\n link: 'https://github.com/mirage/ocaml-cohttp',\n description:\n '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]])}\" 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])}\");`, 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(\n `let body = Cohttp_lwt_body.of_string ${JSON.stringify(postData.text)} in`,\n )\n }\n // Do the request\n blank()\n const h = headers.length ? '~headers ' : ''\n const b = (\n postData === null || postData === void 0 ? void 0 : postData.text\n )\n ? '~body '\n : ''\n const m = methods.includes(method.toLowerCase())\n ? `\\`${method.toUpperCase()}`\n : `(Code.method_of_string \"${method}\")`\n push(`Client.call ${h}${b}${m} uri`)\n // Catch result\n push('>>= fun (res, body_stream) ->')\n push('(* Do stuff with the result *)', 1)\n return join()\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAE/B,MAAM,SAAS;AAAA,EACpB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,SAAS,CAAC,EAAE,SAAS,YAAY,UAAU,OAAO,GAAG,YAAY;AAC/D,UAAM,OAAO;AAAA,MACX,QAAQ;AAAA,MACR,GAAG;AAAA,IACL;AACA,UAAM,UAAU,CAAC,OAAO,QAAQ,QAAQ,UAAU,SAAS,OAAO,SAAS;AAC3E,UAAM,EAAE,MAAM,OAAO,KAAK,IAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,OAAO,CAAC;AACrE,SAAK,sBAAsB;AAC3B,SAAK,aAAa;AAClB,SAAK,UAAU;AACf,UAAM;AACN,SAAK,4BAA4B,OAAO,MAAM;AAE9C,UAAM,UAAU,OAAO,KAAK,UAAU;AACtC,QAAI,QAAQ,WAAW,GAAG;AACxB;AAAA,QACE,8CAA8C,QAAQ,CAAC,CAAC,MAAM,sBAAsB,WAAW,QAAQ,CAAC,CAAC,CAAC,CAAC;AAAA,MAC7G;AAAA,IACF,WAAW,QAAQ,SAAS,GAAG;AAC7B,WAAK,kDAAkD;AACvD,cAAQ,QAAQ,CAAC,QAAQ;AACvB,aAAK,KAAK,GAAG,OAAO,sBAAsB,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC;AAAA,MACpE,CAAC;AACD,WAAK,MAAM;AAAA,IACb;AAEA,QAAI,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,MAAM;AAErE;AAAA,QACE,wCAAwC,KAAK,UAAU,SAAS,IAAI,CAAC;AAAA,MACvE;AAAA,IACF;AAEA,UAAM;AACN,UAAM,IAAI,QAAQ,SAAS,cAAc;AACzC,UAAM,KACJ,aAAa,QAAQ,aAAa,SAAS,SAAS,SAAS,QAE3D,WACA;AACJ,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,16 @@
|
|
|
1
|
+
import { cohttp } from "./cohttp/client.js";
|
|
2
|
+
const ocaml = {
|
|
3
|
+
info: {
|
|
4
|
+
key: "ocaml",
|
|
5
|
+
title: "OCaml",
|
|
6
|
+
extname: ".ml",
|
|
7
|
+
default: "cohttp"
|
|
8
|
+
},
|
|
9
|
+
clientsById: {
|
|
10
|
+
cohttp
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
ocaml
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/esm/targets/ocaml/target.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\nimport { cohttp } from './cohttp/client.js'\n\nexport const ocaml = {\n info: {\n key: 'ocaml',\n title: 'OCaml',\n extname: '.ml',\n default: 'cohttp',\n },\n clientsById: {\n cohttp,\n },\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,cAAc;AAEhB,MAAM,QAAQ;AAAA,EACnB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,aAAa;AAAA,IACX;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { escapeString } from "../../helpers/escape.js";
|
|
2
|
+
const convertType = (obj, indent, lastIndent) => {
|
|
3
|
+
lastIndent = lastIndent || "";
|
|
4
|
+
indent = indent || "";
|
|
5
|
+
switch (Object.prototype.toString.call(obj)) {
|
|
6
|
+
case "[object Null]":
|
|
7
|
+
return "null";
|
|
8
|
+
case "[object Undefined]":
|
|
9
|
+
return "null";
|
|
10
|
+
case "[object String]":
|
|
11
|
+
return `'${escapeString(obj, { delimiter: "'", escapeNewlines: false })}'`;
|
|
12
|
+
case "[object Number]":
|
|
13
|
+
return obj.toString();
|
|
14
|
+
case "[object Array]": {
|
|
15
|
+
const contents = obj.map((item) => convertType(item, `${indent}${indent}`, indent)).join(`,
|
|
16
|
+
${indent}`);
|
|
17
|
+
return `[
|
|
18
|
+
${indent}${contents}
|
|
19
|
+
${lastIndent}]`;
|
|
20
|
+
}
|
|
21
|
+
case "[object Object]": {
|
|
22
|
+
const result = [];
|
|
23
|
+
for (const i in obj) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
25
|
+
result.push(
|
|
26
|
+
`${convertType(i, indent)} => ${convertType(obj[i], `${indent}${indent}`, indent)}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return `[
|
|
31
|
+
${indent}${result.join(`,
|
|
32
|
+
${indent}`)}
|
|
33
|
+
${lastIndent}]`;
|
|
34
|
+
}
|
|
35
|
+
default:
|
|
36
|
+
return "null";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const supportedMethods = [
|
|
40
|
+
"ACL",
|
|
41
|
+
"BASELINE_CONTROL",
|
|
42
|
+
"CHECKIN",
|
|
43
|
+
"CHECKOUT",
|
|
44
|
+
"CONNECT",
|
|
45
|
+
"COPY",
|
|
46
|
+
"DELETE",
|
|
47
|
+
"GET",
|
|
48
|
+
"HEAD",
|
|
49
|
+
"LABEL",
|
|
50
|
+
"LOCK",
|
|
51
|
+
"MERGE",
|
|
52
|
+
"MKACTIVITY",
|
|
53
|
+
"MKCOL",
|
|
54
|
+
"MKWORKSPACE",
|
|
55
|
+
"MOVE",
|
|
56
|
+
"OPTIONS",
|
|
57
|
+
"POST",
|
|
58
|
+
"PROPFIND",
|
|
59
|
+
"PROPPATCH",
|
|
60
|
+
"PUT",
|
|
61
|
+
"REPORT",
|
|
62
|
+
"TRACE",
|
|
63
|
+
"UNCHECKOUT",
|
|
64
|
+
"UNLOCK",
|
|
65
|
+
"UPDATE",
|
|
66
|
+
"VERSION_CONTROL"
|
|
67
|
+
];
|
|
68
|
+
export {
|
|
69
|
+
convertType,
|
|
70
|
+
supportedMethods
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/httpsnippet-lite/esm/targets/php/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\nimport { escapeString } from '../../helpers/escape.js'\n\nexport const convertType = (obj, indent, lastIndent) => {\n lastIndent = lastIndent || ''\n indent = indent || ''\n switch (Object.prototype.toString.call(obj)) {\n case '[object Null]':\n return 'null'\n case '[object Undefined]':\n return 'null'\n case '[object String]':\n return `'${escapeString(obj, { delimiter: \"'\", escapeNewlines: false })}'`\n case '[object Number]':\n return obj.toString()\n case '[object Array]': {\n const contents = obj\n .map((item) => convertType(item, `${indent}${indent}`, indent))\n .join(`,\\n${indent}`)\n return `[\\n${indent}${contents}\\n${lastIndent}]`\n }\n case '[object Object]': {\n const result = []\n for (const i in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, i)) {\n result.push(\n `${convertType(i, indent)} => ${convertType(obj[i], `${indent}${indent}`, indent)}`,\n )\n }\n }\n return `[\\n${indent}${result.join(`,\\n${indent}`)}\\n${lastIndent}]`\n }\n default:\n return 'null'\n }\n}\nexport const supportedMethods = [\n 'ACL',\n 'BASELINE_CONTROL',\n 'CHECKIN',\n 'CHECKOUT',\n 'CONNECT',\n 'COPY',\n 'DELETE',\n 'GET',\n 'HEAD',\n 'LABEL',\n 'LOCK',\n 'MERGE',\n 'MKACTIVITY',\n 'MKCOL',\n 'MKWORKSPACE',\n 'MOVE',\n 'OPTIONS',\n 'POST',\n 'PROPFIND',\n 'PROPPATCH',\n 'PUT',\n 'REPORT',\n 'TRACE',\n 'UNCHECKOUT',\n 'UNLOCK',\n 'UPDATE',\n 'VERSION_CONTROL',\n]\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,oBAAoB;AAEtB,MAAM,cAAc,CAAC,KAAK,QAAQ,eAAe;AACtD,eAAa,cAAc;AAC3B,WAAS,UAAU;AACnB,UAAQ,OAAO,UAAU,SAAS,KAAK,GAAG,GAAG;AAAA,IAC3C,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,IAAI,aAAa,KAAK,EAAE,WAAW,KAAK,gBAAgB,MAAM,CAAC,CAAC;AAAA,IACzE,KAAK;AACH,aAAO,IAAI,SAAS;AAAA,IACtB,KAAK,kBAAkB;AACrB,YAAM,WAAW,IACd,IAAI,CAAC,SAAS,YAAY,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,EAC7D,KAAK;AAAA,EAAM,MAAM,EAAE;AACtB,aAAO;AAAA,EAAM,MAAM,GAAG,QAAQ;AAAA,EAAK,UAAU;AAAA,IAC/C;AAAA,IACA,KAAK,mBAAmB;AACtB,YAAM,SAAS,CAAC;AAChB,iBAAW,KAAK,KAAK;AACnB,YAAI,OAAO,UAAU,eAAe,KAAK,KAAK,CAAC,GAAG;AAChD,iBAAO;AAAA,YACL,GAAG,YAAY,GAAG,MAAM,CAAC,OAAO,YAAY,IAAI,CAAC,GAAG,GAAG,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC;AAAA,UACnF;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,EAAM,MAAM,GAAG,OAAO,KAAK;AAAA,EAAM,MAAM,EAAE,CAAC;AAAA,EAAK,UAAU;AAAA,IAClE;AAAA,IACA;AACE,aAAO;AAAA,EACX;AACF;AACO,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|