@goast/kotlin 0.3.13 → 0.4.0-beta2

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 (452) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -5
  3. package/assets/client/okhttp3/ApiAbstractions.kt +30 -30
  4. package/assets/client/okhttp3/ApiClient.kt +249 -249
  5. package/assets/client/okhttp3/ApiResponse.kt +43 -43
  6. package/assets/client/okhttp3/Errors.kt +21 -21
  7. package/assets/client/okhttp3/PartConfig.kt +11 -11
  8. package/assets/client/okhttp3/RequestConfig.kt +18 -18
  9. package/assets/client/okhttp3/RequestMethod.kt +8 -8
  10. package/assets/client/okhttp3/ResponseExtensions.kt +24 -24
  11. package/assets/client/okhttp3/Serializer.kt +14 -14
  12. package/esm/index.d.ts +9 -0
  13. package/esm/index.d.ts.map +1 -0
  14. package/esm/lib/assets.d.ts +3 -0
  15. package/esm/lib/assets.d.ts.map +1 -0
  16. package/esm/lib/assets.js +6 -0
  17. package/esm/lib/ast/_index.d.ts +29 -0
  18. package/esm/lib/ast/_index.d.ts.map +1 -0
  19. package/esm/lib/ast/_index.js +2 -3
  20. package/{types → esm}/lib/ast/common.d.ts +1 -0
  21. package/esm/lib/ast/common.d.ts.map +1 -0
  22. package/esm/lib/ast/index.d.ts +2 -0
  23. package/esm/lib/ast/index.d.ts.map +1 -0
  24. package/esm/lib/ast/index.js +1 -2
  25. package/{types → esm}/lib/ast/node.d.ts +2 -1
  26. package/esm/lib/ast/node.d.ts.map +1 -0
  27. package/esm/lib/ast/node.js +1 -1
  28. package/{types → esm}/lib/ast/nodes/annotation.d.ts +6 -5
  29. package/esm/lib/ast/nodes/annotation.d.ts.map +1 -0
  30. package/esm/lib/ast/nodes/annotation.js +19 -1
  31. package/{types → esm}/lib/ast/nodes/argument.d.ts +5 -4
  32. package/esm/lib/ast/nodes/argument.d.ts.map +1 -0
  33. package/esm/lib/ast/nodes/argument.js +12 -0
  34. package/{types → esm}/lib/ast/nodes/call.d.ts +6 -5
  35. package/esm/lib/ast/nodes/call.d.ts.map +1 -0
  36. package/esm/lib/ast/nodes/call.js +19 -1
  37. package/{types → esm}/lib/ast/nodes/class.d.ts +16 -15
  38. package/esm/lib/ast/nodes/class.d.ts.map +1 -0
  39. package/esm/lib/ast/nodes/class.js +79 -1
  40. package/{types → esm}/lib/ast/nodes/collection-literal.d.ts +5 -4
  41. package/esm/lib/ast/nodes/collection-literal.d.ts.map +1 -0
  42. package/esm/lib/ast/nodes/collection-literal.js +7 -1
  43. package/{types → esm}/lib/ast/nodes/constructor.d.ts +9 -8
  44. package/esm/lib/ast/nodes/constructor.d.ts.map +1 -0
  45. package/esm/lib/ast/nodes/constructor.js +37 -1
  46. package/{types → esm}/lib/ast/nodes/doc-tag.d.ts +4 -3
  47. package/esm/lib/ast/nodes/doc-tag.d.ts.map +1 -0
  48. package/esm/lib/ast/nodes/doc-tag.js +19 -1
  49. package/{types → esm}/lib/ast/nodes/doc.d.ts +7 -6
  50. package/esm/lib/ast/nodes/doc.d.ts.map +1 -0
  51. package/esm/lib/ast/nodes/doc.js +13 -1
  52. package/{types → esm}/lib/ast/nodes/enum-value.d.ts +9 -8
  53. package/esm/lib/ast/nodes/enum-value.d.ts.map +1 -0
  54. package/esm/lib/ast/nodes/enum-value.js +31 -1
  55. package/{types → esm}/lib/ast/nodes/enum.d.ts +16 -15
  56. package/esm/lib/ast/nodes/enum.d.ts.map +1 -0
  57. package/esm/lib/ast/nodes/enum.js +55 -1
  58. package/{types → esm}/lib/ast/nodes/function.d.ts +10 -9
  59. package/esm/lib/ast/nodes/function.d.ts.map +1 -0
  60. package/esm/lib/ast/nodes/function.js +115 -1
  61. package/{types → esm}/lib/ast/nodes/generic-parameter.d.ts +5 -4
  62. package/esm/lib/ast/nodes/generic-parameter.d.ts.map +1 -0
  63. package/esm/lib/ast/nodes/generic-parameter.js +18 -0
  64. package/{types → esm}/lib/ast/nodes/init-block.d.ts +4 -3
  65. package/esm/lib/ast/nodes/init-block.d.ts.map +1 -0
  66. package/esm/lib/ast/nodes/init-block.js +6 -0
  67. package/{types → esm}/lib/ast/nodes/interface.d.ts +14 -13
  68. package/esm/lib/ast/nodes/interface.d.ts.map +1 -0
  69. package/esm/lib/ast/nodes/interface.js +49 -1
  70. package/{types → esm}/lib/ast/nodes/lambda-type.d.ts +5 -4
  71. package/esm/lib/ast/nodes/lambda-type.d.ts.map +1 -0
  72. package/esm/lib/ast/nodes/lambda-type.js +19 -1
  73. package/{types → esm}/lib/ast/nodes/lambda.d.ts +4 -3
  74. package/esm/lib/ast/nodes/lambda.d.ts.map +1 -0
  75. package/esm/lib/ast/nodes/lambda.js +19 -1
  76. package/{types → esm}/lib/ast/nodes/object.d.ts +9 -8
  77. package/esm/lib/ast/nodes/object.d.ts.map +1 -0
  78. package/esm/lib/ast/nodes/object.js +43 -1
  79. package/{types → esm}/lib/ast/nodes/parameter.d.ts +7 -6
  80. package/esm/lib/ast/nodes/parameter.d.ts.map +1 -0
  81. package/esm/lib/ast/nodes/parameter.js +62 -1
  82. package/{types → esm}/lib/ast/nodes/property.d.ts +9 -8
  83. package/esm/lib/ast/nodes/property.d.ts.map +1 -0
  84. package/esm/lib/ast/nodes/property.js +133 -3
  85. package/{types → esm}/lib/ast/nodes/reference.d.ts +6 -5
  86. package/esm/lib/ast/nodes/reference.d.ts.map +1 -0
  87. package/esm/lib/ast/nodes/reference.js +48 -7
  88. package/{types → esm}/lib/ast/nodes/string.d.ts +4 -3
  89. package/esm/lib/ast/nodes/string.d.ts.map +1 -0
  90. package/esm/lib/ast/nodes/string.js +37 -1
  91. package/esm/lib/ast/nodes/types.d.ts +11 -0
  92. package/esm/lib/ast/nodes/types.d.ts.map +1 -0
  93. package/esm/lib/ast/references/index.d.ts +9 -0
  94. package/esm/lib/ast/references/index.d.ts.map +1 -0
  95. package/esm/lib/ast/references/index.js +7 -14
  96. package/esm/lib/ast/references/jackson.d.ts +92 -0
  97. package/esm/lib/ast/references/jackson.d.ts.map +1 -0
  98. package/esm/lib/ast/references/jakarta.d.ts +40 -0
  99. package/esm/lib/ast/references/jakarta.d.ts.map +1 -0
  100. package/esm/lib/ast/references/java.d.ts +95 -0
  101. package/esm/lib/ast/references/java.d.ts.map +1 -0
  102. package/esm/lib/ast/references/kotlin.d.ts +301 -0
  103. package/esm/lib/ast/references/kotlin.d.ts.map +1 -0
  104. package/esm/lib/ast/references/okhttp3.d.ts +27 -0
  105. package/esm/lib/ast/references/okhttp3.d.ts.map +1 -0
  106. package/esm/lib/ast/references/reactor.d.ts +33 -0
  107. package/esm/lib/ast/references/reactor.d.ts.map +1 -0
  108. package/esm/lib/ast/references/spring.d.ts +173 -0
  109. package/esm/lib/ast/references/spring.d.ts.map +1 -0
  110. package/esm/lib/ast/references/swagger.d.ts +53 -0
  111. package/esm/lib/ast/references/swagger.d.ts.map +1 -0
  112. package/esm/lib/ast/utils/get-kotlin-builder-options.d.ts +4 -0
  113. package/esm/lib/ast/utils/get-kotlin-builder-options.d.ts.map +1 -0
  114. package/esm/lib/ast/utils/get-kotlin-builder-options.js +1 -1
  115. package/{types → esm}/lib/ast/utils/to-kt-node.d.ts +4 -3
  116. package/esm/lib/ast/utils/to-kt-node.d.ts.map +1 -0
  117. package/{types → esm}/lib/ast/utils/write-kt-annotations.d.ts +3 -2
  118. package/esm/lib/ast/utils/write-kt-annotations.d.ts.map +1 -0
  119. package/esm/lib/ast/utils/write-kt-annotations.js +1 -1
  120. package/esm/lib/ast/utils/write-kt-arguments.d.ts +4 -0
  121. package/esm/lib/ast/utils/write-kt-arguments.d.ts.map +1 -0
  122. package/esm/lib/ast/utils/write-kt-arguments.js +1 -1
  123. package/esm/lib/ast/utils/write-kt-enum-values.d.ts +4 -0
  124. package/esm/lib/ast/utils/write-kt-enum-values.d.ts.map +1 -0
  125. package/esm/lib/ast/utils/write-kt-enum-values.js +1 -1
  126. package/esm/lib/ast/utils/write-kt-generic-parameters.d.ts +4 -0
  127. package/esm/lib/ast/utils/write-kt-generic-parameters.d.ts.map +1 -0
  128. package/esm/lib/ast/utils/write-kt-generic-parameters.js +1 -1
  129. package/{types → esm}/lib/ast/utils/write-kt-members.d.ts +3 -2
  130. package/esm/lib/ast/utils/write-kt-members.d.ts.map +1 -0
  131. package/esm/lib/ast/utils/write-kt-members.js +1 -1
  132. package/{types → esm}/lib/ast/utils/write-kt-node.d.ts +3 -2
  133. package/esm/lib/ast/utils/write-kt-node.d.ts.map +1 -0
  134. package/esm/lib/ast/utils/write-kt-node.js +1 -1
  135. package/esm/lib/ast/utils/write-kt-parameters.d.ts +4 -0
  136. package/esm/lib/ast/utils/write-kt-parameters.d.ts.map +1 -0
  137. package/esm/lib/ast/utils/write-kt-parameters.js +1 -1
  138. package/{types → esm}/lib/common-results.d.ts +1 -0
  139. package/esm/lib/common-results.d.ts.map +1 -0
  140. package/{types → esm}/lib/config.d.ts +2 -1
  141. package/esm/lib/config.d.ts.map +1 -0
  142. package/{types → esm}/lib/file-builder.d.ts +5 -4
  143. package/esm/lib/file-builder.d.ts.map +1 -0
  144. package/esm/lib/file-builder.js +13 -2
  145. package/esm/lib/generators/file-generator.d.ts +9 -0
  146. package/esm/lib/generators/file-generator.d.ts.map +1 -0
  147. package/esm/lib/generators/file-generator.js +2 -2
  148. package/esm/lib/generators/index.d.ts +5 -0
  149. package/esm/lib/generators/index.d.ts.map +1 -0
  150. package/{types → esm}/lib/generators/models/args.d.ts +3 -2
  151. package/esm/lib/generators/models/args.d.ts.map +1 -0
  152. package/esm/lib/generators/models/index.d.ts +5 -0
  153. package/esm/lib/generators/models/index.d.ts.map +1 -0
  154. package/esm/lib/generators/models/index.js +1 -2
  155. package/{types → esm}/lib/generators/models/model-generator.d.ts +12 -11
  156. package/esm/lib/generators/models/model-generator.d.ts.map +1 -0
  157. package/esm/lib/generators/models/model-generator.js +12 -10
  158. package/{types → esm}/lib/generators/models/models-generator.d.ts +5 -4
  159. package/esm/lib/generators/models/models-generator.d.ts.map +1 -0
  160. package/esm/lib/generators/models/models-generator.js +7 -1
  161. package/{types → esm}/lib/generators/models/models.d.ts +4 -3
  162. package/esm/lib/generators/models/models.d.ts.map +1 -0
  163. package/{types → esm}/lib/generators/services/okhttp3-clients/args.d.ts +11 -10
  164. package/esm/lib/generators/services/okhttp3-clients/args.d.ts.map +1 -0
  165. package/esm/lib/generators/services/okhttp3-clients/index.d.ts +5 -0
  166. package/esm/lib/generators/services/okhttp3-clients/index.d.ts.map +1 -0
  167. package/esm/lib/generators/services/okhttp3-clients/index.js +1 -2
  168. package/{types → esm}/lib/generators/services/okhttp3-clients/models.d.ts +6 -5
  169. package/esm/lib/generators/services/okhttp3-clients/models.d.ts.map +1 -0
  170. package/{types → esm}/lib/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +19 -18
  171. package/esm/lib/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -0
  172. package/esm/lib/generators/services/okhttp3-clients/okhttp3-client-generator.js +21 -25
  173. package/{types → esm}/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts +7 -6
  174. package/esm/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts.map +1 -0
  175. package/esm/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.js +29 -14
  176. package/esm/lib/generators/services/okhttp3-clients/refs.d.ts +252 -0
  177. package/esm/lib/generators/services/okhttp3-clients/refs.d.ts.map +1 -0
  178. package/{types → esm}/lib/generators/services/spring-controllers/args.d.ts +9 -8
  179. package/esm/lib/generators/services/spring-controllers/args.d.ts.map +1 -0
  180. package/esm/lib/generators/services/spring-controllers/index.d.ts +5 -0
  181. package/esm/lib/generators/services/spring-controllers/index.d.ts.map +1 -0
  182. package/esm/lib/generators/services/spring-controllers/index.js +1 -2
  183. package/{types → esm}/lib/generators/services/spring-controllers/models.d.ts +5 -4
  184. package/esm/lib/generators/services/spring-controllers/models.d.ts.map +1 -0
  185. package/{types → esm}/lib/generators/services/spring-controllers/spring-controller-generator.d.ts +16 -15
  186. package/esm/lib/generators/services/spring-controllers/spring-controller-generator.d.ts.map +1 -0
  187. package/esm/lib/generators/services/spring-controllers/spring-controller-generator.js +9 -8
  188. package/{types → esm}/lib/generators/services/spring-controllers/spring-controllers-generator.d.ts +5 -4
  189. package/esm/lib/generators/services/spring-controllers/spring-controllers-generator.d.ts.map +1 -0
  190. package/esm/lib/generators/services/spring-controllers/spring-controllers-generator.js +9 -4
  191. package/{types → esm}/lib/import-collection.d.ts +3 -2
  192. package/esm/lib/import-collection.d.ts.map +1 -0
  193. package/esm/lib/import-collection.js +13 -2
  194. package/{types → esm}/lib/types.d.ts +2 -1
  195. package/esm/lib/types.d.ts.map +1 -0
  196. package/{types → esm}/lib/utils.d.ts +2 -1
  197. package/esm/lib/utils.d.ts.map +1 -0
  198. package/esm/package.json +3 -0
  199. package/package.json +22 -30
  200. package/script/index.d.ts +9 -0
  201. package/script/index.d.ts.map +1 -0
  202. package/script/index.js +11 -0
  203. package/script/lib/assets.d.ts +3 -0
  204. package/script/lib/assets.d.ts.map +1 -0
  205. package/script/lib/assets.js +9 -0
  206. package/script/lib/ast/_index.d.ts +29 -0
  207. package/script/lib/ast/_index.d.ts.map +1 -0
  208. package/script/lib/ast/_index.js +81 -0
  209. package/script/lib/ast/common.d.ts +2 -0
  210. package/script/lib/ast/common.d.ts.map +1 -0
  211. package/script/lib/ast/index.d.ts +2 -0
  212. package/script/lib/ast/index.d.ts.map +1 -0
  213. package/{cjs → script}/lib/ast/index.js +1 -1
  214. package/script/lib/ast/node.d.ts +5 -0
  215. package/script/lib/ast/node.d.ts.map +1 -0
  216. package/script/lib/ast/nodes/annotation.d.ts +24 -0
  217. package/script/lib/ast/nodes/annotation.d.ts.map +1 -0
  218. package/{cjs → script}/lib/ast/nodes/annotation.js +26 -8
  219. package/script/lib/ast/nodes/argument.d.ts +21 -0
  220. package/script/lib/ast/nodes/argument.d.ts.map +1 -0
  221. package/{cjs → script}/lib/ast/nodes/argument.js +18 -6
  222. package/script/lib/ast/nodes/call.d.ts +23 -0
  223. package/script/lib/ast/nodes/call.d.ts.map +1 -0
  224. package/script/lib/ast/nodes/call.js +55 -0
  225. package/script/lib/ast/nodes/class.d.ts +55 -0
  226. package/script/lib/ast/nodes/class.d.ts.map +1 -0
  227. package/{cjs → script}/lib/ast/nodes/class.js +96 -18
  228. package/script/lib/ast/nodes/collection-literal.d.ts +18 -0
  229. package/script/lib/ast/nodes/collection-literal.d.ts.map +1 -0
  230. package/{cjs → script}/lib/ast/nodes/collection-literal.js +11 -5
  231. package/script/lib/ast/nodes/constructor.d.ts +35 -0
  232. package/script/lib/ast/nodes/constructor.d.ts.map +1 -0
  233. package/{cjs → script}/lib/ast/nodes/constructor.js +48 -12
  234. package/script/lib/ast/nodes/doc-tag.d.ts +35 -0
  235. package/script/lib/ast/nodes/doc-tag.d.ts.map +1 -0
  236. package/{cjs → script}/lib/ast/nodes/doc-tag.js +24 -6
  237. package/script/lib/ast/nodes/doc.d.ts +27 -0
  238. package/script/lib/ast/nodes/doc.d.ts.map +1 -0
  239. package/{cjs → script}/lib/ast/nodes/doc.js +26 -14
  240. package/script/lib/ast/nodes/enum-value.d.ts +31 -0
  241. package/script/lib/ast/nodes/enum-value.d.ts.map +1 -0
  242. package/{cjs → script}/lib/ast/nodes/enum-value.js +40 -10
  243. package/script/lib/ast/nodes/enum.d.ts +46 -0
  244. package/script/lib/ast/nodes/enum.d.ts.map +1 -0
  245. package/{cjs → script}/lib/ast/nodes/enum.js +69 -15
  246. package/script/lib/ast/nodes/function.d.ts +59 -0
  247. package/script/lib/ast/nodes/function.d.ts.map +1 -0
  248. package/{cjs → script}/lib/ast/nodes/function.js +129 -15
  249. package/script/lib/ast/nodes/generic-parameter.d.ts +22 -0
  250. package/script/lib/ast/nodes/generic-parameter.d.ts.map +1 -0
  251. package/{cjs → script}/lib/ast/nodes/generic-parameter.js +24 -6
  252. package/script/lib/ast/nodes/init-block.d.ts +17 -0
  253. package/script/lib/ast/nodes/init-block.d.ts.map +1 -0
  254. package/{cjs → script}/lib/ast/nodes/init-block.js +10 -4
  255. package/script/lib/ast/nodes/interface.d.ts +42 -0
  256. package/script/lib/ast/nodes/interface.d.ts.map +1 -0
  257. package/{cjs → script}/lib/ast/nodes/interface.js +61 -13
  258. package/script/lib/ast/nodes/lambda-type.d.ts +22 -0
  259. package/script/lib/ast/nodes/lambda-type.d.ts.map +1 -0
  260. package/{cjs → script}/lib/ast/nodes/lambda-type.js +27 -9
  261. package/script/lib/ast/nodes/lambda.d.ts +21 -0
  262. package/script/lib/ast/nodes/lambda.d.ts.map +1 -0
  263. package/{cjs → script}/lib/ast/nodes/lambda.js +23 -5
  264. package/script/lib/ast/nodes/object.d.ts +35 -0
  265. package/script/lib/ast/nodes/object.d.ts.map +1 -0
  266. package/{cjs → script}/lib/ast/nodes/object.js +52 -10
  267. package/script/lib/ast/nodes/parameter.d.ts +39 -0
  268. package/script/lib/ast/nodes/parameter.d.ts.map +1 -0
  269. package/{cjs → script}/lib/ast/nodes/parameter.js +70 -9
  270. package/script/lib/ast/nodes/property.d.ts +76 -0
  271. package/script/lib/ast/nodes/property.d.ts.map +1 -0
  272. package/{cjs → script}/lib/ast/nodes/property.js +145 -15
  273. package/script/lib/ast/nodes/reference.d.ts +48 -0
  274. package/script/lib/ast/nodes/reference.d.ts.map +1 -0
  275. package/{cjs → script}/lib/ast/nodes/reference.js +55 -14
  276. package/script/lib/ast/nodes/string.d.ts +31 -0
  277. package/script/lib/ast/nodes/string.d.ts.map +1 -0
  278. package/{cjs → script}/lib/ast/nodes/string.js +42 -6
  279. package/script/lib/ast/nodes/types.d.ts +11 -0
  280. package/script/lib/ast/nodes/types.d.ts.map +1 -0
  281. package/script/lib/ast/references/index.d.ts +9 -0
  282. package/script/lib/ast/references/index.d.ts.map +1 -0
  283. package/script/lib/ast/references/index.js +12 -0
  284. package/script/lib/ast/references/jackson.d.ts +92 -0
  285. package/script/lib/ast/references/jackson.d.ts.map +1 -0
  286. package/script/lib/ast/references/jackson.js +12 -0
  287. package/script/lib/ast/references/jakarta.d.ts +40 -0
  288. package/script/lib/ast/references/jakarta.d.ts.map +1 -0
  289. package/script/lib/ast/references/jakarta.js +10 -0
  290. package/script/lib/ast/references/java.d.ts +95 -0
  291. package/script/lib/ast/references/java.d.ts.map +1 -0
  292. package/script/lib/ast/references/java.js +15 -0
  293. package/script/lib/ast/references/kotlin.d.ts +301 -0
  294. package/script/lib/ast/references/kotlin.d.ts.map +1 -0
  295. package/script/lib/ast/references/kotlin.js +28 -0
  296. package/script/lib/ast/references/okhttp3.d.ts +27 -0
  297. package/script/lib/ast/references/okhttp3.d.ts.map +1 -0
  298. package/script/lib/ast/references/okhttp3.js +7 -0
  299. package/script/lib/ast/references/reactor.d.ts +33 -0
  300. package/script/lib/ast/references/reactor.d.ts.map +1 -0
  301. package/script/lib/ast/references/reactor.js +7 -0
  302. package/script/lib/ast/references/spring.d.ts +173 -0
  303. package/script/lib/ast/references/spring.d.ts.map +1 -0
  304. package/script/lib/ast/references/spring.js +24 -0
  305. package/script/lib/ast/references/swagger.d.ts +53 -0
  306. package/script/lib/ast/references/swagger.d.ts.map +1 -0
  307. package/script/lib/ast/references/swagger.js +11 -0
  308. package/script/lib/ast/utils/get-kotlin-builder-options.d.ts +4 -0
  309. package/script/lib/ast/utils/get-kotlin-builder-options.d.ts.map +1 -0
  310. package/{cjs → script}/lib/ast/utils/get-kotlin-builder-options.js +4 -4
  311. package/script/lib/ast/utils/to-kt-node.d.ts +8 -0
  312. package/script/lib/ast/utils/to-kt-node.d.ts.map +1 -0
  313. package/script/lib/ast/utils/to-kt-node.js +21 -0
  314. package/script/lib/ast/utils/write-kt-annotations.d.ts +6 -0
  315. package/script/lib/ast/utils/write-kt-annotations.d.ts.map +1 -0
  316. package/{cjs → script}/lib/ast/utils/write-kt-annotations.js +2 -2
  317. package/script/lib/ast/utils/write-kt-arguments.d.ts +4 -0
  318. package/script/lib/ast/utils/write-kt-arguments.d.ts.map +1 -0
  319. package/{cjs → script}/lib/ast/utils/write-kt-arguments.js +6 -6
  320. package/script/lib/ast/utils/write-kt-enum-values.d.ts +4 -0
  321. package/script/lib/ast/utils/write-kt-enum-values.d.ts.map +1 -0
  322. package/{cjs → script}/lib/ast/utils/write-kt-enum-values.js +2 -2
  323. package/script/lib/ast/utils/write-kt-generic-parameters.d.ts +4 -0
  324. package/script/lib/ast/utils/write-kt-generic-parameters.d.ts.map +1 -0
  325. package/{cjs → script}/lib/ast/utils/write-kt-generic-parameters.js +2 -2
  326. package/script/lib/ast/utils/write-kt-members.d.ts +6 -0
  327. package/script/lib/ast/utils/write-kt-members.d.ts.map +1 -0
  328. package/{cjs → script}/lib/ast/utils/write-kt-members.js +5 -5
  329. package/script/lib/ast/utils/write-kt-node.d.ts +8 -0
  330. package/script/lib/ast/utils/write-kt-node.d.ts.map +1 -0
  331. package/{cjs → script}/lib/ast/utils/write-kt-node.js +2 -2
  332. package/script/lib/ast/utils/write-kt-parameters.d.ts +4 -0
  333. package/script/lib/ast/utils/write-kt-parameters.d.ts.map +1 -0
  334. package/{cjs → script}/lib/ast/utils/write-kt-parameters.js +2 -2
  335. package/script/lib/common-results.d.ts +5 -0
  336. package/script/lib/common-results.d.ts.map +1 -0
  337. package/script/lib/config.d.ts +11 -0
  338. package/script/lib/config.d.ts.map +1 -0
  339. package/script/lib/file-builder.d.ts +22 -0
  340. package/script/lib/file-builder.d.ts.map +1 -0
  341. package/{cjs → script}/lib/file-builder.js +18 -7
  342. package/script/lib/generators/file-generator.d.ts +9 -0
  343. package/script/lib/generators/file-generator.d.ts.map +1 -0
  344. package/script/lib/generators/file-generator.js +17 -0
  345. package/script/lib/generators/index.d.ts +5 -0
  346. package/script/lib/generators/index.d.ts.map +1 -0
  347. package/script/lib/generators/index.js +7 -0
  348. package/script/lib/generators/models/args.d.ts +100 -0
  349. package/script/lib/generators/models/args.d.ts.map +1 -0
  350. package/script/lib/generators/models/index.d.ts +5 -0
  351. package/script/lib/generators/models/index.d.ts.map +1 -0
  352. package/{cjs → script}/lib/generators/models/index.js +4 -4
  353. package/script/lib/generators/models/model-generator.d.ts +48 -0
  354. package/script/lib/generators/models/model-generator.d.ts.map +1 -0
  355. package/{cjs → script}/lib/generators/models/model-generator.js +87 -85
  356. package/script/lib/generators/models/models-generator.d.ts +18 -0
  357. package/script/lib/generators/models/models-generator.d.ts.map +1 -0
  358. package/{cjs → script}/lib/generators/models/models-generator.js +10 -4
  359. package/script/lib/generators/models/models.d.ts +61 -0
  360. package/script/lib/generators/models/models.d.ts.map +1 -0
  361. package/{cjs → script}/lib/generators/models/models.js +2 -2
  362. package/script/lib/generators/services/okhttp3-clients/args.d.ts +76 -0
  363. package/script/lib/generators/services/okhttp3-clients/args.d.ts.map +1 -0
  364. package/script/lib/generators/services/okhttp3-clients/index.d.ts +5 -0
  365. package/script/lib/generators/services/okhttp3-clients/index.d.ts.map +1 -0
  366. package/{cjs → script}/lib/generators/services/okhttp3-clients/index.js +4 -4
  367. package/script/lib/generators/services/okhttp3-clients/models.d.ts +33 -0
  368. package/script/lib/generators/services/okhttp3-clients/models.d.ts.map +1 -0
  369. package/{cjs → script}/lib/generators/services/okhttp3-clients/models.js +2 -2
  370. package/script/lib/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +44 -0
  371. package/script/lib/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts.map +1 -0
  372. package/{cjs → script}/lib/generators/services/okhttp3-clients/okhttp3-client-generator.js +96 -100
  373. package/script/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts +23 -0
  374. package/script/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts.map +1 -0
  375. package/{cjs → script}/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.js +35 -20
  376. package/script/lib/generators/services/okhttp3-clients/refs.d.ts +252 -0
  377. package/script/lib/generators/services/okhttp3-clients/refs.d.ts.map +1 -0
  378. package/script/lib/generators/services/okhttp3-clients/refs.js +33 -0
  379. package/script/lib/generators/services/spring-controllers/args.d.ts +72 -0
  380. package/script/lib/generators/services/spring-controllers/args.d.ts.map +1 -0
  381. package/script/lib/generators/services/spring-controllers/index.d.ts +5 -0
  382. package/script/lib/generators/services/spring-controllers/index.d.ts.map +1 -0
  383. package/script/lib/generators/services/spring-controllers/index.js +8 -0
  384. package/script/lib/generators/services/spring-controllers/models.d.ts +31 -0
  385. package/script/lib/generators/services/spring-controllers/models.d.ts.map +1 -0
  386. package/{cjs → script}/lib/generators/services/spring-controllers/models.js +2 -2
  387. package/script/lib/generators/services/spring-controllers/spring-controller-generator.d.ts +54 -0
  388. package/script/lib/generators/services/spring-controllers/spring-controller-generator.d.ts.map +1 -0
  389. package/{cjs → script}/lib/generators/services/spring-controllers/spring-controller-generator.js +88 -87
  390. package/script/lib/generators/services/spring-controllers/spring-controllers-generator.d.ts +18 -0
  391. package/script/lib/generators/services/spring-controllers/spring-controllers-generator.d.ts.map +1 -0
  392. package/{cjs → script}/lib/generators/services/spring-controllers/spring-controllers-generator.js +10 -5
  393. package/script/lib/import-collection.d.ts +20 -0
  394. package/script/lib/import-collection.d.ts.map +1 -0
  395. package/{cjs → script}/lib/import-collection.js +14 -3
  396. package/script/lib/types.d.ts +8 -0
  397. package/script/lib/types.d.ts.map +1 -0
  398. package/script/lib/utils.d.ts +5 -0
  399. package/script/lib/utils.d.ts.map +1 -0
  400. package/script/package.json +3 -0
  401. package/cjs/index.js +0 -11
  402. package/cjs/lib/ast/_index.js +0 -81
  403. package/cjs/lib/ast/nodes/call.js +0 -37
  404. package/cjs/lib/ast/references/index.js +0 -12
  405. package/cjs/lib/ast/references/jackson.js +0 -12
  406. package/cjs/lib/ast/references/jakarta.js +0 -10
  407. package/cjs/lib/ast/references/java.js +0 -15
  408. package/cjs/lib/ast/references/kotlin.js +0 -28
  409. package/cjs/lib/ast/references/okhttp3.js +0 -7
  410. package/cjs/lib/ast/references/reactor.js +0 -7
  411. package/cjs/lib/ast/references/spring.js +0 -24
  412. package/cjs/lib/ast/references/swagger.js +0 -11
  413. package/cjs/lib/ast/utils/to-kt-node.js +0 -21
  414. package/cjs/lib/generators/file-generator.js +0 -17
  415. package/cjs/lib/generators/index.js +0 -7
  416. package/cjs/lib/generators/services/okhttp3-clients/refs.js +0 -33
  417. package/cjs/lib/generators/services/spring-controllers/index.js +0 -8
  418. package/cjs/package.json +0 -1
  419. package/types/index.d.ts +0 -8
  420. package/types/lib/ast/_index.d.ts +0 -28
  421. package/types/lib/ast/index.d.ts +0 -1
  422. package/types/lib/ast/nodes/types.d.ts +0 -10
  423. package/types/lib/ast/references/index.d.ts +0 -8
  424. package/types/lib/ast/references/jackson.d.ts +0 -91
  425. package/types/lib/ast/references/jakarta.d.ts +0 -39
  426. package/types/lib/ast/references/java.d.ts +0 -94
  427. package/types/lib/ast/references/kotlin.d.ts +0 -300
  428. package/types/lib/ast/references/okhttp3.d.ts +0 -26
  429. package/types/lib/ast/references/reactor.d.ts +0 -32
  430. package/types/lib/ast/references/spring.d.ts +0 -172
  431. package/types/lib/ast/references/swagger.d.ts +0 -52
  432. package/types/lib/ast/utils/get-kotlin-builder-options.d.ts +0 -3
  433. package/types/lib/ast/utils/write-kt-arguments.d.ts +0 -3
  434. package/types/lib/ast/utils/write-kt-enum-values.d.ts +0 -3
  435. package/types/lib/ast/utils/write-kt-generic-parameters.d.ts +0 -3
  436. package/types/lib/ast/utils/write-kt-parameters.d.ts +0 -3
  437. package/types/lib/generators/file-generator.d.ts +0 -8
  438. package/types/lib/generators/index.d.ts +0 -4
  439. package/types/lib/generators/models/index.d.ts +0 -4
  440. package/types/lib/generators/services/okhttp3-clients/index.d.ts +0 -4
  441. package/types/lib/generators/services/okhttp3-clients/refs.d.ts +0 -251
  442. package/types/lib/generators/services/spring-controllers/index.d.ts +0 -4
  443. /package/{cjs → script}/lib/ast/common.js +0 -0
  444. /package/{cjs → script}/lib/ast/node.js +0 -0
  445. /package/{cjs → script}/lib/ast/nodes/types.js +0 -0
  446. /package/{cjs → script}/lib/common-results.js +0 -0
  447. /package/{cjs → script}/lib/config.js +0 -0
  448. /package/{cjs → script}/lib/generators/models/args.js +0 -0
  449. /package/{cjs → script}/lib/generators/services/okhttp3-clients/args.js +0 -0
  450. /package/{cjs → script}/lib/generators/services/spring-controllers/args.js +0 -0
  451. /package/{cjs → script}/lib/types.js +0 -0
  452. /package/{cjs → script}/lib/utils.js +0 -0
@@ -0,0 +1,33 @@
1
+ import type { ApiEndpoint, ApiService, DefaultGenerationProviderConfig, OpenApiServicesGenerationProviderContext } from '@goast/core';
2
+ import type { getReferenceFactories } from './refs.js';
3
+ import type { KotlinImport } from '../../../common-results.js';
4
+ import { type KotlinGeneratorConfig } from '../../../config.js';
5
+ import type { KotlinModelsGeneratorOutput } from '../../models/index.js';
6
+ export type KotlinOkHttp3ClientsGeneratorConfig = KotlinGeneratorConfig & {
7
+ packageName: string;
8
+ packageSuffix: string | ((service?: ApiService) => string);
9
+ infrastructurePackageName: string | {
10
+ mode: 'append-package-name' | 'append-full-package-name' | 'replace';
11
+ value: string;
12
+ };
13
+ basePath?: string | RegExp | ((basePath: string, service: ApiService) => string);
14
+ pathModifier?: RegExp | ((path: string, endpoint: ApiEndpoint) => string);
15
+ };
16
+ export declare const defaultKotlinOkHttp3ClientsGeneratorConfig: DefaultGenerationProviderConfig<KotlinOkHttp3ClientsGeneratorConfig>;
17
+ export type KotlinOkHttp3ClientsGeneratorInput = KotlinModelsGeneratorOutput;
18
+ export type KotlinOkHttp3ClientsGeneratorOutput = {
19
+ kotlin: {
20
+ clients: {
21
+ [serviceId: string]: KotlinOkHttp3ClientGeneratorOutput;
22
+ };
23
+ };
24
+ };
25
+ export type KotlinOkHttp3ClientGeneratorOutput = KotlinImport;
26
+ export type KotlinOkHttp3ClientsGeneratorContext = OpenApiServicesGenerationProviderContext<KotlinOkHttp3ClientsGeneratorInput, KotlinOkHttp3ClientsGeneratorOutput, KotlinOkHttp3ClientsGeneratorConfig, KotlinOkHttp3ClientGeneratorOutput> & {
27
+ infrastructurePackageName: string;
28
+ refs: ReturnType<typeof getReferenceFactories>;
29
+ };
30
+ export type KotlinOkHttp3ClientGeneratorContext = KotlinOkHttp3ClientsGeneratorContext & {
31
+ service: ApiService;
32
+ };
33
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/lib/generators/services/okhttp3-clients/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,+BAA+B,EAC/B,wCAAwC,EACzC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE,MAAM,MAAM,mCAAmC,GAAG,qBAAqB,GAAG;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC;IAC3D,yBAAyB,EACrB,MAAM,GACN;QAAE,IAAI,EAAE,qBAAqB,GAAG,0BAA0B,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAE5F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC;IACjF,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,KAAK,MAAM,CAAC,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,0CAA0C,EAAE,+BAA+B,CACtF,mCAAmC,CAOpC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,2BAA2B,CAAC;AAE7E,MAAM,MAAM,mCAAmC,GAAG;IAChD,MAAM,EAAE;QACN,OAAO,EAAE;YACP,CAAC,SAAS,EAAE,MAAM,GAAG,kCAAkC,CAAC;SACzD,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,YAAY,CAAC;AAE9D,MAAM,MAAM,oCAAoC,GAC5C,wCAAwC,CACxC,kCAAkC,EAClC,mCAAmC,EACnC,mCAAmC,EACnC,kCAAkC,CACnC,GACC;IACA,yBAAyB,EAAE,MAAM,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CAChD,CAAC;AAEJ,MAAM,MAAM,mCAAmC,GAAG,oCAAoC,GAAG;IACvF,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultKotlinOkHttp3ClientsGeneratorConfig = void 0;
4
- const config_1 = require("../../../config");
4
+ const config_js_1 = require("../../../config.js");
5
5
  exports.defaultKotlinOkHttp3ClientsGeneratorConfig = {
6
- ...config_1.defaultKotlinGeneratorConfig,
6
+ ...config_js_1.defaultKotlinGeneratorConfig,
7
7
  packageName: 'com.openapi.generated',
8
8
  packageSuffix: '.api.client',
9
9
  infrastructurePackageName: { mode: 'append-full-package-name', value: '.infrastructure' },
@@ -0,0 +1,44 @@
1
+ import { type ApiSchema, type AppendValueGroup, type MaybePromise, SourceBuilder } from '@goast/core';
2
+ import type { DefaultKotlinOkHttp3GeneratorArgs as Args } from './index.js';
3
+ import type { KotlinOkHttp3ClientGeneratorContext, KotlinOkHttp3ClientGeneratorOutput } from './models.js';
4
+ import { kt } from '../../../ast/index.js';
5
+ import type { KotlinImport } from '../../../common-results.js';
6
+ import { KotlinFileBuilder } from '../../../file-builder.js';
7
+ import type { ApiParameterWithMultipartInfo } from '../../../types.js';
8
+ import { KotlinFileGenerator } from '../../file-generator.js';
9
+ type Context = KotlinOkHttp3ClientGeneratorContext;
10
+ type Output = KotlinOkHttp3ClientGeneratorOutput;
11
+ type Builder = KotlinFileBuilder;
12
+ export interface KotlinOkHttp3Generator<TOutput extends Output = Output> {
13
+ generate(ctx: Context): MaybePromise<TOutput>;
14
+ }
15
+ export declare class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator<Context, Output> implements KotlinOkHttp3Generator {
16
+ generate(ctx: KotlinOkHttp3ClientGeneratorContext): MaybePromise<KotlinImport>;
17
+ protected getClientFileContent(ctx: Context, _args: Args.GetClientFileContent): AppendValueGroup<Builder>;
18
+ protected getClientClass(ctx: Context, _args: Args.GetClientClass): kt.Class<Builder>;
19
+ protected getClientCompanionObject(ctx: Context, _args: Args.GetClientCompanionObject): kt.Object<Builder>;
20
+ protected getEndpointClientMembers(ctx: Context, args: Args.GetEndpointClientMembers): kt.ClassMember<Builder>[];
21
+ protected getEndpointClientMethod(ctx: Context, args: Args.GetEndpointClientMethod): kt.Function<Builder>;
22
+ protected getEndpointClientMethodBody(ctx: Context, args: Args.GetEndpointClientMethodBody): AppendValueGroup<Builder>;
23
+ protected getEndpointClientHttpInfoMethod(ctx: Context, args: Args.GetEndpointClientHttpInfoMethod): kt.Function<Builder>;
24
+ protected getEndpointClientHttpInfoMethodBody(ctx: Context, args: Args.GetEndpointClientHttpInfoMethodBody): AppendValueGroup<Builder>;
25
+ protected getEndpointClientRequestConfigMethod(ctx: Context, args: Args.GetEndpointClientRequestConfigMethod): kt.Function<Builder>;
26
+ protected getEndpointClientRequestConfigMethodBody(ctx: Context, args: Args.GetEndpointClientRequestConfigMethodBody): AppendValueGroup<Builder>;
27
+ protected getAdditionalClientMembers(_ctx: Context, _args: Args.GetAdditionalClientMembers): kt.ClassMember<Builder>[];
28
+ protected getParameterType(ctx: Context, args: Args.GetParameterType): kt.Type<Builder>;
29
+ protected getRequestBodyType(ctx: Context, args: Args.GetRequestBodyType): kt.Type<Builder>;
30
+ protected getTypeUsage(ctx: Context, args: Args.GetTypeUsage<Builder>): kt.Type<Builder>;
31
+ protected getPackageName(ctx: Context, _args: Args.GetPackageName): string;
32
+ protected getPathWithInterpolation(ctx: Context, args: Args.GetPathWithInterpolation): string;
33
+ protected getResponseSchema(_ctx: Context, args: Args.GetResponseSchema): ApiSchema | undefined;
34
+ protected getSchemaType(ctx: Context, args: Args.GetSchemaType): kt.Reference<SourceBuilder<never>, never> | undefined;
35
+ protected getAllParameters(ctx: Context, args: Args.GetAllParameters): ApiParameterWithMultipartInfo[];
36
+ protected getRequestBodyParamName(ctx: Context, args: Args.GetRequestBodyParamName): string;
37
+ protected getBasePath(ctx: Context, _args: Args.GetBasePath): string;
38
+ protected getEndpointPath(ctx: Context, args: Args.GetEndpointPath): string;
39
+ protected getFilePath(ctx: Context, args: Args.GetFilePath): string;
40
+ protected getApiClientName(ctx: Context, _args: Args.GetApiClientName): string;
41
+ private createApiParameter;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=okhttp3-client-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okhttp3-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/generators/services/okhttp3-clients/okhttp3-client-generator.ts"],"names":[],"mappings":"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"}
@@ -2,41 +2,39 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultKotlinOkHttp3Generator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- /* eslint-disable unused-imports/no-unused-vars */
6
- const fs_1 = require("fs");
7
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
8
6
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
7
  const core_1 = require("@goast/core");
10
- const ast_1 = require("../../../ast");
11
- const file_builder_1 = require("../../../file-builder");
12
- const utils_1 = require("../../../utils");
13
- const file_generator_1 = require("../../file-generator");
14
- class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator {
8
+ const index_js_1 = require("../../../ast/index.js");
9
+ const file_builder_js_1 = require("../../../file-builder.js");
10
+ const utils_js_1 = require("../../../utils.js");
11
+ const file_generator_js_1 = require("../../file-generator.js");
12
+ class DefaultKotlinOkHttp3Generator extends file_generator_js_1.KotlinFileGenerator {
15
13
  generate(ctx) {
16
14
  const typeName = this.getApiClientName(ctx, {});
17
15
  const packageName = this.getPackageName(ctx, {});
18
16
  const filePath = this.getFilePath(ctx, { packageName });
19
- fs_extra_1.default.ensureDirSync((0, path_1.dirname)(filePath));
17
+ fs_extra_1.default.ensureDirSync((0, node_path_1.dirname)(filePath));
20
18
  console.log(`Generating client for service ${ctx.service.name} to ${filePath}...`);
21
- const builder = new file_builder_1.KotlinFileBuilder(packageName, ctx.config);
19
+ const builder = new file_builder_js_1.KotlinFileBuilder(packageName, ctx.config);
22
20
  builder.append(this.getClientFileContent(ctx, {}));
23
- (0, fs_1.writeFileSync)(filePath, builder.toString());
21
+ fs_extra_1.default.writeFileSync(filePath, builder.toString());
24
22
  return { typeName, packageName };
25
23
  }
26
- getClientFileContent(ctx, args) {
24
+ getClientFileContent(ctx, _args) {
27
25
  return (0, core_1.appendValueGroup)([this.getClientClass(ctx, {})]);
28
26
  }
29
- getClientClass(ctx, args) {
30
- return ast_1.kt.class(this.getApiClientName(ctx, {}), {
27
+ getClientClass(ctx, _args) {
28
+ return index_js_1.kt.class(this.getApiClientName(ctx, {}), {
31
29
  annotations: [
32
30
  ctx.service.endpoints.length === 0 || ctx.service.endpoints.some((x) => !x.deprecated)
33
31
  ? null
34
- : ast_1.kt.annotation(ast_1.kt.refs.deprecated(), [ast_1.kt.argument(ast_1.kt.string(''))]),
32
+ : index_js_1.kt.annotation(index_js_1.kt.refs.deprecated(), [index_js_1.kt.argument(index_js_1.kt.string(''))]),
35
33
  ],
36
34
  extends: ctx.refs.apiClient(),
37
- primaryConstructor: ast_1.kt.constructor([
38
- ast_1.kt.parameter('basePath', ast_1.kt.refs.string(), { default: 'defaultBasePath' }),
39
- ast_1.kt.parameter('client', ast_1.kt.refs.okhttp3.okHttpClient(), { default: ast_1.kt.call(['ApiClient', 'defaultClient']) }),
35
+ primaryConstructor: index_js_1.kt.constructor([
36
+ index_js_1.kt.parameter('basePath', index_js_1.kt.refs.string(), { default: 'defaultBasePath' }),
37
+ index_js_1.kt.parameter('client', index_js_1.kt.refs.okhttp3.okHttpClient(), { default: index_js_1.kt.call(['ApiClient', 'defaultClient']) }),
40
38
  ], null, {
41
39
  delegateTarget: 'super',
42
40
  delegateArguments: ['basePath', 'client'],
@@ -48,14 +46,14 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
48
46
  ],
49
47
  });
50
48
  }
51
- getClientCompanionObject(ctx, args) {
52
- const result = ast_1.kt.object();
53
- result.members.push(ast_1.kt.property('defaultBasePath', {
54
- annotations: [ast_1.kt.annotation(ast_1.kt.refs.jvmStatic())],
55
- type: ast_1.kt.refs.string(),
56
- delegate: ast_1.kt.refs.lazyFun.infer(),
49
+ getClientCompanionObject(ctx, _args) {
50
+ const result = index_js_1.kt.object();
51
+ result.members.push(index_js_1.kt.property('defaultBasePath', {
52
+ annotations: [index_js_1.kt.annotation(index_js_1.kt.refs.jvmStatic())],
53
+ type: index_js_1.kt.refs.string(),
54
+ delegate: index_js_1.kt.refs.lazyFun.infer(),
57
55
  delegateArguments: [
58
- ast_1.kt.lambda([], ast_1.kt.call([ast_1.kt.call([ast_1.kt.refs.java.system(), 'getProperties'], []), 'getProperty'], [ast_1.kt.call([ctx.refs.apiClient(), 'baseUrlKey']), ast_1.kt.string(this.getBasePath(ctx, {}))])),
56
+ index_js_1.kt.lambda([], index_js_1.kt.call([index_js_1.kt.call([index_js_1.kt.refs.java.system(), 'getProperties'], []), 'getProperty'], [index_js_1.kt.call([ctx.refs.apiClient(), 'baseUrlKey']), index_js_1.kt.string(this.getBasePath(ctx, {}))])),
59
57
  ],
60
58
  }));
61
59
  return result;
@@ -71,48 +69,48 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
71
69
  }
72
70
  getEndpointClientMethod(ctx, args) {
73
71
  const { endpoint, parameters, responseSchema } = args;
74
- return ast_1.kt.function((0, core_1.toCasing)(endpoint.name, ctx.config.functionNameCasing), {
75
- doc: ast_1.kt.doc(endpoint.summary, [
76
- ast_1.kt.docTag('throws', 'IllegalStateException', 'If the request is not correctly configured'),
77
- ast_1.kt.docTag('throws', 'IOException', 'Rethrows the OkHttp execute method exception'),
78
- ast_1.kt.docTag('throws', 'UnsupportedOperationException', 'If the API returns an informational or redirection response'),
79
- ast_1.kt.docTag('throws', 'ClientException', 'If the API returns a client error response'),
80
- ast_1.kt.docTag('throws', 'ServerException', 'If the API returns a server error response'),
72
+ return index_js_1.kt.function((0, core_1.toCasing)(endpoint.name, ctx.config.functionNameCasing), {
73
+ doc: index_js_1.kt.doc(endpoint.summary, [
74
+ index_js_1.kt.docTag('throws', 'IllegalStateException', 'If the request is not correctly configured'),
75
+ index_js_1.kt.docTag('throws', 'IOException', 'Rethrows the OkHttp execute method exception'),
76
+ index_js_1.kt.docTag('throws', 'UnsupportedOperationException', 'If the API returns an informational or redirection response'),
77
+ index_js_1.kt.docTag('throws', 'ClientException', 'If the API returns a client error response'),
78
+ index_js_1.kt.docTag('throws', 'ServerException', 'If the API returns a server error response'),
81
79
  ]),
82
80
  annotations: [
83
- ast_1.kt.annotation(ast_1.kt.refs.throws(), [
84
- ast_1.kt.refs.java.illegalStateException({ classReference: true }),
85
- ast_1.kt.refs.java.ioException({ classReference: true }),
86
- ast_1.kt.refs.java.unsupportedOperationException({ classReference: true }),
81
+ index_js_1.kt.annotation(index_js_1.kt.refs.throws(), [
82
+ index_js_1.kt.refs.java.illegalStateException({ classReference: true }),
83
+ index_js_1.kt.refs.java.ioException({ classReference: true }),
84
+ index_js_1.kt.refs.java.unsupportedOperationException({ classReference: true }),
87
85
  ctx.refs.clientException({ classReference: true }),
88
86
  ctx.refs.serverException({ classReference: true }),
89
87
  ]),
90
- endpoint.deprecated ? ast_1.kt.annotation(ast_1.kt.refs.deprecated(), [ast_1.kt.argument(ast_1.kt.string(''))]) : null,
88
+ endpoint.deprecated ? index_js_1.kt.annotation(index_js_1.kt.refs.deprecated(), [index_js_1.kt.argument(index_js_1.kt.string(''))]) : null,
91
89
  ],
92
90
  parameters: parameters.map((p) => {
93
91
  var _a;
94
- return ast_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
92
+ return index_js_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
95
93
  description: p.description,
96
- default: !p.required ? ast_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
94
+ default: !p.required ? index_js_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
97
95
  });
98
96
  }),
99
- returnType: this.getTypeUsage(ctx, { schema: responseSchema, fallback: ast_1.kt.refs.unit() }),
97
+ returnType: this.getTypeUsage(ctx, { schema: responseSchema, fallback: index_js_1.kt.refs.unit() }),
100
98
  body: this.getEndpointClientMethodBody(ctx, { endpoint, parameters, responseSchema }),
101
99
  });
102
100
  }
103
101
  getEndpointClientMethodBody(ctx, args) {
104
102
  const { endpoint, parameters, responseSchema } = args;
105
103
  return (0, core_1.appendValueGroup)([
106
- (0, core_1.builderTemplate) `val localVarResponse = ${ast_1.kt.call([(0, core_1.toCasing)(endpoint.name + '_WithHttpInfo', ctx.config.functionNameCasing)], parameters.map((x) => x.name))}`,
104
+ (0, core_1.builderTemplate) `val localVarResponse = ${index_js_1.kt.call([(0, core_1.toCasing)(endpoint.name + '_WithHttpInfo', ctx.config.functionNameCasing)], parameters.map((x) => x.name))}`,
107
105
  '',
108
106
  (0, core_1.builderTemplate) `return when (localVarResponse.responseType) {${core_1.builderTemplate.indent `
109
107
  ${ctx.refs.responseType()}.Success -> ${responseSchema === undefined
110
- ? ast_1.kt.refs.unit()
108
+ ? index_js_1.kt.refs.unit()
111
109
  : (0, core_1.builderTemplate) `(localVarResponse as ${ctx.refs.success(['*'])}).data as ${this.getTypeUsage(ctx, {
112
110
  schema: responseSchema,
113
111
  })}`}
114
- ${ctx.refs.responseType()}.Informational -> throw ${ast_1.kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
115
- ${ctx.refs.responseType()}.Redirection -> throw ${ast_1.kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
112
+ ${ctx.refs.responseType()}.Informational -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
113
+ ${ctx.refs.responseType()}.Redirection -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
116
114
  ${ctx.refs.responseType()}.ClientError -> {${core_1.builderTemplate.indent `
117
115
  val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
118
116
  throw ${ctx.refs.clientException()}(${core_1.builderTemplate.indent `
@@ -135,27 +133,27 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
135
133
  }
136
134
  getEndpointClientHttpInfoMethod(ctx, args) {
137
135
  const { endpoint, parameters, responseSchema } = args;
138
- return ast_1.kt.function((0, core_1.toCasing)(args.endpoint.name, ctx.config.functionNameCasing) + 'WithHttpInfo', {
139
- doc: ast_1.kt.doc(endpoint.summary, [
140
- ast_1.kt.docTag('throws', 'IllegalStateException', 'If the request is not correctly configured'),
141
- ast_1.kt.docTag('throws', 'IOException', 'Rethrows the OkHttp execute method exception'),
136
+ return index_js_1.kt.function((0, core_1.toCasing)(args.endpoint.name, ctx.config.functionNameCasing) + 'WithHttpInfo', {
137
+ doc: index_js_1.kt.doc(endpoint.summary, [
138
+ index_js_1.kt.docTag('throws', 'IllegalStateException', 'If the request is not correctly configured'),
139
+ index_js_1.kt.docTag('throws', 'IOException', 'Rethrows the OkHttp execute method exception'),
142
140
  ]),
143
141
  annotations: [
144
- ast_1.kt.annotation(ast_1.kt.refs.throws(), [
145
- ast_1.kt.refs.java.illegalStateException({ classReference: true }),
146
- ast_1.kt.refs.java.ioException({ classReference: true }),
142
+ index_js_1.kt.annotation(index_js_1.kt.refs.throws(), [
143
+ index_js_1.kt.refs.java.illegalStateException({ classReference: true }),
144
+ index_js_1.kt.refs.java.ioException({ classReference: true }),
147
145
  ]),
148
- endpoint.deprecated ? ast_1.kt.annotation(ast_1.kt.refs.deprecated(), [ast_1.kt.argument(ast_1.kt.string(''))]) : null,
146
+ endpoint.deprecated ? index_js_1.kt.annotation(index_js_1.kt.refs.deprecated(), [index_js_1.kt.argument(index_js_1.kt.string(''))]) : null,
149
147
  ],
150
148
  parameters: parameters.map((p) => {
151
149
  var _a;
152
- return ast_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
150
+ return index_js_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
153
151
  description: p.description,
154
- default: !p.required ? ast_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
152
+ default: !p.required ? index_js_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
155
153
  });
156
154
  }),
157
155
  returnType: ctx.refs.apiResponse([
158
- this.getTypeUsage(ctx, { schema: responseSchema, fallback: ast_1.kt.refs.unit({ nullable: true }), nullable: true }),
156
+ this.getTypeUsage(ctx, { schema: responseSchema, fallback: index_js_1.kt.refs.unit({ nullable: true }), nullable: true }),
159
157
  ]),
160
158
  body: this.getEndpointClientHttpInfoMethodBody(ctx, { endpoint, parameters, responseSchema }),
161
159
  });
@@ -163,12 +161,12 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
163
161
  getEndpointClientHttpInfoMethodBody(ctx, args) {
164
162
  const { endpoint, parameters, responseSchema } = args;
165
163
  return (0, core_1.appendValueGroup)([
166
- (0, core_1.builderTemplate) `val localVariableConfig = ${ast_1.kt.call([(0, core_1.toCasing)(endpoint.name, 'camel') + 'RequestConfig'], parameters.map((x) => x.name))}`,
167
- (0, core_1.builderTemplate) `return ${ast_1.kt.call([
168
- ast_1.kt.reference('request', null, {
164
+ (0, core_1.builderTemplate) `val localVariableConfig = ${index_js_1.kt.call([(0, core_1.toCasing)(endpoint.name, 'camel') + 'RequestConfig'], parameters.map((x) => x.name))}`,
165
+ (0, core_1.builderTemplate) `return ${index_js_1.kt.call([
166
+ index_js_1.kt.reference('request', null, {
169
167
  generics: [
170
168
  this.getRequestBodyType(ctx, { endpoint }),
171
- this.getTypeUsage(ctx, { schema: responseSchema, fallback: ast_1.kt.refs.unit() }),
169
+ this.getTypeUsage(ctx, { schema: responseSchema, fallback: index_js_1.kt.refs.unit() }),
172
170
  ],
173
171
  }),
174
172
  ], ['localVariableConfig'])}`,
@@ -177,15 +175,15 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
177
175
  getEndpointClientRequestConfigMethod(ctx, args) {
178
176
  const { endpoint, parameters } = args;
179
177
  const operationName = (0, core_1.toCasing)(endpoint.name, ctx.config.functionNameCasing);
180
- return ast_1.kt.function((0, core_1.toCasing)(args.endpoint.name, ctx.config.functionNameCasing) + 'RequestConfig', {
178
+ return index_js_1.kt.function((0, core_1.toCasing)(args.endpoint.name, ctx.config.functionNameCasing) + 'RequestConfig', {
181
179
  accessModifier: 'private',
182
- doc: ast_1.kt.doc(`To obtain the request config of the operation ${operationName}`),
183
- annotations: [endpoint.deprecated ? ast_1.kt.annotation(ast_1.kt.refs.deprecated(), [ast_1.kt.argument(ast_1.kt.string(''))]) : null],
180
+ doc: index_js_1.kt.doc(`To obtain the request config of the operation ${operationName}`),
181
+ annotations: [endpoint.deprecated ? index_js_1.kt.annotation(index_js_1.kt.refs.deprecated(), [index_js_1.kt.argument(index_js_1.kt.string(''))]) : null],
184
182
  parameters: parameters.map((p) => {
185
183
  var _a;
186
- return ast_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
184
+ return index_js_1.kt.parameter((0, core_1.toCasing)(p.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter: p }), {
187
185
  description: p.description,
188
- default: !p.required ? ast_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
186
+ default: !p.required ? index_js_1.kt.toNode((_a = p.schema) === null || _a === void 0 ? void 0 : _a.default) : null,
189
187
  });
190
188
  }),
191
189
  returnType: ctx.refs.requestConfig([this.getRequestBodyType(ctx, { endpoint })]),
@@ -206,51 +204,47 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
206
204
  const paramName = (0, core_1.toCasing)(param.name, ctx.config.parameterNameCasing);
207
205
  return (0, core_1.builderTemplate) `"${(_b = (_a = param.multipart) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ''}" to ${ctx.refs.partConfig.infer()}(body = ${paramName})`;
208
206
  });
209
- result.values.push((0, core_1.builderTemplate) `val localVariableBody = ${ast_1.kt.call(ast_1.kt.refs.mapOf([ast_1.kt.refs.string(), ctx.refs.partConfig(['*'])]), partConfigs)}`);
207
+ result.values.push((0, core_1.builderTemplate) `val localVariableBody = ${index_js_1.kt.call(index_js_1.kt.refs.mapOf([index_js_1.kt.refs.string(), ctx.refs.partConfig(['*'])]), partConfigs)}`);
210
208
  }
211
209
  else {
212
210
  const bodyParamName = (0, core_1.toCasing)(this.getRequestBodyParamName(ctx, { endpoint }), ctx.config.parameterNameCasing);
213
211
  result.values.push(`val localVariableBody = ${bodyParamName}`);
214
212
  }
215
213
  }
216
- result.values.push((0, core_1.builderTemplate) `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${ast_1.kt.call([ast_1.kt.refs.mutableMapOf([ast_1.kt.refs.string(), ast_1.kt.refs.list([ast_1.kt.refs.string()])])], [])}${queryParameters.length === 0
217
- ? ''
218
- : core_1.builderTemplate.indent `
214
+ result.values.push((0, core_1.builderTemplate) `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${index_js_1.kt.call([index_js_1.kt.refs.mutableMapOf([index_js_1.kt.refs.string(), index_js_1.kt.refs.list([index_js_1.kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : core_1.builderTemplate.indent `
219
215
  .apply {${core_1.builderTemplate.indent `
220
216
  ${(0, core_1.appendValueGroup)(queryParameters.map((param) => {
221
- var _a;
222
- const paramName = (0, core_1.toCasing)(param.name, ctx.config.parameterNameCasing);
223
- const toString = ((_a = param.schema) === null || _a === void 0 ? void 0 : _a.kind) === 'array' ? '.joinToString()' : '.toString()';
224
- const put = (0, core_1.builderTemplate) `put(${ast_1.kt.string(paramName)}, listOf(${paramName}${toString}))`;
225
- return param.required
226
- ? put
227
- : (0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
217
+ var _a;
218
+ const paramName = (0, core_1.toCasing)(param.name, ctx.config.parameterNameCasing);
219
+ const toString = ((_a = param.schema) === null || _a === void 0 ? void 0 : _a.kind) === 'array' ? '.joinToString()' : '.toString()';
220
+ const put = (0, core_1.builderTemplate) `put(${index_js_1.kt.string(paramName)}, listOf(${paramName}${toString}))`;
221
+ return param.required ? put : (0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
228
222
  ${put}`}
229
223
  }`;
230
- }), '\n')}`}
224
+ }), '\n')}`}
231
225
  }`}`);
232
226
  result.values.push('val localVariableHeaders: MutableMap<String, String> = mutableMapOf()');
233
227
  if (((_b = endpoint.requestBody) === null || _b === void 0 ? void 0 : _b.content[0]) !== undefined) {
234
228
  result.values.push(`localVariableHeaders["Content-Type"] = "${(_c = endpoint.requestBody) === null || _c === void 0 ? void 0 : _c.content[0].type}"`);
235
229
  }
236
- result.values.push((0, core_1.builderTemplate) `return ${ast_1.kt.call([ctx.refs.requestConfig.infer()], [
237
- ast_1.kt.argument.named('method', ast_1.kt.call([ctx.refs.requestMethod(), endpoint.method.toUpperCase()])),
238
- ast_1.kt.argument.named('path', ast_1.kt.string(this.getPathWithInterpolation(ctx, { endpoint }), { template: true })),
239
- ast_1.kt.argument.named('query', 'localVariableQuery'),
240
- ast_1.kt.argument.named('headers', 'localVariableHeaders'),
241
- ast_1.kt.argument.named('requiresAuthentication', 'false'),
242
- endpoint.requestBody ? ast_1.kt.argument.named('body', 'localVariableBody') : null,
230
+ result.values.push((0, core_1.builderTemplate) `return ${index_js_1.kt.call([ctx.refs.requestConfig.infer()], [
231
+ index_js_1.kt.argument.named('method', index_js_1.kt.call([ctx.refs.requestMethod(), endpoint.method.toUpperCase()])),
232
+ index_js_1.kt.argument.named('path', index_js_1.kt.string(this.getPathWithInterpolation(ctx, { endpoint }), { template: true })),
233
+ index_js_1.kt.argument.named('query', 'localVariableQuery'),
234
+ index_js_1.kt.argument.named('headers', 'localVariableHeaders'),
235
+ index_js_1.kt.argument.named('requiresAuthentication', 'false'),
236
+ endpoint.requestBody ? index_js_1.kt.argument.named('body', 'localVariableBody') : null,
243
237
  ])}`);
244
238
  return result;
245
239
  }
246
- getAdditionalClientMembers(ctx, args) {
240
+ getAdditionalClientMembers(_ctx, _args) {
247
241
  return [
248
- ast_1.kt.function('encodeURIComponent', {
242
+ index_js_1.kt.function('encodeURIComponent', {
249
243
  accessModifier: 'private',
250
- parameters: [ast_1.kt.parameter('uriComponent', ast_1.kt.refs.string())],
251
- returnType: ast_1.kt.refs.string(),
244
+ parameters: [index_js_1.kt.parameter('uriComponent', index_js_1.kt.refs.string())],
245
+ returnType: index_js_1.kt.refs.string(),
252
246
  singleExpression: true,
253
- body: (0, core_1.builderTemplate) `${ast_1.kt.refs.okhttp3.httpUrl()}.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]`,
247
+ body: (0, core_1.builderTemplate) `${index_js_1.kt.refs.okhttp3.httpUrl()}.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]`,
254
248
  }),
255
249
  ];
256
250
  }
@@ -258,7 +252,7 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
258
252
  var _a;
259
253
  const { parameter } = args;
260
254
  if ((_a = parameter.multipart) === null || _a === void 0 ? void 0 : _a.isFile) {
261
- return ast_1.kt.refs.java.file();
255
+ return index_js_1.kt.refs.java.file();
262
256
  }
263
257
  return this.getTypeUsage(ctx, {
264
258
  schema: parameter.schema,
@@ -270,18 +264,20 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
270
264
  const { endpoint } = args;
271
265
  const content = (_a = endpoint.requestBody) === null || _a === void 0 ? void 0 : _a.content[0];
272
266
  return (content === null || content === void 0 ? void 0 : content.type) === 'multipart/form-data'
273
- ? ast_1.kt.refs.map([ast_1.kt.refs.string(), ctx.refs.partConfig(['*'])])
274
- : this.getTypeUsage(ctx, { schema: content === null || content === void 0 ? void 0 : content.schema, fallback: ast_1.kt.refs.unit() });
267
+ ? index_js_1.kt.refs.map([index_js_1.kt.refs.string(), ctx.refs.partConfig(['*'])])
268
+ : this.getTypeUsage(ctx, { schema: content === null || content === void 0 ? void 0 : content.schema, fallback: index_js_1.kt.refs.unit() });
275
269
  }
276
270
  getTypeUsage(ctx, args) {
277
271
  const { schema, nullable, fallback } = args;
278
272
  const type = this.getSchemaType(ctx, { schema });
279
273
  return type
280
274
  ? (0, core_1.createOverwriteProxy)(type, { nullable: nullable !== null && nullable !== void 0 ? nullable : type.nullable })
281
- : (fallback !== null && fallback !== void 0 ? fallback : ast_1.kt.refs.any({ nullable }));
275
+ : (fallback !== null && fallback !== void 0 ? fallback : index_js_1.kt.refs.any({ nullable }));
282
276
  }
283
- getPackageName(ctx, args) {
284
- const packageSuffix = typeof ctx.config.packageSuffix === 'string' ? ctx.config.packageSuffix : ctx.config.packageSuffix(ctx.service);
277
+ getPackageName(ctx, _args) {
278
+ const packageSuffix = typeof ctx.config.packageSuffix === 'string'
279
+ ? ctx.config.packageSuffix
280
+ : ctx.config.packageSuffix(ctx.service);
285
281
  return ctx.config.packageName + packageSuffix;
286
282
  }
287
283
  getPathWithInterpolation(ctx, args) {
@@ -294,7 +290,7 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
294
290
  });
295
291
  return path;
296
292
  }
297
- getResponseSchema(ctx, args) {
293
+ getResponseSchema(_ctx, args) {
298
294
  var _a, _b;
299
295
  const { endpoint } = args;
300
296
  return (_b = (_a = endpoint.responses.find((x) => !x.statusCode || (x.statusCode >= 200 && x.statusCode < 300))) === null || _a === void 0 ? void 0 : _a.contentOptions[0]) === null || _b === void 0 ? void 0 : _b.schema;
@@ -349,21 +345,21 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
349
345
  const { endpoint } = args;
350
346
  const schema = (_a = endpoint.requestBody) === null || _a === void 0 ? void 0 : _a.content[0].schema;
351
347
  const schemaInfo = this.getSchemaType(ctx, { schema });
352
- return (0, core_1.toCasing)(schemaInfo && schemaInfo.name !== 'Any' ? core_1.SourceBuilder.build((b) => ast_1.kt.reference.write(b, schemaInfo)) : 'body', ctx.config.parameterNameCasing);
348
+ return (0, core_1.toCasing)(schemaInfo && schemaInfo.name !== 'Any' ? core_1.SourceBuilder.build((b) => index_js_1.kt.reference.write(b, schemaInfo)) : 'body', ctx.config.parameterNameCasing);
353
349
  }
354
- getBasePath(ctx, args) {
350
+ getBasePath(ctx, _args) {
355
351
  var _a, _b, _c, _d, _e, _f;
356
- return (0, utils_1.modifyString)((_f = (_e = (_d = (_c = ((_a = ctx.service.$src) !== null && _a !== void 0 ? _a : (_b = ctx.service.endpoints[0]) === null || _b === void 0 ? void 0 : _b.$src)) === null || _c === void 0 ? void 0 : _c.document.servers) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : '/', ctx.config.basePath, ctx.service);
352
+ return (0, utils_js_1.modifyString)((_f = (_e = (_d = (_c = ((_a = ctx.service.$src) !== null && _a !== void 0 ? _a : (_b = ctx.service.endpoints[0]) === null || _b === void 0 ? void 0 : _b.$src)) === null || _c === void 0 ? void 0 : _c.document.servers) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : '/', ctx.config.basePath, ctx.service);
357
353
  }
358
354
  getEndpointPath(ctx, args) {
359
355
  const { endpoint } = args;
360
- return (0, utils_1.modifyString)(endpoint.path, ctx.config.pathModifier, endpoint);
356
+ return (0, utils_js_1.modifyString)(endpoint.path, ctx.config.pathModifier, endpoint);
361
357
  }
362
358
  getFilePath(ctx, args) {
363
359
  const { packageName } = args;
364
360
  return `${ctx.config.outputDir}/${packageName.replace(/\./g, '/')}/${this.getApiClientName(ctx, {})}.kt`;
365
361
  }
366
- getApiClientName(ctx, args) {
362
+ getApiClientName(ctx, _args) {
367
363
  return (0, core_1.toCasing)(ctx.service.name, ctx.config.typeNameCasing) + 'ApiClient';
368
364
  }
369
365
  createApiParameter(data) {
@@ -0,0 +1,23 @@
1
+ import { type ApiService, Factory, type MaybePromise, type OpenApiGeneratorContext, OpenApiServicesGenerationProviderBase } from '@goast/core';
2
+ import { type KotlinOkHttp3ClientGeneratorOutput, type KotlinOkHttp3ClientsGeneratorConfig, type KotlinOkHttp3ClientsGeneratorContext, type KotlinOkHttp3ClientsGeneratorInput, type KotlinOkHttp3ClientsGeneratorOutput } from './models.js';
3
+ import { type KotlinOkHttp3Generator } from './okhttp3-client-generator.js';
4
+ import type { KotlinServicesGeneratorInput } from '../spring-controllers/index.js';
5
+ type Input = KotlinOkHttp3ClientsGeneratorInput;
6
+ type Output = KotlinOkHttp3ClientsGeneratorOutput;
7
+ type Config = KotlinOkHttp3ClientsGeneratorConfig;
8
+ type ServiceOutput = KotlinOkHttp3ClientGeneratorOutput;
9
+ type Context = KotlinOkHttp3ClientsGeneratorContext;
10
+ export declare class KotlinOkHttp3ClientsGenerator extends OpenApiServicesGenerationProviderBase<Input, Output, Config, ServiceOutput, Context> {
11
+ private readonly _serviceGeneratorFactory;
12
+ constructor(serviceGeneratorFactory?: Factory<KotlinOkHttp3Generator, []>);
13
+ protected generateAdditionalFiles(ctx: KotlinOkHttp3ClientsGeneratorContext): Promise<void>;
14
+ protected initResult(): Output;
15
+ protected generateService(ctx: Context, service: ApiService): MaybePromise<ServiceOutput>;
16
+ protected addServiceResult(ctx: Context, service: ApiService, result: ServiceOutput): void;
17
+ protected buildContext(context: OpenApiGeneratorContext<KotlinServicesGeneratorInput>, config?: Partial<Config> | undefined): Context;
18
+ protected getInfrastructurePackageName(config: Config): string;
19
+ protected getPackageName(config: Config): string;
20
+ private copyInfrastructureFiles;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=okhttp3-clients-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okhttp3-clients-generator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/generators/services/okhttp3-clients/okhttp3-clients-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,qCAAqC,EACtC,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACzC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE3G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAGnF,KAAK,KAAK,GAAG,kCAAkC,CAAC;AAChD,KAAK,MAAM,GAAG,mCAAmC,CAAC;AAClD,KAAK,MAAM,GAAG,mCAAmC,CAAC;AAClD,KAAK,aAAa,GAAG,kCAAkC,CAAC;AACxD,KAAK,OAAO,GAAG,oCAAoC,CAAC;AAEpD,qBAAa,6BAA8B,SAAQ,qCAAqC,CACtF,KAAK,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,OAAO,CACR;IACC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAsC;gBAEnE,uBAAuB,CAAC,EAAE,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;cAKhD,uBAAuB,CAAC,GAAG,EAAE,oCAAoC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1G,SAAS,CAAC,UAAU,IAAI,MAAM;IAQ9B,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC;IAQzF,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAI1F,SAAS,CAAC,YAAY,CACpB,OAAO,EAAE,uBAAuB,CAAC,4BAA4B,CAAC,EAC9D,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GACnC,OAAO;IAUV,SAAS,CAAC,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAc9D,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;YAKlC,uBAAuB;CAyBtC"}
@@ -2,21 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KotlinOkHttp3ClientsGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
7
6
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
7
  const core_1 = require("@goast/core");
9
- const models_1 = require("./models");
10
- const okhttp3_client_generator_1 = require("./okhttp3-client-generator");
11
- const refs_1 = require("./refs");
8
+ const models_js_1 = require("./models.js");
9
+ const okhttp3_client_generator_js_1 = require("./okhttp3-client-generator.js");
10
+ const refs_js_1 = require("./refs.js");
11
+ const assets_js_1 = require("../../../assets.js");
12
12
  class KotlinOkHttp3ClientsGenerator extends core_1.OpenApiServicesGenerationProviderBase {
13
13
  constructor(serviceGeneratorFactory) {
14
14
  super();
15
- this._serviceGeneratorFactory = serviceGeneratorFactory !== null && serviceGeneratorFactory !== void 0 ? serviceGeneratorFactory : core_1.Factory.fromValue(new okhttp3_client_generator_1.DefaultKotlinOkHttp3Generator());
15
+ Object.defineProperty(this, "_serviceGeneratorFactory", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ this._serviceGeneratorFactory = serviceGeneratorFactory !== null && serviceGeneratorFactory !== void 0 ? serviceGeneratorFactory : core_1.Factory.fromValue(new okhttp3_client_generator_js_1.DefaultKotlinOkHttp3Generator());
16
22
  }
17
- onGenerate(ctx) {
18
- this.copyInfrastructureFiles(ctx);
19
- return super.onGenerate(ctx);
23
+ async generateAdditionalFiles(ctx) {
24
+ await this.copyInfrastructureFiles(ctx);
20
25
  }
21
26
  initResult() {
22
27
  return {
@@ -37,11 +42,11 @@ class KotlinOkHttp3ClientsGenerator extends core_1.OpenApiServicesGenerationProv
37
42
  }
38
43
  buildContext(context, config) {
39
44
  context.data.services = context.data.services.filter((x) => x.name !== 'exclude-from-generation');
40
- const providerContext = this.getProviderContext(context, config, models_1.defaultKotlinOkHttp3ClientsGeneratorConfig);
45
+ const providerContext = this.getProviderContext(context, config, models_js_1.defaultKotlinOkHttp3ClientsGeneratorConfig);
41
46
  const infrastructurePackageName = this.getInfrastructurePackageName(providerContext.config);
42
47
  return Object.assign(providerContext, {
43
48
  infrastructurePackageName,
44
- refs: (0, refs_1.getReferenceFactories)(infrastructurePackageName),
49
+ refs: (0, refs_js_1.getReferenceFactories)(infrastructurePackageName),
45
50
  });
46
51
  }
47
52
  getInfrastructurePackageName(config) {
@@ -60,17 +65,27 @@ class KotlinOkHttp3ClientsGenerator extends core_1.OpenApiServicesGenerationProv
60
65
  const packageSuffix = typeof config.packageSuffix === 'string' ? config.packageSuffix : config.packageSuffix();
61
66
  return config.packageName + packageSuffix;
62
67
  }
63
- copyInfrastructureFiles(ctx) {
64
- const sourceDir = (0, path_1.resolve)((0, path_1.dirname)(require.resolve('@goast/kotlin')), '../assets/client/okhttp3');
65
- const targetDir = (0, path_1.resolve)(ctx.config.outputDir, ctx.infrastructurePackageName.replace(/\./g, '/'));
66
- fs_extra_1.default.ensureDirSync(targetDir);
67
- const files = fs_extra_1.default.readdirSync(sourceDir);
68
+ async copyInfrastructureFiles(ctx) {
69
+ const targetDir = (0, node_path_1.resolve)(ctx.config.outputDir, ctx.infrastructurePackageName.replace(/\./g, '/'));
70
+ await fs_extra_1.default.ensureDir(targetDir);
71
+ const files = [
72
+ 'ApiAbstractions.kt',
73
+ 'ApiClient.kt',
74
+ 'ApiResponse.kt',
75
+ 'Errors.kt',
76
+ 'PartConfig.kt',
77
+ 'RequestConfig.kt',
78
+ 'RequestMethod.kt',
79
+ 'ResponseExtensions.kt',
80
+ 'Serializer.kt',
81
+ ];
68
82
  for (const file of files) {
69
- const fileContent = fs_extra_1.default
70
- .readFileSync((0, path_1.resolve)(sourceDir, file))
71
- .toString()
83
+ const sourcePath = `client/okhttp3/${file}`;
84
+ const targetPath = (0, node_path_1.resolve)(targetDir, file);
85
+ console.log(`Copying asset file "${sourcePath}" to "${targetPath}"`);
86
+ const fileContent = (await (0, assets_js_1.getAssetFileContent)(sourcePath))
72
87
  .replace(/@PACKAGE_NAME@/g, ctx.infrastructurePackageName);
73
- (0, fs_1.writeFileSync)((0, path_1.resolve)(targetDir, file), fileContent);
88
+ fs_extra_1.default.writeFileSync(targetPath, fileContent);
74
89
  }
75
90
  }
76
91
  }