@mintlify/msft-sdk 1.1.61 → 1.1.63

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 (234) hide show
  1. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
  2. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
  3. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
  4. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
  5. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
  6. package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
  7. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
  8. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
  9. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +6 -5
  10. package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
  11. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
  12. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
  13. package/dist/api-playground/EndpointFields/components/Description.js +6 -5
  14. package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
  15. package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
  16. package/dist/api-playground-2/ApiExamples.js +19 -20
  17. package/dist/api-playground-2/ApiFields.js +20 -247
  18. package/dist/api-playground-2/EndpointHeader.js +59 -47
  19. package/dist/api-playground-2/OperationPage.js +70 -66
  20. package/dist/api-playground-2/Playground.js +67 -83
  21. package/dist/api-playground-2/SchemaPage.js +22 -9
  22. package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
  23. package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
  24. package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
  25. package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
  26. package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
  27. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
  28. package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
  29. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
  30. package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
  31. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
  32. package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
  33. package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
  34. package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
  35. package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
  36. package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
  37. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
  38. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
  39. package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
  40. package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
  41. package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
  42. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
  43. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
  44. package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
  45. package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
  46. package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
  47. package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
  48. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
  49. package/dist/api-playground-2/generators/createCookies.js +23 -0
  50. package/dist/api-playground-2/generators/createHeaders.js +53 -36
  51. package/dist/api-playground-2/generators/createQueryString.js +30 -0
  52. package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
  53. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
  54. package/dist/api-playground-2/generators/generateRequest.js +47 -51
  55. package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
  56. package/dist/api-playground-2/generators/generateSnippet.js +1 -1
  57. package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
  58. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
  59. package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
  60. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
  61. package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
  62. package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
  63. package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
  64. package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
  65. package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
  66. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
  67. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
  68. package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
  69. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
  70. package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
  71. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
  72. package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
  73. package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
  74. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
  75. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
  76. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
  77. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
  78. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
  79. package/dist/api-playground-2/schemaGraph/utils.js +185 -147
  80. package/dist/common/guards.js +11 -19
  81. package/dist/components/Api/Expandable.js +10 -9
  82. package/dist/components/Api/Param.js +11 -13
  83. package/dist/components/Api/dropdown-menu.js +10 -9
  84. package/dist/components/content-components/code-group.js +4 -4
  85. package/dist/contexts/EndpointLocationContext.js +3 -3
  86. package/dist/hooks/useApiParamFieldOption.js +10 -0
  87. package/dist/hooks/useEndpoint.js +3 -3
  88. package/dist/hooks/useKeyboardShortcut.js +13 -13
  89. package/dist/hooks/useSendPlaygroundRequest.js +14 -146
  90. package/dist/httpsnippet/src/helpers/code-builder.js +27 -0
  91. package/dist/httpsnippet/src/helpers/escape.js +11 -0
  92. package/dist/httpsnippet/src/helpers/headers.js +13 -0
  93. package/dist/httpsnippet/src/helpers/reducer.js +7 -0
  94. package/dist/httpsnippet/src/helpers/shell.js +5 -0
  95. package/dist/httpsnippet/src/helpers/url-format.js +35 -0
  96. package/dist/httpsnippet/src/helpers/url-parse.js +76 -0
  97. package/dist/httpsnippet/src/index.js +157 -0
  98. package/dist/httpsnippet/src/targets/c/libcurl/client.js +22 -0
  99. package/dist/httpsnippet/src/targets/c/target.js +15 -0
  100. package/dist/httpsnippet/src/targets/clojure/clj_http/client.js +120 -0
  101. package/dist/httpsnippet/src/targets/clojure/target.js +14 -0
  102. package/dist/httpsnippet/src/targets/csharp/httpclient/client.js +76 -0
  103. package/dist/httpsnippet/src/targets/csharp/restsharp/client.js +63 -0
  104. package/dist/httpsnippet/src/targets/csharp/target.js +17 -0
  105. package/dist/httpsnippet/src/targets/go/native/client.js +24 -0
  106. package/dist/httpsnippet/src/targets/go/target.js +15 -0
  107. package/dist/httpsnippet/src/targets/http/http1.1/client.js +34 -0
  108. package/dist/httpsnippet/src/targets/http/target.js +14 -0
  109. package/dist/httpsnippet/src/targets/index.js +43 -0
  110. package/dist/httpsnippet/src/targets/java/asynchttp/client.js +23 -0
  111. package/dist/httpsnippet/src/targets/java/nethttp/client.js +28 -0
  112. package/dist/httpsnippet/src/targets/java/okhttp/client.js +23 -0
  113. package/dist/httpsnippet/src/targets/java/target.js +20 -0
  114. package/dist/httpsnippet/src/targets/java/unirest/client.js +23 -0
  115. package/dist/httpsnippet/src/targets/javascript/axios/client.js +50 -0
  116. package/dist/httpsnippet/src/targets/javascript/fetch/client.js +61 -0
  117. package/dist/httpsnippet/src/targets/javascript/jquery/client.js +51 -0
  118. package/dist/httpsnippet/src/targets/javascript/target.js +20 -0
  119. package/dist/httpsnippet/src/targets/javascript/xhr/client.js +49 -0
  120. package/dist/httpsnippet/src/targets/json/native/client.js +39 -0
  121. package/dist/httpsnippet/src/targets/json/target.js +14 -0
  122. package/dist/httpsnippet/src/targets/kotlin/okhttp/client.js +23 -0
  123. package/dist/httpsnippet/src/targets/kotlin/target.js +14 -0
  124. package/dist/httpsnippet/src/targets/node/axios/client.js +40 -0
  125. package/dist/httpsnippet/src/targets/node/fetch/client.js +68 -0
  126. package/dist/httpsnippet/src/targets/node/native/client.js +45 -0
  127. package/dist/httpsnippet/src/targets/node/target.js +19 -0
  128. package/dist/httpsnippet/src/targets/objc/helpers.js +27 -0
  129. package/dist/httpsnippet/src/targets/objc/nsurlsession/client.js +63 -0
  130. package/dist/httpsnippet/src/targets/objc/target.js +14 -0
  131. package/dist/httpsnippet/src/targets/ocaml/cohttp/client.js +32 -0
  132. package/dist/httpsnippet/src/targets/ocaml/target.js +14 -0
  133. package/dist/httpsnippet/src/targets/php/curl/client.js +85 -0
  134. package/dist/httpsnippet/src/targets/php/guzzle/client.js +57 -0
  135. package/dist/httpsnippet/src/targets/php/helpers.js +65 -0
  136. package/dist/httpsnippet/src/targets/php/http1/client.js +28 -0
  137. package/dist/httpsnippet/src/targets/php/http2/client.js +55 -0
  138. package/dist/httpsnippet/src/targets/php/target.js +21 -0
  139. package/dist/httpsnippet/src/targets/powershell/common.js +19 -0
  140. package/dist/httpsnippet/src/targets/powershell/restmethod/client.js +14 -0
  141. package/dist/httpsnippet/src/targets/powershell/target.js +16 -0
  142. package/dist/httpsnippet/src/targets/powershell/webrequest/client.js +14 -0
  143. package/dist/httpsnippet/src/targets/python/helpers.js +33 -0
  144. package/dist/httpsnippet/src/targets/python/requests/client.js +74 -0
  145. package/dist/httpsnippet/src/targets/python/target.js +15 -0
  146. package/dist/httpsnippet/src/targets/r/httr/client.js +46 -0
  147. package/dist/httpsnippet/src/targets/r/target.js +14 -0
  148. package/dist/httpsnippet/src/targets/ruby/native/client.js +37 -0
  149. package/dist/httpsnippet/src/targets/ruby/target.js +14 -0
  150. package/dist/httpsnippet/src/targets/shell/curl/client.js +92 -0
  151. package/dist/httpsnippet/src/targets/shell/httpie/client.js +56 -0
  152. package/dist/httpsnippet/src/targets/shell/target.js +19 -0
  153. package/dist/httpsnippet/src/targets/shell/wget/client.js +30 -0
  154. package/dist/httpsnippet/src/targets/swift/helpers.js +38 -0
  155. package/dist/httpsnippet/src/targets/swift/target.js +14 -0
  156. package/dist/httpsnippet/src/targets/swift/urlsession/client.js +59 -0
  157. package/dist/index.d.ts +65 -58
  158. package/dist/index.js +109 -111
  159. package/dist/openapi/generateTypeStringFromSchema.js +2 -31
  160. package/dist/styles.css +1 -1
  161. package/package.json +17 -4
  162. package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
  163. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
  164. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
  165. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
  166. package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
  167. package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
  168. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
  169. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
  170. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
  171. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
  172. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
  173. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
  174. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
  175. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
  176. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
  177. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
  178. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
  179. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
  180. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
  181. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
  182. package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
  183. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
  184. package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
  185. package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
  186. package/dist/api-playground/ApiPlayground/index.js +0 -67
  187. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
  188. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
  189. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
  190. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
  191. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
  192. package/dist/api-playground/EndpointFields/index.js +0 -7
  193. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
  194. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
  195. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
  196. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
  197. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
  198. package/dist/common/potentiallyParseOpenApiString.js +0 -24
  199. package/dist/common/replaceSlashIndex.js +0 -6
  200. package/dist/common/slugToTitle.js +0 -10
  201. package/dist/constants/prism-languages.js +0 -19
  202. package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
  203. package/dist/contexts/MDXContentContext.js +0 -17
  204. package/dist/hooks/useApiPlaygroundInputs.js +0 -6
  205. package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
  206. package/dist/hooks/useBaseUrlOptions.js +0 -18
  207. package/dist/hooks/useComponentSchemas.js +0 -9
  208. package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
  209. package/dist/hooks/useGenerateNextItems.js +0 -11
  210. package/dist/hooks/useGenerateNextProperties.js +0 -11
  211. package/dist/hooks/useMDXContent.js +0 -6
  212. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
  213. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
  214. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
  215. package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
  216. package/dist/hooks/usePrefilledInputs/index.js +0 -65
  217. package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
  218. package/dist/hooks/useSecurityOption.js +0 -10
  219. package/dist/hooks/useSetDefaultValue.js +0 -63
  220. package/dist/openapi/filterEnums.js +0 -20
  221. package/dist/openapi/generateNextAdditionalProperties.js +0 -7
  222. package/dist/openapi/generateNextItems.js +0 -7
  223. package/dist/openapi/generateNextProperties.js +0 -23
  224. package/dist/openapi/generateOptionLabels.js +0 -20
  225. package/dist/openapi/generateSimpleLabels.js +0 -4
  226. package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
  227. package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
  228. package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
  229. package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
  230. package/dist/utils/api-playground/defaults.js +0 -15
  231. package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
  232. package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
  233. package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
  234. package/dist/utils/flattenObject.js +0 -10
@@ -0,0 +1,85 @@
1
+ import { CodeBuilder as p } from "../../../helpers/code-builder.js";
2
+ import { escapeForDoubleQuotes as j } from "../../../helpers/escape.js";
3
+ import { convertType as v } from "../helpers.js";
4
+ const N = {
5
+ info: {
6
+ key: "curl",
7
+ title: "cURL",
8
+ link: "http://php.net/manual/en/book.curl.php",
9
+ description: "PHP with ext-curl",
10
+ extname: ".php"
11
+ },
12
+ convert: ({ uriObj: i, postData: c, fullUrl: T, method: R, httpVersion: _, cookies: O, headersObj: l }, m = {}) => {
13
+ const {
14
+ closingTag: f = !1,
15
+ indent: n = " ",
16
+ maxRedirects: U = 10,
17
+ namedErrors: $ = !1,
18
+ noTags: t = !1,
19
+ shortTags: C = !1,
20
+ timeout: P = 30
21
+ } = m, { push: e, blank: o, join: h } = new p({ indent: n });
22
+ t || (e(C ? "<?" : "<?php"), o()), e("$curl = curl_init();"), o();
23
+ const E = [
24
+ {
25
+ escape: !0,
26
+ name: "CURLOPT_PORT",
27
+ value: i.port
28
+ },
29
+ {
30
+ escape: !0,
31
+ name: "CURLOPT_URL",
32
+ value: T
33
+ },
34
+ {
35
+ escape: !1,
36
+ name: "CURLOPT_RETURNTRANSFER",
37
+ value: "true"
38
+ },
39
+ {
40
+ escape: !0,
41
+ name: "CURLOPT_ENCODING",
42
+ value: ""
43
+ },
44
+ {
45
+ escape: !1,
46
+ name: "CURLOPT_MAXREDIRS",
47
+ value: U
48
+ },
49
+ {
50
+ escape: !1,
51
+ name: "CURLOPT_TIMEOUT",
52
+ value: P
53
+ },
54
+ {
55
+ escape: !1,
56
+ name: "CURLOPT_HTTP_VERSION",
57
+ value: _ === "HTTP/1.0" ? "CURL_HTTP_VERSION_1_0" : "CURL_HTTP_VERSION_1_1"
58
+ },
59
+ {
60
+ escape: !0,
61
+ name: "CURLOPT_CUSTOMREQUEST",
62
+ value: R
63
+ },
64
+ {
65
+ escape: !c.jsonObj,
66
+ name: "CURLOPT_POSTFIELDS",
67
+ value: c ? c.jsonObj ? `json_encode(${v(c.jsonObj, n.repeat(2), n)})` : c.text : void 0
68
+ }
69
+ ];
70
+ e("curl_setopt_array($curl, [");
71
+ const s = new p({ indent: n, join: `
72
+ ${n}` });
73
+ E.forEach(({ value: r, name: L, escape: d }) => {
74
+ r != null && s.push(`${L} => ${d ? JSON.stringify(r) : r},`);
75
+ });
76
+ const a = O.map((r) => `${encodeURIComponent(r.name)}=${encodeURIComponent(r.value)}`);
77
+ a.length && s.push(`CURLOPT_COOKIE => "${a.join("; ")}",`);
78
+ const u = Object.keys(l).sort().map((r) => `"${r}: ${j(l[r])}"`);
79
+ return u.length && (s.push("CURLOPT_HTTPHEADER => ["), s.push(u.join(`,
80
+ ${n}${n}`), 1), s.push("],")), e(s.join(), 1), e("]);"), o(), e("$response = curl_exec($curl);"), e("$err = curl_error($curl);"), o(), e("curl_close($curl);"), o(), e("if ($err) {"), e($ ? 'echo array_flip(get_defined_constants(true)["curl"])[$err];' : 'echo "cURL Error #:" . $err;', 1), e("} else {"), e("echo $response;", 1), e("}"), !t && f && (o(), e("?>")), h();
81
+ }
82
+ };
83
+ export {
84
+ N as curl
85
+ };
@@ -0,0 +1,57 @@
1
+ import { CodeBuilder as g } from "../../../helpers/code-builder.js";
2
+ import { escapeForSingleQuotes as $ } from "../../../helpers/escape.js";
3
+ import { hasHeader as q, getHeader as v, getHeaderName as k } from "../../../helpers/headers.js";
4
+ import { convertType as d } from "../helpers.js";
5
+ const b = {
6
+ info: {
7
+ key: "guzzle",
8
+ title: "Guzzle",
9
+ link: "http://docs.guzzlephp.org/en/stable/",
10
+ description: "PHP with Guzzle",
11
+ extname: ".php",
12
+ installation: () => "composer require guzzlehttp/guzzle"
13
+ },
14
+ convert: ({ postData: i, fullUrl: p, method: u, cookies: h, headersObj: s }, z) => {
15
+ var f;
16
+ const e = {
17
+ closingTag: !1,
18
+ indent: " ",
19
+ noTags: !1,
20
+ shortTags: !1,
21
+ ...z
22
+ }, { push: o, blank: r, join: y } = new g({ indent: e.indent }), { code: T, push: l, join: w } = new g({ indent: e.indent });
23
+ switch (e.noTags || o(e.shortTags ? "<?" : "<?php"), o("require_once('vendor/autoload.php');"), r(), i.mimeType) {
24
+ case "application/x-www-form-urlencoded":
25
+ l(`'form_params' => ${d(i.paramsObj, e.indent + e.indent, e.indent)},`, 1);
26
+ break;
27
+ case "multipart/form-data": {
28
+ const t = [];
29
+ if (i.params && i.params.forEach((n) => {
30
+ if (n.fileName) {
31
+ const m = {
32
+ name: n.name,
33
+ filename: n.fileName,
34
+ contents: n.value
35
+ };
36
+ n.contentType && (m.headers = { "Content-Type": n.contentType }), t.push(m);
37
+ } else n.value && t.push({
38
+ name: n.name,
39
+ contents: n.value
40
+ });
41
+ }), t.length && (l(`'multipart' => ${d(t, e.indent + e.indent, e.indent)}`, 1), q(s, "content-type") && (f = v(s, "content-type")) != null && f.indexOf("boundary"))) {
42
+ const n = k(s, "content-type");
43
+ n && delete s[n];
44
+ }
45
+ break;
46
+ }
47
+ default:
48
+ i.text && l(`'body' => ${d(i.text)},`, 1);
49
+ }
50
+ const c = Object.keys(s).sort().map((t) => `${e.indent}${e.indent}'${t}' => '${$(s[t])}',`), a = h.map((t) => `${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`).join("; ");
51
+ return a.length && c.push(`${e.indent}${e.indent}'cookie' => '${$(a)}',`), c.length && (l("'headers' => [", 1), l(c.join(`
52
+ `)), l("],", 1)), o("$client = new \\GuzzleHttp\\Client();"), r(), T.length ? (o(`$response = $client->request('${u}', '${p}', [`), o(w()), o("]);")) : o(`$response = $client->request('${u}', '${p}');`), r(), o("echo $response->getBody();"), !e.noTags && e.closingTag && (r(), o("?>")), y();
53
+ }
54
+ };
55
+ export {
56
+ b as guzzle
57
+ };
@@ -0,0 +1,65 @@
1
+ import { escapeString as s } from "../../helpers/escape.js";
2
+ const O = (e, r, t) => {
3
+ switch (t = t || "", r = r || "", Object.prototype.toString.call(e)) {
4
+ case "[object Boolean]":
5
+ return e;
6
+ case "[object Null]":
7
+ return "null";
8
+ case "[object Undefined]":
9
+ return "null";
10
+ case "[object String]":
11
+ return `'${s(e, { delimiter: "'", escapeNewlines: !1 })}'`;
12
+ case "[object Number]":
13
+ return e.toString();
14
+ case "[object Array]": {
15
+ const o = e.map((c) => O(c, `${r}${r}`, r)).join(`,
16
+ ${r}`);
17
+ return `[
18
+ ${r}${o}
19
+ ${t}]`;
20
+ }
21
+ case "[object Object]": {
22
+ const o = [];
23
+ for (const c in e)
24
+ Object.prototype.hasOwnProperty.call(e, c) && o.push(`${O(c, r)} => ${O(e[c], `${r}${r}`, r)}`);
25
+ return `[
26
+ ${r}${o.join(`,
27
+ ${r}`)}
28
+ ${t}]`;
29
+ }
30
+ default:
31
+ return "null";
32
+ }
33
+ }, C = [
34
+ "ACL",
35
+ "BASELINE_CONTROL",
36
+ "CHECKIN",
37
+ "CHECKOUT",
38
+ "CONNECT",
39
+ "COPY",
40
+ "DELETE",
41
+ "GET",
42
+ "HEAD",
43
+ "LABEL",
44
+ "LOCK",
45
+ "MERGE",
46
+ "MKACTIVITY",
47
+ "MKCOL",
48
+ "MKWORKSPACE",
49
+ "MOVE",
50
+ "OPTIONS",
51
+ "POST",
52
+ "PROPFIND",
53
+ "PROPPATCH",
54
+ "PUT",
55
+ "REPORT",
56
+ "TRACE",
57
+ "UNCHECKOUT",
58
+ "UNLOCK",
59
+ "UPDATE",
60
+ "VERSION_CONTROL"
61
+ ];
62
+ export {
63
+ O as convertType,
64
+ C as supportedMethods
65
+ };
@@ -0,0 +1,28 @@
1
+ import { CodeBuilder as f } from "../../../helpers/code-builder.js";
2
+ import { supportedMethods as c, convertType as s } from "../helpers.js";
3
+ const m = {
4
+ info: {
5
+ key: "http1",
6
+ title: "HTTP v1",
7
+ link: "http://php.net/manual/en/book.http.php",
8
+ description: "PHP with pecl/http v1",
9
+ extname: ".php"
10
+ },
11
+ convert: ({ method: r, url: l, postData: n, queryObj: o, headersObj: i, cookiesObj: $ }, h = {}) => {
12
+ const { closingTag: T = !1, indent: p = " ", noTags: u = !1, shortTags: a = !1 } = h, { push: e, blank: t, join: d } = new f({ indent: p });
13
+ switch (u || (e(a ? "<?" : "<?php"), t()), c.includes(r.toUpperCase()) || e(`HttpRequest::methodRegister('${r}');`), e("$request = new HttpRequest();"), e(`$request->setUrl(${s(l)});`), c.includes(r.toUpperCase()) ? e(`$request->setMethod(HTTP_METH_${r.toUpperCase()});`) : e(`$request->setMethod(HttpRequest::HTTP_METH_${r.toUpperCase()});`), t(), Object.keys(o).length && (e(`$request->setQueryData(${s(o, p)});`), t()), Object.keys(i).length && (e(`$request->setHeaders(${s(i, p)});`), t()), Object.keys($).length && (e(`$request->setCookies(${s($, p)});`), t()), n.mimeType) {
14
+ case "application/x-www-form-urlencoded":
15
+ e(`$request->setContentType(${s(n.mimeType)});`), e(`$request->setPostFields(${s(n.paramsObj, p)});`), t();
16
+ break;
17
+ case "application/json":
18
+ e(`$request->setContentType(${s(n.mimeType)});`), e(`$request->setBody(json_encode(${s(n.jsonObj, p)}));`), t();
19
+ break;
20
+ default:
21
+ n.text && (e(`$request->setBody(${s(n.text)});`), t());
22
+ }
23
+ return e("try {"), e("$response = $request->send();", 1), t(), e("echo $response->getBody();", 1), e("} catch (HttpException $ex) {"), e("echo $ex;", 1), e("}"), !u && T && (t(), e("?>")), d();
24
+ }
25
+ };
26
+ export {
27
+ m as http1
28
+ };
@@ -0,0 +1,55 @@
1
+ import { CodeBuilder as x } from "../../../helpers/code-builder.js";
2
+ import { hasHeader as H, getHeader as M, getHeaderName as C } from "../../../helpers/headers.js";
3
+ import { convertType as n } from "../helpers.js";
4
+ const P = {
5
+ info: {
6
+ key: "http2",
7
+ title: "HTTP v2",
8
+ link: "http://devel-m6w6.rhcloud.com/mdref/http",
9
+ description: "PHP with pecl/http v2",
10
+ extname: ".php"
11
+ },
12
+ convert: ({ postData: o, headersObj: r, method: h, queryObj: $, cookiesObj: a, url: m }, g = {}) => {
13
+ var y;
14
+ const { closingTag: w = !1, indent: s = " ", noTags: f = !1, shortTags: b = !1 } = g, { push: e, blank: t, join: k } = new x({ indent: s });
15
+ let i = !1;
16
+ switch (f || (e(b ? "<?" : "<?php"), t()), e("$client = new http\\Client;"), e("$request = new http\\Client\\Request;"), t(), o.mimeType) {
17
+ case "application/x-www-form-urlencoded":
18
+ e("$body = new http\\Message\\Body;"), e(`$body->append(new http\\QueryString(${n(o.paramsObj, s)}));`), t(), i = !0;
19
+ break;
20
+ case "multipart/form-data": {
21
+ if (!o.params)
22
+ break;
23
+ const d = [], l = {};
24
+ o.params.forEach(({ name: p, fileName: u, value: c, contentType: T }) => {
25
+ if (u) {
26
+ d.push({
27
+ name: p,
28
+ type: T,
29
+ file: u,
30
+ data: c
31
+ });
32
+ return;
33
+ }
34
+ c && (l[p] = c);
35
+ });
36
+ const q = Object.keys(l).length ? n(l, s) : "null", B = d.length ? n(d, s) : "null";
37
+ if (e("$body = new http\\Message\\Body;"), e(`$body->addForm(${q}, ${B});`), H(r, "content-type") && (y = M(r, "content-type")) != null && y.indexOf("boundary")) {
38
+ const p = C(r, "content-type");
39
+ p && delete r[p];
40
+ }
41
+ t(), i = !0;
42
+ break;
43
+ }
44
+ case "application/json":
45
+ e("$body = new http\\Message\\Body;"), e(`$body->append(json_encode(${n(o.jsonObj, s)}));`), i = !0;
46
+ break;
47
+ default:
48
+ o.text && (e("$body = new http\\Message\\Body;"), e(`$body->append(${n(o.text)});`), t(), i = !0);
49
+ }
50
+ return e(`$request->setRequestUrl(${n(m)});`), e(`$request->setRequestMethod(${n(h)});`), i && (e("$request->setBody($body);"), t()), Object.keys($).length && (e(`$request->setQuery(new http\\QueryString(${n($, s)}));`), t()), Object.keys(r).length && (e(`$request->setHeaders(${n(r, s)});`), t()), Object.keys(a).length && (t(), e(`$client->setCookies(${n(a, s)});`), t()), e("$client->enqueue($request)->send();"), e("$response = $client->getResponse();"), t(), e("echo $response->getBody();"), !f && w && (t(), e("?>")), k();
51
+ }
52
+ };
53
+ export {
54
+ P as http2
55
+ };
@@ -0,0 +1,21 @@
1
+ import { curl as t } from "./curl/client.js";
2
+ import { guzzle as p } from "./guzzle/client.js";
3
+ import { http1 as o } from "./http1/client.js";
4
+ import { http2 as r } from "./http2/client.js";
5
+ const f = {
6
+ info: {
7
+ key: "php",
8
+ title: "PHP",
9
+ default: "curl",
10
+ cli: "php %s"
11
+ },
12
+ clientsById: {
13
+ curl: t,
14
+ guzzle: p,
15
+ http1: o,
16
+ http2: r
17
+ }
18
+ };
19
+ export {
20
+ f as php
21
+ };
@@ -0,0 +1,19 @@
1
+ import { CodeBuilder as u } from "../../helpers/code-builder.js";
2
+ import { escapeString as $ } from "../../helpers/escape.js";
3
+ import { getHeader as f } from "../../helpers/headers.js";
4
+ const O = (d) => ({ method: s, headersObj: n, cookies: r, uriObj: h, fullUrl: a, postData: i, allHeaders: p }) => {
5
+ const { push: e, join: m } = new u();
6
+ if (!["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(s.toUpperCase()))
7
+ return "Method not supported";
8
+ const t = [], c = Object.keys(n);
9
+ return c.length && (e("$headers=@{}"), c.forEach((o) => {
10
+ o !== "connection" && e(`$headers.Add("${o}", "${$(n[o], { escapeChar: "`" })}")`);
11
+ }), t.push("-Headers $headers")), r.length && (e("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"), r.forEach((o) => {
12
+ e("$cookie = New-Object System.Net.Cookie"), e(`$cookie.Name = '${o.name}'`), e(`$cookie.Value = '${o.value}'`), e(`$cookie.Domain = '${h.host}'`), e("$session.Cookies.Add($cookie)");
13
+ }), t.push("-WebSession $session")), i.text && (t.push(
14
+ `-ContentType '${$(f(p, "content-type"), { delimiter: "'", escapeChar: "`" })}'`
15
+ ), t.push(`-Body '${i.text}'`)), e(`$response = ${d} -Uri '${a}' -Method ${s} ${t.join(" ")}`.trim()), m();
16
+ };
17
+ export {
18
+ O as generatePowershellConvert
19
+ };
@@ -0,0 +1,14 @@
1
+ import { generatePowershellConvert as e } from "../common.js";
2
+ const t = {
3
+ info: {
4
+ key: "restmethod",
5
+ title: "Invoke-RestMethod",
6
+ link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",
7
+ description: "Powershell Invoke-RestMethod client",
8
+ extname: ".ps1"
9
+ },
10
+ convert: e("Invoke-RestMethod")
11
+ };
12
+ export {
13
+ t as restmethod
14
+ };
@@ -0,0 +1,16 @@
1
+ import { restmethod as e } from "./restmethod/client.js";
2
+ import { webrequest as t } from "./webrequest/client.js";
3
+ const l = {
4
+ info: {
5
+ key: "powershell",
6
+ title: "Powershell",
7
+ default: "webrequest"
8
+ },
9
+ clientsById: {
10
+ webrequest: t,
11
+ restmethod: e
12
+ }
13
+ };
14
+ export {
15
+ l as powershell
16
+ };
@@ -0,0 +1,14 @@
1
+ import { generatePowershellConvert as e } from "../common.js";
2
+ const t = {
3
+ info: {
4
+ key: "webrequest",
5
+ title: "Invoke-WebRequest",
6
+ link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",
7
+ description: "Powershell Invoke-WebRequest client",
8
+ extname: ".ps1"
9
+ },
10
+ convert: e("Invoke-WebRequest")
11
+ };
12
+ export {
13
+ t as webrequest
14
+ };
@@ -0,0 +1,33 @@
1
+ function i(t, r, e, c, o) {
2
+ const n = c.repeat(o), $ = c.repeat(o - 1), j = e ? `,
3
+ ${n}` : ", ", s = t === "object" ? "{" : "[", b = t === "object" ? "}" : "]";
4
+ return e ? `${s}
5
+ ${n}${r.join(j)}
6
+ ${$}${b}` : t === "object" && r.length > 0 ? `${s} ${r.join(j)} ${b}` : `${s}${r.join(j)}${b}`;
7
+ }
8
+ const a = (t, r, e) => {
9
+ switch (e = e === void 0 ? 1 : e + 1, Object.prototype.toString.call(t)) {
10
+ case "[object Number]":
11
+ return t;
12
+ case "[object Array]": {
13
+ let c = !1;
14
+ const o = t.map((n) => (Object.prototype.toString.call(n) === "[object Object]" && (c = Object.keys(n).length > 1), a(n, r, e)));
15
+ return i("array", o, c, r.indent, e);
16
+ }
17
+ case "[object Object]": {
18
+ const c = [];
19
+ for (const o in t)
20
+ c.push(`"${o}": ${a(t[o], r, e)}`);
21
+ return i("object", c, r.pretty && c.length > 1, r.indent, e);
22
+ }
23
+ case "[object Null]":
24
+ return "None";
25
+ case "[object Boolean]":
26
+ return t ? "True" : "False";
27
+ default:
28
+ return t == null ? "" : `"${t.toString().replace(/"/g, '\\"')}"`;
29
+ }
30
+ };
31
+ export {
32
+ a as literalRepresentation
33
+ };
@@ -0,0 +1,74 @@
1
+ import { CodeBuilder as T } from "../../../helpers/code-builder.js";
2
+ import { escapeForDoubleQuotes as y } from "../../../helpers/escape.js";
3
+ import { getHeaderName as P } from "../../../helpers/headers.js";
4
+ import { literalRepresentation as c } from "../helpers.js";
5
+ const k = ["HEAD", "GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], x = {
6
+ info: {
7
+ key: "requests",
8
+ title: "Requests",
9
+ link: "http://docs.python-requests.org/en/latest/api/#requests.request",
10
+ description: "Requests HTTP library",
11
+ extname: ".py",
12
+ installation: () => "python -m pip install requests"
13
+ },
14
+ convert: ({ fullUrl: b, postData: t, allHeaders: h, method: p }, j) => {
15
+ const i = {
16
+ indent: " ",
17
+ pretty: !0,
18
+ ...j
19
+ }, { push: s, blank: o, join: q, addPostProcessor: O } = new T({ indent: i.indent });
20
+ s("import requests"), o(), s(`url = "${b}"`), o();
21
+ const r = h;
22
+ let d = {};
23
+ const m = {};
24
+ let f = !1, n = !1, $ = !1;
25
+ switch (t.mimeType) {
26
+ case "application/json":
27
+ t.jsonObj && (s(`payload = ${c(t.jsonObj, i)}`), $ = !0, n = !0);
28
+ break;
29
+ case "multipart/form-data":
30
+ if (!t.params)
31
+ break;
32
+ if (d = {}, t.params.forEach((e) => {
33
+ e.fileName ? (e.contentType ? m[e.name] = `('${e.fileName}', open('${e.fileName}', 'rb'), '${e.contentType}')` : m[e.name] = `('${e.fileName}', open('${e.fileName}', 'rb'))`, f = !0) : (d[e.name] = e.value, n = !0);
34
+ }), f) {
35
+ s(`files = ${c(m, i)}`), n && s(`payload = ${c(d, i)}`);
36
+ const e = P(r, "content-type");
37
+ e && delete r[e];
38
+ } else {
39
+ const e = JSON.stringify(t.text);
40
+ e && (s(`payload = ${e}`), n = !0);
41
+ }
42
+ O(
43
+ (e) => e.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g, '("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g, '("$1", open("$2", "rb"), "$3")')
44
+ );
45
+ break;
46
+ default: {
47
+ if (t.mimeType === "application/x-www-form-urlencoded" && t.paramsObj) {
48
+ s(`payload = ${c(t.paramsObj, i)}`), n = !0;
49
+ break;
50
+ }
51
+ const e = JSON.stringify(t.text);
52
+ e && (s(`payload = ${e}`), n = !0);
53
+ }
54
+ }
55
+ const l = Object.keys(r).length;
56
+ if (l === 0 && (n || f))
57
+ o();
58
+ else if (l === 1)
59
+ Object.keys(r).forEach((e) => {
60
+ s(`headers = {"${e}": "${y(r[e])}"}`), o();
61
+ });
62
+ else if (l > 1) {
63
+ let e = 1;
64
+ s("headers = {"), Object.keys(r).forEach((u) => {
65
+ s(e !== l ? `"${u}": "${y(r[u])}",` : `"${u}": "${y(r[u])}"`, 1), e += 1;
66
+ }), s("}"), o();
67
+ }
68
+ let a = k.includes(p) ? `response = requests.${p.toLowerCase()}(url` : `response = requests.request("${p}", url`;
69
+ return n && ($ ? a += ", json=payload" : a += ", data=payload"), f && (a += ", files=files"), l > 0 && (a += ", headers=headers"), a += ")", s(a), o(), s("print(response.text)"), q();
70
+ }
71
+ };
72
+ export {
73
+ x as requests
74
+ };
@@ -0,0 +1,15 @@
1
+ import { requests as t } from "./requests/client.js";
2
+ const o = {
3
+ info: {
4
+ key: "python",
5
+ title: "Python",
6
+ default: "requests",
7
+ cli: "python3 %s"
8
+ },
9
+ clientsById: {
10
+ requests: t
11
+ }
12
+ };
13
+ export {
14
+ o as python
15
+ };
@@ -0,0 +1,46 @@
1
+ import { CodeBuilder as S } from "../../../helpers/code-builder.js";
2
+ import { escapeForDoubleQuotes as h, escapeForSingleQuotes as v } from "../../../helpers/escape.js";
3
+ import { getHeader as k } from "../../../helpers/headers.js";
4
+ const _ = {
5
+ info: {
6
+ key: "httr",
7
+ title: "httr",
8
+ link: "https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",
9
+ description: "httr: Tools for Working with URLs and HTTP",
10
+ extname: ".r"
11
+ },
12
+ convert: ({ url: u, queryObj: d, queryString: i, postData: r, allHeaders: s, method: $ }) => {
13
+ const { push: e, blank: t, join: b } = new S();
14
+ e("library(httr)"), t(), e(`url <- "${u}"`), t();
15
+ const n = d;
16
+ delete d.key;
17
+ const y = Object.keys(n).length;
18
+ i.length === 1 ? (e(`queryString <- list(${Object.keys(n)} = "${Object.values(n).toString()}")`), t()) : i.length > 1 && (e("queryString <- list("), Object.keys(n).forEach((o, l) => {
19
+ l !== y - 1 ? e(` ${o} = "${n[o].toString()}",`) : e(` ${o} = "${n[o].toString()}"`);
20
+ }), e(")"), t());
21
+ const a = JSON.stringify(r.text);
22
+ if (a && (e(`payload <- ${a}`), t()), r.text || r.jsonObj || r.params)
23
+ switch (r.mimeType) {
24
+ case "application/x-www-form-urlencoded":
25
+ e('encode <- "form"'), t();
26
+ break;
27
+ case "application/json":
28
+ e('encode <- "json"'), t();
29
+ break;
30
+ case "multipart/form-data":
31
+ e('encode <- "multipart"'), t();
32
+ break;
33
+ default:
34
+ e('encode <- "raw"'), t();
35
+ break;
36
+ }
37
+ const p = k(s, "cookie"), f = k(s, "accept"), j = p ? `set_cookies(\`${String(p).replace(/;/g, '", `').replace(/` /g, "`").replace(/[=]/g, '` = "')}")` : void 0, w = f ? `accept("${h(f)}")` : void 0, x = `content_type("${h(r.mimeType)}")`, m = Object.entries(s).filter(([o]) => !["cookie", "accept", "content-type"].includes(o.toLowerCase())).map(([o, l]) => `'${o}' = '${v(l)}'`).join(", "), O = m ? `add_headers(${m})` : void 0;
38
+ let c = `response <- VERB("${$}", url`;
39
+ a && (c += ", body = payload"), i.length && (c += ", query = queryString");
40
+ const g = [O, x, w, j].filter((o) => !!o).join(", ");
41
+ return g && (c += `, ${g}`), (r.text || r.jsonObj || r.params) && (c += ", encode = encode"), c += ")", e(c), t(), e('content(response, "text")'), b();
42
+ }
43
+ };
44
+ export {
45
+ _ as httr
46
+ };
@@ -0,0 +1,14 @@
1
+ import { httr as t } from "./httr/client.js";
2
+ const e = {
3
+ info: {
4
+ key: "r",
5
+ title: "R",
6
+ default: "httr"
7
+ },
8
+ clientsById: {
9
+ httr: t
10
+ }
11
+ };
12
+ export {
13
+ e as r
14
+ };
@@ -0,0 +1,37 @@
1
+ import { CodeBuilder as d } from "../../../helpers/code-builder.js";
2
+ import { escapeForSingleQuotes as E } from "../../../helpers/escape.js";
3
+ const b = {
4
+ info: {
5
+ key: "native",
6
+ title: "net::http",
7
+ link: "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
8
+ description: "Ruby HTTP client",
9
+ extname: ".rb"
10
+ },
11
+ convert: ({ uriObj: p, method: T, fullUrl: c, postData: o, allHeaders: s }) => {
12
+ const { push: t, blank: e, join: h } = new d();
13
+ t("require 'uri'"), t("require 'net/http'"), e();
14
+ const r = T.toUpperCase(), l = [
15
+ "GET",
16
+ "POST",
17
+ "HEAD",
18
+ "DELETE",
19
+ "PATCH",
20
+ "PUT",
21
+ "OPTIONS",
22
+ "COPY",
23
+ "LOCK",
24
+ "UNLOCK",
25
+ "MOVE",
26
+ "TRACE"
27
+ ], n = r.charAt(0) + r.substring(1).toLowerCase();
28
+ l.includes(r) || (t(`class Net::HTTP::${n} < Net::HTTPRequest`), t(` METHOD = '${r.toUpperCase()}'`), t(` REQUEST_HAS_BODY = '${o.text ? "true" : "false"}'`), t(" RESPONSE_HAS_BODY = true"), t("end"), e()), t(`url = URI("${c}")`), e(), t("http = Net::HTTP.new(url.host, url.port)"), p.protocol === "https:" && t("http.use_ssl = true"), e(), t(`request = Net::HTTP::${n}.new(url)`);
29
+ const i = Object.keys(s);
30
+ return i.length && i.forEach((u) => {
31
+ t(`request["${u}"] = '${E(s[u])}'`);
32
+ }), o.text && t(`request.body = ${JSON.stringify(o.text)}`), e(), t("response = http.request(request)"), t("puts response.read_body"), h();
33
+ }
34
+ };
35
+ export {
36
+ b as native
37
+ };
@@ -0,0 +1,14 @@
1
+ import { native as t } from "./native/client.js";
2
+ const i = {
3
+ info: {
4
+ key: "ruby",
5
+ title: "Ruby",
6
+ default: "native"
7
+ },
8
+ clientsById: {
9
+ native: t
10
+ }
11
+ };
12
+ export {
13
+ i as ruby
14
+ };