@scalar/snippetz 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/dist/clients.d.ts +6 -0
  2. package/dist/clients.d.ts.map +1 -0
  3. package/dist/clients.js +150 -0
  4. package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts +8 -0
  5. package/dist/httpsnippet-lite/esm/helpers/code-builder.d.ts.map +1 -0
  6. package/dist/httpsnippet-lite/esm/helpers/code-builder.js +62 -0
  7. package/dist/httpsnippet-lite/esm/helpers/escape.d.ts +29 -0
  8. package/dist/httpsnippet-lite/esm/helpers/escape.d.ts.map +1 -0
  9. package/dist/httpsnippet-lite/esm/helpers/escape.js +74 -0
  10. package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts +3 -0
  11. package/dist/httpsnippet-lite/esm/helpers/form-data.d.ts.map +1 -0
  12. package/dist/httpsnippet-lite/esm/helpers/headers.d.ts +17 -0
  13. package/dist/httpsnippet-lite/esm/helpers/headers.d.ts.map +1 -0
  14. package/dist/httpsnippet-lite/esm/helpers/headers.js +22 -0
  15. package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts +2 -0
  16. package/dist/httpsnippet-lite/esm/helpers/reducer.d.ts.map +1 -0
  17. package/dist/httpsnippet-lite/esm/helpers/shell.d.ts +7 -0
  18. package/dist/httpsnippet-lite/esm/helpers/shell.d.ts.map +1 -0
  19. package/dist/httpsnippet-lite/esm/helpers/shell.js +18 -0
  20. package/dist/httpsnippet-lite/esm/helpers/url.d.ts +5 -0
  21. package/dist/httpsnippet-lite/esm/helpers/url.d.ts.map +1 -0
  22. package/dist/httpsnippet-lite/esm/helpers/utils.d.ts +3 -0
  23. package/dist/httpsnippet-lite/esm/helpers/utils.d.ts.map +1 -0
  24. package/dist/httpsnippet-lite/esm/httpsnippet.d.ts +10 -0
  25. package/dist/httpsnippet-lite/esm/httpsnippet.d.ts.map +1 -0
  26. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts +16 -0
  27. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -0
  28. package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +45 -0
  29. package/dist/httpsnippet-lite/esm/targets/c/target.d.ts +26 -0
  30. package/dist/httpsnippet-lite/esm/targets/c/target.d.ts.map +1 -0
  31. package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts +16 -0
  32. package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.d.ts.map +1 -0
  33. package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +189 -0
  34. package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts +26 -0
  35. package/dist/httpsnippet-lite/esm/targets/clojure/target.d.ts.map +1 -0
  36. package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts +15 -0
  37. package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.d.ts.map +1 -0
  38. package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +169 -0
  39. package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts +17 -0
  40. package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.d.ts.map +1 -0
  41. package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +49 -0
  42. package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts +41 -0
  43. package/dist/httpsnippet-lite/esm/targets/csharp/target.d.ts.map +1 -0
  44. package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts +15 -0
  45. package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -0
  46. package/dist/httpsnippet-lite/esm/targets/go/native/client.js +124 -0
  47. package/dist/httpsnippet-lite/esm/targets/go/target.d.ts +25 -0
  48. package/dist/httpsnippet-lite/esm/targets/go/target.d.ts.map +1 -0
  49. package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts +22 -0
  50. package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.d.ts.map +1 -0
  51. package/dist/httpsnippet-lite/esm/targets/http/http1.1/client.js +77 -0
  52. package/dist/httpsnippet-lite/esm/targets/http/target.d.ts +27 -0
  53. package/dist/httpsnippet-lite/esm/targets/http/target.d.ts.map +1 -0
  54. package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts +15 -0
  55. package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.d.ts.map +1 -0
  56. package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +47 -0
  57. package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts +15 -0
  58. package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.d.ts.map +1 -0
  59. package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +46 -0
  60. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts +15 -0
  61. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -0
  62. package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +73 -0
  63. package/dist/httpsnippet-lite/esm/targets/java/target.d.ts +67 -0
  64. package/dist/httpsnippet-lite/esm/targets/java/target.d.ts.map +1 -0
  65. package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts +15 -0
  66. package/dist/httpsnippet-lite/esm/targets/java/unirest/client.d.ts.map +1 -0
  67. package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +47 -0
  68. package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts +16 -0
  69. package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.d.ts.map +1 -0
  70. package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +91 -0
  71. package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts +15 -0
  72. package/dist/httpsnippet-lite/esm/targets/javascript/fetch/client.d.ts.map +1 -0
  73. package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts +15 -0
  74. package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.d.ts.map +1 -0
  75. package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +88 -0
  76. package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts +68 -0
  77. package/dist/httpsnippet-lite/esm/targets/javascript/target.d.ts.map +1 -0
  78. package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts +15 -0
  79. package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.d.ts.map +1 -0
  80. package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +86 -0
  81. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts +15 -0
  82. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -0
  83. package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +73 -0
  84. package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts +25 -0
  85. package/dist/httpsnippet-lite/esm/targets/kotlin/target.d.ts.map +1 -0
  86. package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts +16 -0
  87. package/dist/httpsnippet-lite/esm/targets/node/axios/client.d.ts.map +1 -0
  88. package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +83 -0
  89. package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts +16 -0
  90. package/dist/httpsnippet-lite/esm/targets/node/fetch/client.d.ts.map +1 -0
  91. package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts +15 -0
  92. package/dist/httpsnippet-lite/esm/targets/node/native/client.d.ts.map +1 -0
  93. package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts +17 -0
  94. package/dist/httpsnippet-lite/esm/targets/node/request/client.d.ts.map +1 -0
  95. package/dist/httpsnippet-lite/esm/targets/node/target.d.ts +87 -0
  96. package/dist/httpsnippet-lite/esm/targets/node/target.d.ts.map +1 -0
  97. package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts +17 -0
  98. package/dist/httpsnippet-lite/esm/targets/node/unirest/client.d.ts.map +1 -0
  99. package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts +27 -0
  100. package/dist/httpsnippet-lite/esm/targets/objc/helpers.d.ts.map +1 -0
  101. package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +58 -0
  102. package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts +15 -0
  103. package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.d.ts.map +1 -0
  104. package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +132 -0
  105. package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts +25 -0
  106. package/dist/httpsnippet-lite/esm/targets/objc/target.d.ts.map +1 -0
  107. package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts +15 -0
  108. package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.d.ts.map +1 -0
  109. package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +68 -0
  110. package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts +25 -0
  111. package/dist/httpsnippet-lite/esm/targets/ocaml/target.d.ts.map +1 -0
  112. package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts +18 -0
  113. package/dist/httpsnippet-lite/esm/targets/php/curl/client.d.ts.map +1 -0
  114. package/dist/httpsnippet-lite/esm/targets/php/curl/client.js +134 -0
  115. package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts +16 -0
  116. package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.d.ts.map +1 -0
  117. package/dist/httpsnippet-lite/esm/targets/php/guzzle/client.js +126 -0
  118. package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts +3 -0
  119. package/dist/httpsnippet-lite/esm/targets/php/helpers.d.ts.map +1 -0
  120. package/dist/httpsnippet-lite/esm/targets/php/helpers.js +37 -0
  121. package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts +17 -0
  122. package/dist/httpsnippet-lite/esm/targets/php/http1/client.d.ts.map +1 -0
  123. package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts +17 -0
  124. package/dist/httpsnippet-lite/esm/targets/php/http2/client.d.ts.map +1 -0
  125. package/dist/httpsnippet-lite/esm/targets/php/target.d.ts +75 -0
  126. package/dist/httpsnippet-lite/esm/targets/php/target.d.ts.map +1 -0
  127. package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts +10 -0
  128. package/dist/httpsnippet-lite/esm/targets/powershell/common.d.ts.map +1 -0
  129. package/dist/httpsnippet-lite/esm/targets/powershell/common.js +53 -0
  130. package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts +18 -0
  131. package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.d.ts.map +1 -0
  132. package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +15 -0
  133. package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts +45 -0
  134. package/dist/httpsnippet-lite/esm/targets/powershell/target.d.ts.map +1 -0
  135. package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts +18 -0
  136. package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.d.ts.map +1 -0
  137. package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +15 -0
  138. package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts +9 -0
  139. package/dist/httpsnippet-lite/esm/targets/python/helpers.d.ts.map +1 -0
  140. package/dist/httpsnippet-lite/esm/targets/python/helpers.js +63 -0
  141. package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts +19 -0
  142. package/dist/httpsnippet-lite/esm/targets/python/python3/client.d.ts.map +1 -0
  143. package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +95 -0
  144. package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts +16 -0
  145. package/dist/httpsnippet-lite/esm/targets/python/requests/client.d.ts.map +1 -0
  146. package/dist/httpsnippet-lite/esm/targets/python/requests/client.js +177 -0
  147. package/dist/httpsnippet-lite/esm/targets/python/target.d.ts +44 -0
  148. package/dist/httpsnippet-lite/esm/targets/python/target.d.ts.map +1 -0
  149. package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts +17 -0
  150. package/dist/httpsnippet-lite/esm/targets/r/httr/client.d.ts.map +1 -0
  151. package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +127 -0
  152. package/dist/httpsnippet-lite/esm/targets/r/target.d.ts +27 -0
  153. package/dist/httpsnippet-lite/esm/targets/r/target.d.ts.map +1 -0
  154. package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts +16 -0
  155. package/dist/httpsnippet-lite/esm/targets/ruby/native/client.d.ts.map +1 -0
  156. package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +72 -0
  157. package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts +26 -0
  158. package/dist/httpsnippet-lite/esm/targets/ruby/target.d.ts.map +1 -0
  159. package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts +17 -0
  160. package/dist/httpsnippet-lite/esm/targets/shell/curl/client.d.ts.map +1 -0
  161. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts +17 -0
  162. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -0
  163. package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +118 -0
  164. package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts +57 -0
  165. package/dist/httpsnippet-lite/esm/targets/shell/target.d.ts.map +1 -0
  166. package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts +15 -0
  167. package/dist/httpsnippet-lite/esm/targets/shell/wget/client.d.ts.map +1 -0
  168. package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +54 -0
  169. package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts +17 -0
  170. package/dist/httpsnippet-lite/esm/targets/swift/helpers.d.ts.map +1 -0
  171. package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +76 -0
  172. package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts +15 -0
  173. package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.d.ts.map +1 -0
  174. package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +137 -0
  175. package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts +25 -0
  176. package/dist/httpsnippet-lite/esm/targets/swift/target.d.ts.map +1 -0
  177. package/dist/httpsnippet-lite/esm/targets/targets.d.ts +731 -0
  178. package/dist/httpsnippet-lite/esm/targets/targets.d.ts.map +1 -0
  179. package/dist/index.d.ts +1 -1
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/plugins/c/libcurl/libcurl.d.ts +1 -1
  182. package/dist/plugins/c/libcurl/libcurl.d.ts.map +1 -1
  183. package/dist/plugins/c/libcurl/libcurl.js +3 -2
  184. package/dist/plugins/clojure/clj_http/clj_http.d.ts +1 -1
  185. package/dist/plugins/clojure/clj_http/clj_http.d.ts.map +1 -1
  186. package/dist/plugins/clojure/clj_http/clj_http.js +3 -2
  187. package/dist/plugins/csharp/httpclient/httpclient.d.ts +1 -1
  188. package/dist/plugins/csharp/httpclient/httpclient.d.ts.map +1 -1
  189. package/dist/plugins/csharp/httpclient/httpclient.js +3 -2
  190. package/dist/plugins/csharp/restsharp/restsharp.d.ts +1 -1
  191. package/dist/plugins/csharp/restsharp/restsharp.d.ts.map +1 -1
  192. package/dist/plugins/csharp/restsharp/restsharp.js +3 -2
  193. package/dist/plugins/go/native/native.d.ts +1 -1
  194. package/dist/plugins/go/native/native.d.ts.map +1 -1
  195. package/dist/plugins/go/native/native.js +3 -2
  196. package/dist/plugins/http/http11/http11.d.ts +1 -1
  197. package/dist/plugins/http/http11/http11.d.ts.map +1 -1
  198. package/dist/plugins/http/http11/http11.js +3 -2
  199. package/dist/plugins/java/asynchttp/asynchttp.d.ts +1 -1
  200. package/dist/plugins/java/asynchttp/asynchttp.d.ts.map +1 -1
  201. package/dist/plugins/java/asynchttp/asynchttp.js +3 -2
  202. package/dist/plugins/java/nethttp/nethttp.d.ts +1 -1
  203. package/dist/plugins/java/nethttp/nethttp.d.ts.map +1 -1
  204. package/dist/plugins/java/nethttp/nethttp.js +3 -2
  205. package/dist/plugins/java/okhttp/okhttp.d.ts +1 -1
  206. package/dist/plugins/java/okhttp/okhttp.d.ts.map +1 -1
  207. package/dist/plugins/java/okhttp/okhttp.js +3 -2
  208. package/dist/plugins/java/unirest/unirest.d.ts +1 -1
  209. package/dist/plugins/java/unirest/unirest.d.ts.map +1 -1
  210. package/dist/plugins/java/unirest/unirest.js +3 -2
  211. package/dist/plugins/js/axios/axios.d.ts +1 -1
  212. package/dist/plugins/js/axios/axios.d.ts.map +1 -1
  213. package/dist/plugins/js/axios/axios.js +3 -2
  214. package/dist/plugins/js/fetch/fetch.d.ts +1 -1
  215. package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
  216. package/dist/plugins/js/fetch/fetch.js +3 -2
  217. package/dist/plugins/js/jquery/jquery.d.ts +1 -1
  218. package/dist/plugins/js/jquery/jquery.d.ts.map +1 -1
  219. package/dist/plugins/js/jquery/jquery.js +3 -2
  220. package/dist/plugins/js/ofetch/ofetch.d.ts +1 -1
  221. package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
  222. package/dist/plugins/js/ofetch/ofetch.js +3 -2
  223. package/dist/plugins/js/xhr/xhr.d.ts +1 -1
  224. package/dist/plugins/js/xhr/xhr.d.ts.map +1 -1
  225. package/dist/plugins/js/xhr/xhr.js +3 -2
  226. package/dist/plugins/kotlin/okhttp/okhttp.d.ts +1 -1
  227. package/dist/plugins/kotlin/okhttp/okhttp.d.ts.map +1 -1
  228. package/dist/plugins/kotlin/okhttp/okhttp.js +3 -2
  229. package/dist/plugins/node/axios/axios.d.ts +1 -1
  230. package/dist/plugins/node/axios/axios.d.ts.map +1 -1
  231. package/dist/plugins/node/axios/axios.js +3 -2
  232. package/dist/plugins/node/fetch/fetch.d.ts +1 -1
  233. package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
  234. package/dist/plugins/node/fetch/fetch.js +3 -2
  235. package/dist/plugins/node/ofetch/ofetch.d.ts +1 -1
  236. package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
  237. package/dist/plugins/node/ofetch/ofetch.js +3 -2
  238. package/dist/plugins/node/undici/undici.d.ts +1 -1
  239. package/dist/plugins/node/undici/undici.d.ts.map +1 -1
  240. package/dist/plugins/node/undici/undici.js +3 -2
  241. package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts +1 -1
  242. package/dist/plugins/objc/nsurlsession/nsurlsession.d.ts.map +1 -1
  243. package/dist/plugins/objc/nsurlsession/nsurlsession.js +3 -2
  244. package/dist/plugins/ocaml/cohttp/cohttp.d.ts +1 -1
  245. package/dist/plugins/ocaml/cohttp/cohttp.d.ts.map +1 -1
  246. package/dist/plugins/ocaml/cohttp/cohttp.js +3 -2
  247. package/dist/plugins/php/curl/curl.d.ts +1 -1
  248. package/dist/plugins/php/curl/curl.d.ts.map +1 -1
  249. package/dist/plugins/php/curl/curl.js +3 -2
  250. package/dist/plugins/php/guzzle/guzzle.d.ts +1 -1
  251. package/dist/plugins/php/guzzle/guzzle.d.ts.map +1 -1
  252. package/dist/plugins/php/guzzle/guzzle.js +3 -2
  253. package/dist/plugins/powershell/restmethod/restmethod.d.ts +1 -1
  254. package/dist/plugins/powershell/restmethod/restmethod.d.ts.map +1 -1
  255. package/dist/plugins/powershell/restmethod/restmethod.js +3 -2
  256. package/dist/plugins/powershell/webrequest/webrequest.d.ts +1 -1
  257. package/dist/plugins/powershell/webrequest/webrequest.d.ts.map +1 -1
  258. package/dist/plugins/powershell/webrequest/webrequest.js +3 -2
  259. package/dist/plugins/python/python3/python3.d.ts +1 -1
  260. package/dist/plugins/python/python3/python3.d.ts.map +1 -1
  261. package/dist/plugins/python/python3/python3.js +3 -2
  262. package/dist/plugins/python/requests/requests.d.ts +1 -1
  263. package/dist/plugins/python/requests/requests.d.ts.map +1 -1
  264. package/dist/plugins/python/requests/requests.js +3 -2
  265. package/dist/plugins/r/httr/httr.d.ts +1 -1
  266. package/dist/plugins/r/httr/httr.d.ts.map +1 -1
  267. package/dist/plugins/r/httr/httr.js +3 -2
  268. package/dist/plugins/ruby/native/native.d.ts +1 -1
  269. package/dist/plugins/ruby/native/native.d.ts.map +1 -1
  270. package/dist/plugins/ruby/native/native.js +3 -2
  271. package/dist/plugins/shell/curl/curl.d.ts +1 -1
  272. package/dist/plugins/shell/curl/curl.d.ts.map +1 -1
  273. package/dist/plugins/shell/curl/curl.js +1 -0
  274. package/dist/plugins/shell/httpie/httpie.d.ts +1 -1
  275. package/dist/plugins/shell/httpie/httpie.d.ts.map +1 -1
  276. package/dist/plugins/shell/httpie/httpie.js +3 -2
  277. package/dist/plugins/shell/wget/wget.d.ts +1 -1
  278. package/dist/plugins/shell/wget/wget.d.ts.map +1 -1
  279. package/dist/plugins/shell/wget/wget.js +3 -2
  280. package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts +1 -1
  281. package/dist/plugins/swift/nsurlsession/nsurlsession.d.ts.map +1 -1
  282. package/dist/plugins/swift/nsurlsession/nsurlsession.js +3 -2
  283. package/dist/snippetz.d.ts +4 -6
  284. package/dist/snippetz.d.ts.map +1 -1
  285. package/dist/snippetz.js +10 -91
  286. package/dist/{core/types.d.ts → types/index.d.ts} +15 -4
  287. package/dist/types/index.d.ts.map +1 -0
  288. package/dist/types/index.js +1 -0
  289. package/dist/types/index.test-d.d.ts +2 -0
  290. package/dist/types/index.test-d.d.ts.map +1 -0
  291. package/dist/utils/arrayToObject.d.ts.map +1 -0
  292. package/dist/utils/convertWithHttpSnippetLite.d.ts +6 -0
  293. package/dist/utils/convertWithHttpSnippetLite.d.ts.map +1 -0
  294. package/dist/utils/convertWithHttpSnippetLite.js +95 -0
  295. package/dist/utils/index.d.ts +5 -0
  296. package/dist/utils/index.d.ts.map +1 -0
  297. package/dist/utils/index.js +4 -0
  298. package/dist/utils/needsQuotes.d.ts.map +1 -0
  299. package/dist/utils/objectToString.d.ts.map +1 -0
  300. package/package.json +11 -7
  301. package/dist/core/index.d.ts +0 -5
  302. package/dist/core/index.d.ts.map +0 -1
  303. package/dist/core/index.js +0 -3
  304. package/dist/core/types.d.ts.map +0 -1
  305. package/dist/core/types.test-d.d.ts +0 -2
  306. package/dist/core/types.test-d.d.ts.map +0 -1
  307. package/dist/core/utils/arrayToObject.d.ts.map +0 -1
  308. package/dist/core/utils/convertWithHttpSnippetLite.d.ts +0 -7
  309. package/dist/core/utils/convertWithHttpSnippetLite.d.ts.map +0 -1
  310. package/dist/core/utils/convertWithHttpSnippetLite.js +0 -83
  311. package/dist/core/utils/needsQuotes.d.ts.map +0 -1
  312. package/dist/core/utils/objectToString.d.ts.map +0 -1
  313. /package/dist/{core/utils → utils}/arrayToObject.d.ts +0 -0
  314. /package/dist/{core/utils → utils}/arrayToObject.js +0 -0
  315. /package/dist/{core/utils → utils}/needsQuotes.d.ts +0 -0
  316. /package/dist/{core/utils → utils}/needsQuotes.js +0 -0
  317. /package/dist/{core/utils → utils}/objectToString.d.ts +0 -0
  318. /package/dist/{core/utils → utils}/objectToString.js +0 -0
@@ -0,0 +1,126 @@
1
+ import { CodeBuilder } from '../../../helpers/code-builder.js';
2
+ import { escapeForSingleQuotes } from '../../../helpers/escape.js';
3
+ import { hasHeader, getHeader, getHeaderName } from '../../../helpers/headers.js';
4
+ import { convertType } from '../helpers.js';
5
+
6
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
+ // @ts-nocheck
8
+ /**
9
+ * @description
10
+ * HTTP code snippet generator for PHP using Guzzle.
11
+ *
12
+ * @author @RobertoArruda
13
+ * @author @erunion
14
+ *
15
+ * for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
16
+ */
17
+ const guzzle = {
18
+ info: {
19
+ key: 'guzzle',
20
+ title: 'Guzzle',
21
+ link: 'http://docs.guzzlephp.org/en/stable/',
22
+ description: 'PHP with Guzzle',
23
+ },
24
+ convert: ({ postData, fullUrl, method, cookies, headersObj }, options) => {
25
+ let _a;
26
+ const opts = {
27
+ closingTag: false,
28
+ indent: ' ',
29
+ noTags: false,
30
+ shortTags: false,
31
+ ...options,
32
+ };
33
+ const { push, blank, join } = new CodeBuilder({ indent: opts.indent });
34
+ const { code: requestCode, push: requestPush, join: requestJoin, } = new CodeBuilder({ indent: opts.indent });
35
+ if (!opts.noTags) {
36
+ push(opts.shortTags ? '<?' : '<?php');
37
+ blank();
38
+ }
39
+ switch (postData === null || postData === void 0 ? void 0 : postData.mimeType) {
40
+ case 'application/x-www-form-urlencoded':
41
+ requestPush(`'form_params' => ${convertType(postData.paramsObj, opts.indent + opts.indent, opts.indent)},`, 1);
42
+ break;
43
+ case 'multipart/form-data': {
44
+ const fields = [];
45
+ if (postData.params) {
46
+ postData.params.forEach(function (param) {
47
+ if (param.fileName) {
48
+ const field = {
49
+ name: param.name,
50
+ filename: param.fileName,
51
+ contents: param.value,
52
+ };
53
+ if (param.contentType) {
54
+ field.headers = { 'Content-Type': param.contentType };
55
+ }
56
+ fields.push(field);
57
+ }
58
+ else if (param.value) {
59
+ fields.push({
60
+ name: param.name,
61
+ contents: param.value,
62
+ });
63
+ }
64
+ });
65
+ }
66
+ if (fields.length) {
67
+ requestPush(`'multipart' => ${convertType(fields, opts.indent + opts.indent, opts.indent)}`, 1);
68
+ // Guzzle adds its own boundary for multipart requests.
69
+ if (hasHeader(headersObj, 'content-type')) {
70
+ if ((_a = getHeader(headersObj, 'content-type')) === null ||
71
+ _a === void 0
72
+ ? void 0
73
+ : _a.indexOf('boundary')) {
74
+ const headerName = getHeaderName(headersObj, 'content-type');
75
+ if (headerName) {
76
+ delete headersObj[headerName];
77
+ }
78
+ }
79
+ }
80
+ }
81
+ break;
82
+ }
83
+ default:
84
+ if (postData === null || postData === void 0 ? void 0 : postData.text) {
85
+ requestPush(`'body' => ${convertType(postData.text)},`, 1);
86
+ }
87
+ }
88
+ // construct headers
89
+ const headers = Object.keys(headersObj)
90
+ .sort()
91
+ .map(function (key) {
92
+ return `${opts.indent}${opts.indent}'${key}' => '${escapeForSingleQuotes(headersObj[key])}',`;
93
+ });
94
+ // construct cookies
95
+ const cookieString = cookies
96
+ .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)
97
+ .join('; ');
98
+ if (cookieString.length) {
99
+ headers.push(`${opts.indent}${opts.indent}'cookie' => '${escapeForSingleQuotes(cookieString)}',`);
100
+ }
101
+ if (headers.length) {
102
+ requestPush("'headers' => [", 1);
103
+ requestPush(headers.join('\n'));
104
+ requestPush('],', 1);
105
+ }
106
+ push('$client = new \\GuzzleHttp\\Client();');
107
+ blank();
108
+ if (requestCode.length) {
109
+ push(`$response = $client->request('${method}', '${fullUrl}', [`);
110
+ push(requestJoin());
111
+ push(']);');
112
+ }
113
+ else {
114
+ push(`$response = $client->request('${method}', '${fullUrl}');`);
115
+ }
116
+ blank();
117
+ push('echo $response->getBody();');
118
+ if (!opts.noTags && opts.closingTag) {
119
+ blank();
120
+ push('?>');
121
+ }
122
+ return join();
123
+ },
124
+ };
125
+
126
+ export { guzzle };
@@ -0,0 +1,3 @@
1
+ export declare const convertType: (obj: any, indent: any, lastIndent: any) => any;
2
+ export declare const supportedMethods: string[];
3
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/php/helpers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,iDAgCvB,CAAA;AACD,eAAO,MAAM,gBAAgB,UA4B5B,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { escapeString } from '../../helpers/escape.js';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-nocheck
5
+ const convertType = (obj, indent, lastIndent) => {
6
+ lastIndent = lastIndent || '';
7
+ indent = indent || '';
8
+ switch (Object.prototype.toString.call(obj)) {
9
+ case '[object Null]':
10
+ return 'null';
11
+ case '[object Undefined]':
12
+ return 'null';
13
+ case '[object String]':
14
+ return `'${escapeString(obj, { delimiter: "'", escapeNewlines: false })}'`;
15
+ case '[object Number]':
16
+ return obj.toString();
17
+ case '[object Array]': {
18
+ const contents = obj
19
+ .map((item) => convertType(item, `${indent}${indent}`, indent))
20
+ .join(`,\n${indent}`);
21
+ return `[\n${indent}${contents}\n${lastIndent}]`;
22
+ }
23
+ case '[object Object]': {
24
+ const result = [];
25
+ for (const i in obj) {
26
+ if (Object.prototype.hasOwnProperty.call(obj, i)) {
27
+ result.push(`${convertType(i, indent)} => ${convertType(obj[i], `${indent}${indent}`, indent)}`);
28
+ }
29
+ }
30
+ return `[\n${indent}${result.join(`,\n${indent}`)}\n${lastIndent}]`;
31
+ }
32
+ default:
33
+ return 'null';
34
+ }
35
+ };
36
+
37
+ export { convertType };
@@ -0,0 +1,17 @@
1
+ export declare const http1: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ link: string;
6
+ description: string;
7
+ };
8
+ convert: ({ method, url, postData, queryObj, headersObj, cookiesObj }: {
9
+ method: any;
10
+ url: any;
11
+ postData: any;
12
+ queryObj: any;
13
+ headersObj: any;
14
+ cookiesObj: any;
15
+ }, options?: {}) => any;
16
+ };
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/php/http1/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;CAmFjB,CAAA"}
@@ -0,0 +1,17 @@
1
+ export declare const http2: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ link: string;
6
+ description: string;
7
+ };
8
+ convert: ({ postData, headersObj, method, queryObj, cookiesObj, url }: {
9
+ postData: any;
10
+ headersObj: any;
11
+ method: any;
12
+ queryObj: any;
13
+ cookiesObj: any;
14
+ url: any;
15
+ }, options?: {}) => any;
16
+ };
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/php/http2/client.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;CAgIjB,CAAA"}
@@ -0,0 +1,75 @@
1
+ export declare const php: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ extname: string;
6
+ default: string;
7
+ };
8
+ clientsById: {
9
+ curl: {
10
+ info: {
11
+ key: string;
12
+ title: string;
13
+ link: string;
14
+ description: string;
15
+ };
16
+ convert: ({ uriObj, postData, fullUrl, method, httpVersion, cookies, headersObj }: {
17
+ uriObj: any;
18
+ postData: any;
19
+ fullUrl: any;
20
+ method: any;
21
+ httpVersion: any;
22
+ cookies: any;
23
+ headersObj: any;
24
+ }, options?: {}) => any;
25
+ };
26
+ guzzle: {
27
+ info: {
28
+ key: string;
29
+ title: string;
30
+ link: string;
31
+ description: string;
32
+ };
33
+ convert: ({ postData, fullUrl, method, cookies, headersObj }: {
34
+ postData: any;
35
+ fullUrl: any;
36
+ method: any;
37
+ cookies: any;
38
+ headersObj: any;
39
+ }, options: any) => any;
40
+ };
41
+ http1: {
42
+ info: {
43
+ key: string;
44
+ title: string;
45
+ link: string;
46
+ description: string;
47
+ };
48
+ convert: ({ method, url, postData, queryObj, headersObj, cookiesObj }: {
49
+ method: any;
50
+ url: any;
51
+ postData: any;
52
+ queryObj: any;
53
+ headersObj: any;
54
+ cookiesObj: any;
55
+ }, options?: {}) => any;
56
+ };
57
+ http2: {
58
+ info: {
59
+ key: string;
60
+ title: string;
61
+ link: string;
62
+ description: string;
63
+ };
64
+ convert: ({ postData, headersObj, method, queryObj, cookiesObj, url }: {
65
+ postData: any;
66
+ headersObj: any;
67
+ method: any;
68
+ queryObj: any;
69
+ cookiesObj: any;
70
+ url: any;
71
+ }, options?: {}) => any;
72
+ };
73
+ };
74
+ };
75
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/php/target.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAaf,CAAA"}
@@ -0,0 +1,10 @@
1
+ export declare const generatePowershellConvert: (command: any) => ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
2
+ method: any;
3
+ headersObj: any;
4
+ cookies: any;
5
+ uriObj: any;
6
+ fullUrl: any;
7
+ postData: any;
8
+ allHeaders: any;
9
+ }) => any;
10
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/powershell/common.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB;;;;;;;;SA4DrC,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { CodeBuilder } from '../../helpers/code-builder.js';
2
+ import { escapeString } from '../../helpers/escape.js';
3
+ import { getHeader } from '../../helpers/headers.js';
4
+
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-nocheck
7
+ const generatePowershellConvert = (command) => {
8
+ const convert = ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }) => {
9
+ const { push, join } = new CodeBuilder();
10
+ const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'];
11
+ if (!methods.includes(method.toUpperCase())) {
12
+ return 'Method not supported';
13
+ }
14
+ const commandOptions = [];
15
+ // Add headers, including the cookies
16
+ const headers = Object.keys(headersObj);
17
+ // construct headers
18
+ if (headers.length) {
19
+ push('$headers=@{}');
20
+ headers.forEach((key) => {
21
+ if (key !== 'connection') {
22
+ // Not allowed
23
+ push(`$headers.Add("${key}", "${escapeString(headersObj[key], { escapeChar: '`' })}")`);
24
+ }
25
+ });
26
+ commandOptions.push('-Headers $headers');
27
+ }
28
+ // construct cookies
29
+ if (cookies.length) {
30
+ push('$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession');
31
+ cookies.forEach((cookie) => {
32
+ push('$cookie = New-Object System.Net.Cookie');
33
+ push(`$cookie.Name = '${cookie.name}'`);
34
+ push(`$cookie.Value = '${cookie.value}'`);
35
+ push(`$cookie.Domain = '${uriObj.host}'`);
36
+ push('$session.Cookies.Add($cookie)');
37
+ });
38
+ commandOptions.push('-WebSession $session');
39
+ }
40
+ if (postData === null || postData === void 0 ? void 0 : postData.text) {
41
+ commandOptions.push(`-ContentType '${escapeString(getHeader(allHeaders, 'content-type'), {
42
+ delimiter: "'",
43
+ escapeChar: '`',
44
+ })}'`);
45
+ commandOptions.push(`-Body '${postData.text}'`);
46
+ }
47
+ push(`$response = ${command} -Uri '${fullUrl}' -Method ${method} ${commandOptions.join(' ')}`);
48
+ return join();
49
+ };
50
+ return convert;
51
+ };
52
+
53
+ export { generatePowershellConvert };
@@ -0,0 +1,18 @@
1
+ export declare const restmethod: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ link: string;
6
+ description: string;
7
+ };
8
+ convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
9
+ method: any;
10
+ headersObj: any;
11
+ cookies: any;
12
+ uriObj: any;
13
+ fullUrl: any;
14
+ postData: any;
15
+ allHeaders: any;
16
+ }) => any;
17
+ };
18
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/powershell/restmethod/client.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAQtB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { generatePowershellConvert } from '../common.js';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-nocheck
5
+ const restmethod = {
6
+ info: {
7
+ key: 'restmethod',
8
+ title: 'Invoke-RestMethod',
9
+ link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod',
10
+ description: 'Powershell Invoke-RestMethod client',
11
+ },
12
+ convert: generatePowershellConvert('Invoke-RestMethod'),
13
+ };
14
+
15
+ export { restmethod };
@@ -0,0 +1,45 @@
1
+ export declare const powershell: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ extname: string;
6
+ default: string;
7
+ };
8
+ clientsById: {
9
+ webrequest: {
10
+ info: {
11
+ key: string;
12
+ title: string;
13
+ link: string;
14
+ description: string;
15
+ };
16
+ convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
17
+ method: any;
18
+ headersObj: any;
19
+ cookies: any;
20
+ uriObj: any;
21
+ fullUrl: any;
22
+ postData: any;
23
+ allHeaders: any;
24
+ }) => any;
25
+ };
26
+ restmethod: {
27
+ info: {
28
+ key: string;
29
+ title: string;
30
+ link: string;
31
+ description: string;
32
+ };
33
+ convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
34
+ method: any;
35
+ headersObj: any;
36
+ cookies: any;
37
+ uriObj: any;
38
+ fullUrl: any;
39
+ postData: any;
40
+ allHeaders: any;
41
+ }) => any;
42
+ };
43
+ };
44
+ };
45
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/powershell/target.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWtB,CAAA"}
@@ -0,0 +1,18 @@
1
+ export declare const webrequest: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ link: string;
6
+ description: string;
7
+ };
8
+ convert: ({ method, headersObj, cookies, uriObj, fullUrl, postData, allHeaders, }: {
9
+ method: any;
10
+ headersObj: any;
11
+ cookies: any;
12
+ uriObj: any;
13
+ fullUrl: any;
14
+ postData: any;
15
+ allHeaders: any;
16
+ }) => any;
17
+ };
18
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/powershell/webrequest/client.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAQtB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { generatePowershellConvert } from '../common.js';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-nocheck
5
+ const webrequest = {
6
+ info: {
7
+ key: 'webrequest',
8
+ title: 'Invoke-WebRequest',
9
+ link: 'https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest',
10
+ description: 'Powershell Invoke-WebRequest client',
11
+ },
12
+ convert: generatePowershellConvert('Invoke-WebRequest'),
13
+ };
14
+
15
+ export { webrequest };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Create a valid Python string of a literal value according to its type.
3
+ *
4
+ * @param {*} value Any JavaScript literal
5
+ * @param {object} opts Target options
6
+ * @return {string}
7
+ */
8
+ export declare const literalRepresentation: (value: any, opts: any, indentLevel: any) => any;
9
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/httpsnippet-lite/esm/targets/python/helpers.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,kDA+CjC,CAAA"}
@@ -0,0 +1,63 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
+ // @ts-nocheck
3
+ /**
4
+ * Create a string corresponding to a Dictionary or Array literal representation with pretty option
5
+ * and indentation.
6
+ */
7
+ function concatValues(concatType, values, pretty, indentation, indentLevel) {
8
+ const currentIndent = indentation.repeat(indentLevel);
9
+ const closingBraceIndent = indentation.repeat(indentLevel - 1);
10
+ const join = pretty ? `,\n${currentIndent}` : ', ';
11
+ const openingBrace = concatType === 'object' ? '{' : '[';
12
+ const closingBrace = concatType === 'object' ? '}' : ']';
13
+ if (pretty) {
14
+ return `${openingBrace}\n${currentIndent}${values.join(join)}\n${closingBraceIndent}${closingBrace}`;
15
+ }
16
+ if (concatType === 'object' && values.length > 0) {
17
+ return `${openingBrace} ${values.join(join)} ${closingBrace}`;
18
+ }
19
+ return `${openingBrace}${values.join(join)}${closingBrace}`;
20
+ }
21
+ /**
22
+ * Create a valid Python string of a literal value according to its type.
23
+ *
24
+ * @param {*} value Any JavaScript literal
25
+ * @param {object} opts Target options
26
+ * @return {string}
27
+ */
28
+ const literalRepresentation = (value, opts, indentLevel) => {
29
+ indentLevel = indentLevel === undefined ? 1 : indentLevel + 1;
30
+ switch (Object.prototype.toString.call(value)) {
31
+ case '[object Number]':
32
+ return value;
33
+ case '[object Array]': {
34
+ let pretty = false;
35
+ const valuesRepresentation = value.map((v) => {
36
+ // Switch to prettify if the value is a dictionary with multiple keys
37
+ if (Object.prototype.toString.call(v) === '[object Object]') {
38
+ pretty = Object.keys(v).length > 1;
39
+ }
40
+ return literalRepresentation(v, opts, indentLevel);
41
+ });
42
+ return concatValues('array', valuesRepresentation, pretty, opts.indent, indentLevel);
43
+ }
44
+ case '[object Object]': {
45
+ const keyValuePairs = [];
46
+ for (const key in value) {
47
+ keyValuePairs.push(`"${key}": ${literalRepresentation(value[key], opts, indentLevel)}`);
48
+ }
49
+ return concatValues('object', keyValuePairs, opts.pretty && keyValuePairs.length > 1, opts.indent, indentLevel);
50
+ }
51
+ case '[object Null]':
52
+ return 'None';
53
+ case '[object Boolean]':
54
+ return value ? 'True' : 'False';
55
+ default:
56
+ if (value === null || value === undefined) {
57
+ return '';
58
+ }
59
+ return `"${value.toString().replace(/"/g, '\\"')}"`;
60
+ }
61
+ };
62
+
63
+ export { literalRepresentation };
@@ -0,0 +1,19 @@
1
+ export declare const python3: {
2
+ info: {
3
+ key: string;
4
+ title: string;
5
+ link: string;
6
+ description: string;
7
+ };
8
+ convert: ({ uriObj: { path, protocol, host }, postData, allHeaders, method }: {
9
+ uriObj: {
10
+ path: any;
11
+ protocol: any;
12
+ host: any;
13
+ };
14
+ postData: any;
15
+ allHeaders: any;
16
+ method: any;
17
+ }, options?: {}) => any;
18
+ };
19
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/httpsnippet-lite/esm/targets/python/python3/client.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;CA+EnB,CAAA"}