@nutanix-scratch/aiops-js-client 4.0.1-alpha.1 → 4.0.1

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 (493) hide show
  1. package/LICENSE.txt +202 -49
  2. package/README.md +58 -40
  3. package/dist/Ntnx-Aiops-js-client-prod.js +1 -10
  4. package/dist/Ntnx-Aiops-js-client.js +1160 -709
  5. package/dist/es/ApiClient.d.ts +33 -43
  6. package/dist/es/ApiClient.js +764 -483
  7. package/dist/es/Paginable.d.ts +9 -9
  8. package/dist/es/Paginable.js +44 -64
  9. package/dist/es/apis/scenarios-endpoints.d.ts +217 -0
  10. package/dist/es/apis/scenarios-endpoints.js +675 -0
  11. package/dist/es/apis/stats-endpoints.d.ts +102 -0
  12. package/dist/es/apis/stats-endpoints.js +273 -0
  13. package/dist/es/index.d.ts +191 -7
  14. package/dist/es/index.js +754 -45
  15. package/dist/es/models/aiops/v4/capacityplanning/CapacityDetails.d.ts +110 -0
  16. package/dist/es/models/aiops/v4/capacityplanning/CapacityDetails.js +459 -0
  17. package/dist/es/models/aiops/v4/capacityplanning/CapacityUnit.d.ts +19 -0
  18. package/dist/es/models/aiops/v4/capacityplanning/CapacityUnit.js +85 -0
  19. package/dist/es/models/aiops/v4/capacityplanning/Runway.d.ts +86 -0
  20. package/dist/es/models/aiops/v4/capacityplanning/Runway.js +340 -0
  21. package/dist/es/models/aiops/v4/capacityplanning/RunwayDuration.d.ts +19 -0
  22. package/dist/es/models/aiops/v4/capacityplanning/RunwayDuration.js +91 -0
  23. package/dist/es/models/aiops/v4/clusterMetrics/Cluster.d.ts +90 -87
  24. package/dist/es/models/aiops/v4/clusterMetrics/Cluster.js +151 -145
  25. package/dist/es/models/aiops/v4/clusterMetrics/ClusterMetrics.d.ts +171 -152
  26. package/dist/es/models/aiops/v4/clusterMetrics/ClusterMetrics.js +241 -268
  27. package/dist/es/models/aiops/v4/clusterMetrics/ClusterProjection.d.ts +49 -29
  28. package/dist/es/models/aiops/v4/clusterMetrics/ClusterProjection.js +186 -87
  29. package/dist/es/models/aiops/v4/clusterMetrics/Node.d.ts +48 -45
  30. package/dist/es/models/aiops/v4/clusterMetrics/Node.js +116 -89
  31. package/dist/es/models/aiops/v4/clusterMetrics/NodeProjection.d.ts +2 -1
  32. package/dist/es/models/aiops/v4/clusterMetrics/NodeProjection.js +61 -58
  33. package/dist/es/models/aiops/v4/clusterMetrics/Vm.d.ts +48 -45
  34. package/dist/es/models/aiops/v4/clusterMetrics/Vm.js +116 -89
  35. package/dist/es/models/aiops/v4/clusterMetrics/VmProjection.d.ts +2 -1
  36. package/dist/es/models/aiops/v4/clusterMetrics/VmProjection.js +61 -58
  37. package/dist/es/models/aiops/v4/common/ClusterType.d.ts +19 -0
  38. package/dist/es/models/aiops/v4/common/ClusterType.js +79 -0
  39. package/dist/es/models/aiops/v4/config/CalculateRunwayApiResponse.d.ts +99 -0
  40. package/dist/es/models/aiops/v4/config/CalculateRunwayApiResponse.js +343 -0
  41. package/dist/es/models/aiops/v4/config/CapacityUpdateConfig.d.ts +77 -0
  42. package/dist/es/models/aiops/v4/config/CapacityUpdateConfig.js +322 -0
  43. package/dist/es/models/aiops/v4/config/CapacityUpdateType.d.ts +19 -0
  44. package/dist/es/models/aiops/v4/config/CapacityUpdateType.js +85 -0
  45. package/dist/es/models/aiops/v4/config/CategoryDetail.d.ts +60 -0
  46. package/dist/es/models/aiops/v4/config/CategoryDetail.js +315 -0
  47. package/dist/es/models/aiops/v4/config/CitrixXenProvisionType.d.ts +19 -0
  48. package/dist/es/models/aiops/v4/config/CitrixXenProvisionType.js +85 -0
  49. package/dist/es/models/aiops/v4/config/CitrixXenWorkload.d.ts +83 -0
  50. package/dist/es/models/aiops/v4/config/CitrixXenWorkload.js +371 -0
  51. package/dist/es/models/aiops/v4/config/CitrixXenWorkloadVendor.d.ts +19 -0
  52. package/dist/es/models/aiops/v4/config/CitrixXenWorkloadVendor.js +79 -0
  53. package/dist/es/models/aiops/v4/config/ClusterConfig.d.ts +107 -0
  54. package/dist/es/models/aiops/v4/config/ClusterConfig.js +329 -0
  55. package/dist/es/models/aiops/v4/config/CreateIgnoreWindowApiResponse.d.ts +99 -0
  56. package/dist/es/models/aiops/v4/config/CreateIgnoreWindowApiResponse.js +343 -0
  57. package/dist/es/models/aiops/v4/config/CreateScenarioApiResponse.d.ts +99 -0
  58. package/dist/es/models/aiops/v4/config/CreateScenarioApiResponse.js +343 -0
  59. package/dist/es/models/aiops/v4/config/CreateSimulationApiResponse.d.ts +102 -0
  60. package/dist/es/models/aiops/v4/config/CreateSimulationApiResponse.js +343 -0
  61. package/dist/es/models/aiops/v4/config/DataStoreConfig.d.ts +205 -0
  62. package/dist/es/models/aiops/v4/config/DataStoreConfig.js +673 -0
  63. package/dist/es/models/aiops/v4/config/DeleteIgnoreWindowApiResponse.d.ts +98 -0
  64. package/dist/es/models/aiops/v4/config/DeleteIgnoreWindowApiResponse.js +345 -0
  65. package/dist/es/models/aiops/v4/config/DeleteScenarioApiResponse.d.ts +98 -0
  66. package/dist/es/models/aiops/v4/config/DeleteScenarioApiResponse.js +345 -0
  67. package/dist/es/models/aiops/v4/config/DeleteSimulationApiResponse.d.ts +98 -0
  68. package/dist/es/models/aiops/v4/config/DeleteSimulationApiResponse.js +345 -0
  69. package/dist/es/models/aiops/v4/config/EntityDescriptor.d.ts +68 -0
  70. package/dist/es/models/aiops/v4/config/EntityDescriptor.js +454 -0
  71. package/dist/es/models/aiops/v4/config/EntityDescriptorListApiResponse.d.ts +101 -0
  72. package/dist/es/models/aiops/v4/config/EntityDescriptorListApiResponse.js +365 -0
  73. package/dist/es/models/aiops/v4/config/EntityType.d.ts +37 -0
  74. package/dist/es/models/aiops/v4/config/EntityType.js +275 -0
  75. package/dist/es/models/aiops/v4/config/EntityTypeListApiResponse.d.ts +99 -0
  76. package/dist/es/models/aiops/v4/config/EntityTypeListApiResponse.js +365 -0
  77. package/dist/es/models/aiops/v4/config/GenerateRecommendationApiResponse.d.ts +99 -0
  78. package/dist/es/models/aiops/v4/config/GenerateRecommendationApiResponse.js +343 -0
  79. package/dist/es/models/aiops/v4/config/GenerateReportApiResponse.d.ts +99 -0
  80. package/dist/es/models/aiops/v4/config/GenerateReportApiResponse.js +343 -0
  81. package/dist/es/models/aiops/v4/config/GenerateRunwayApiResponse.d.ts +99 -0
  82. package/dist/es/models/aiops/v4/config/GenerateRunwayApiResponse.js +343 -0
  83. package/dist/es/models/aiops/v4/config/GetScenarioApiResponse.d.ts +99 -0
  84. package/dist/es/models/aiops/v4/config/GetScenarioApiResponse.js +343 -0
  85. package/dist/es/models/aiops/v4/config/GetScenarioReportApiResponse.d.ts +98 -0
  86. package/dist/es/models/aiops/v4/config/GetScenarioReportApiResponse.js +342 -0
  87. package/dist/es/models/aiops/v4/config/GetSimulationApiResponse.d.ts +99 -0
  88. package/dist/es/models/aiops/v4/config/GetSimulationApiResponse.js +343 -0
  89. package/dist/es/models/aiops/v4/config/IgnoreWindow.d.ts +111 -0
  90. package/dist/es/models/aiops/v4/config/IgnoreWindow.js +460 -0
  91. package/dist/es/models/aiops/v4/config/IgnoreWindowProjection.d.ts +20 -0
  92. package/dist/es/models/aiops/v4/config/IgnoreWindowProjection.js +173 -0
  93. package/dist/es/models/aiops/v4/config/ListScenariosApiResponse.d.ts +100 -0
  94. package/dist/es/models/aiops/v4/config/ListScenariosApiResponse.js +370 -0
  95. package/dist/es/models/aiops/v4/config/ListSimulationsApiResponse.d.ts +100 -0
  96. package/dist/es/models/aiops/v4/config/ListSimulationsApiResponse.js +370 -0
  97. package/dist/es/models/aiops/v4/config/MetricDescriptor.d.ts +182 -0
  98. package/dist/es/models/aiops/v4/config/MetricDescriptor.js +667 -0
  99. package/dist/es/models/aiops/v4/config/MicrosoftXenProvisionType.d.ts +19 -0
  100. package/dist/es/models/aiops/v4/config/MicrosoftXenProvisionType.js +79 -0
  101. package/dist/es/models/aiops/v4/config/MicrosoftXenWorkload.d.ts +83 -0
  102. package/dist/es/models/aiops/v4/config/MicrosoftXenWorkload.js +371 -0
  103. package/dist/es/models/aiops/v4/config/MicrosoftXenWorkloadVendor.d.ts +19 -0
  104. package/dist/es/models/aiops/v4/config/MicrosoftXenWorkloadVendor.js +79 -0
  105. package/dist/es/models/aiops/v4/config/NodeConfig.d.ts +143 -0
  106. package/dist/es/models/aiops/v4/config/NodeConfig.js +490 -0
  107. package/dist/es/models/aiops/v4/config/NodeSource.d.ts +19 -0
  108. package/dist/es/models/aiops/v4/config/NodeSource.js +91 -0
  109. package/dist/es/models/aiops/v4/config/PolicyType.d.ts +19 -0
  110. package/dist/es/models/aiops/v4/config/PolicyType.js +85 -0
  111. package/dist/es/models/aiops/v4/config/ReplicationFactor.d.ts +19 -0
  112. package/dist/es/models/aiops/v4/config/ReplicationFactor.js +85 -0
  113. package/dist/es/models/aiops/v4/config/ResourceCapacity.d.ts +126 -0
  114. package/dist/es/models/aiops/v4/config/ResourceCapacity.js +451 -0
  115. package/dist/es/models/aiops/v4/config/Runway.d.ts +130 -0
  116. package/dist/es/models/aiops/v4/config/Runway.js +479 -0
  117. package/dist/es/models/aiops/v4/config/RunwayParams.d.ts +77 -0
  118. package/dist/es/models/aiops/v4/config/RunwayParams.js +323 -0
  119. package/dist/es/models/aiops/v4/config/RunwayParamsProjection.d.ts +14 -0
  120. package/dist/es/models/aiops/v4/config/RunwayParamsProjection.js +159 -0
  121. package/dist/es/models/aiops/v4/config/Scenario.d.ts +178 -0
  122. package/dist/es/models/aiops/v4/config/Scenario.js +579 -0
  123. package/dist/es/models/aiops/v4/config/ScenarioProjection.d.ts +10 -0
  124. package/dist/es/models/aiops/v4/config/ScenarioProjection.js +156 -0
  125. package/dist/es/models/aiops/v4/config/SimulatedVmResourceSpec.d.ts +106 -0
  126. package/dist/es/models/aiops/v4/config/SimulatedVmResourceSpec.js +403 -0
  127. package/dist/es/models/aiops/v4/config/SimulatedVmResourceSpecProjection.d.ts +16 -0
  128. package/dist/es/models/aiops/v4/config/SimulatedVmResourceSpecProjection.js +162 -0
  129. package/dist/es/models/aiops/v4/config/Simulation.d.ts +56 -0
  130. package/dist/es/models/aiops/v4/config/Simulation.js +317 -0
  131. package/dist/es/models/aiops/v4/config/SimulationProjection.d.ts +10 -0
  132. package/dist/es/models/aiops/v4/config/SimulationProjection.js +153 -0
  133. package/dist/es/models/aiops/v4/config/Source.d.ts +37 -0
  134. package/dist/es/models/aiops/v4/config/Source.js +275 -0
  135. package/dist/es/models/aiops/v4/config/SourceListApiResponse.d.ts +106 -0
  136. package/dist/es/models/aiops/v4/config/SourceListApiResponse.js +365 -0
  137. package/dist/es/models/aiops/v4/config/SplunkWorkload.d.ts +118 -0
  138. package/dist/es/models/aiops/v4/config/SplunkWorkload.js +446 -0
  139. package/dist/es/models/aiops/v4/config/SqlProfileType.d.ts +19 -0
  140. package/dist/es/models/aiops/v4/config/SqlProfileType.js +91 -0
  141. package/dist/es/models/aiops/v4/config/SqlTransactionType.d.ts +19 -0
  142. package/dist/es/models/aiops/v4/config/SqlTransactionType.js +85 -0
  143. package/dist/es/models/aiops/v4/config/SqlWorkload.d.ts +110 -0
  144. package/dist/es/models/aiops/v4/config/SqlWorkload.js +415 -0
  145. package/dist/es/models/aiops/v4/config/UpdateIgnoreWindowApiResponse.d.ts +99 -0
  146. package/dist/es/models/aiops/v4/config/UpdateIgnoreWindowApiResponse.js +343 -0
  147. package/dist/es/models/aiops/v4/config/UpdatePolicyTaskApiResponse.d.ts +99 -0
  148. package/dist/es/models/aiops/v4/config/UpdatePolicyTaskApiResponse.js +343 -0
  149. package/dist/es/models/aiops/v4/config/UpdateScenarioApiResponse.d.ts +99 -0
  150. package/dist/es/models/aiops/v4/config/UpdateScenarioApiResponse.js +343 -0
  151. package/dist/es/models/aiops/v4/config/UpdateSimulationApiResponse.d.ts +99 -0
  152. package/dist/es/models/aiops/v4/config/UpdateSimulationApiResponse.js +365 -0
  153. package/dist/es/models/aiops/v4/config/ValueRange.d.ts +64 -0
  154. package/dist/es/models/aiops/v4/config/ValueRange.js +312 -0
  155. package/dist/es/models/aiops/v4/config/ValueType.d.ts +19 -0
  156. package/dist/es/models/aiops/v4/config/ValueType.js +121 -0
  157. package/dist/es/models/aiops/v4/config/VdiProvisionType.d.ts +19 -0
  158. package/dist/es/models/aiops/v4/config/VdiProvisionType.js +103 -0
  159. package/dist/es/models/aiops/v4/config/VdiUserType.d.ts +19 -0
  160. package/dist/es/models/aiops/v4/config/VdiUserType.js +97 -0
  161. package/dist/es/models/aiops/v4/config/VdiVendor.d.ts +19 -0
  162. package/dist/es/models/aiops/v4/config/VdiVendor.js +85 -0
  163. package/dist/es/models/aiops/v4/config/VdiWorkload.d.ts +109 -0
  164. package/dist/es/models/aiops/v4/config/VdiWorkload.js +412 -0
  165. package/dist/es/models/aiops/v4/config/Vendor.d.ts +19 -0
  166. package/dist/es/models/aiops/v4/config/Vendor.js +127 -0
  167. package/dist/es/models/aiops/v4/config/VmCategoryWorkload.d.ts +94 -0
  168. package/dist/es/models/aiops/v4/config/VmCategoryWorkload.js +370 -0
  169. package/dist/es/models/aiops/v4/config/VmWorkload.d.ts +80 -0
  170. package/dist/es/models/aiops/v4/config/VmWorkload.js +335 -0
  171. package/dist/es/models/aiops/v4/config/Workload.d.ts +122 -0
  172. package/dist/es/models/aiops/v4/config/Workload.js +447 -0
  173. package/dist/es/models/aiops/v4/config/XenOperatingSystem.d.ts +19 -0
  174. package/dist/es/models/aiops/v4/config/XenOperatingSystem.js +85 -0
  175. package/dist/es/models/aiops/v4/config/XenWorkload.d.ts +151 -0
  176. package/dist/es/models/aiops/v4/config/XenWorkload.js +532 -0
  177. package/dist/es/models/aiops/v4/config/XfitPolicy.d.ts +161 -0
  178. package/dist/es/models/aiops/v4/config/XfitPolicy.js +589 -0
  179. package/dist/es/models/aiops/v4/config/XfitPolicyProjection.d.ts +16 -0
  180. package/dist/es/models/aiops/v4/config/XfitPolicyProjection.js +167 -0
  181. package/dist/es/models/aiops/v4/error/AppMessage.d.ts +69 -51
  182. package/dist/es/models/aiops/v4/error/AppMessage.js +140 -103
  183. package/dist/es/models/aiops/v4/error/ErrorResponse.d.ts +25 -22
  184. package/dist/es/models/aiops/v4/error/ErrorResponse.js +159 -103
  185. package/dist/es/models/aiops/v4/error/SchemaValidationError.d.ts +65 -44
  186. package/dist/es/models/aiops/v4/error/SchemaValidationError.js +138 -95
  187. package/dist/es/models/aiops/v4/error/SchemaValidationErrorMessage.d.ts +42 -33
  188. package/dist/es/models/aiops/v4/error/SchemaValidationErrorMessage.js +115 -72
  189. package/dist/es/models/aiops/v4/stats/BoolList.d.ts +61 -0
  190. package/dist/es/models/aiops/v4/stats/BoolList.js +288 -0
  191. package/dist/es/models/aiops/v4/stats/BoolVal.d.ts +61 -0
  192. package/dist/es/models/aiops/v4/stats/BoolVal.js +280 -0
  193. package/dist/es/models/aiops/v4/stats/DoubleList.d.ts +61 -0
  194. package/dist/es/models/aiops/v4/stats/DoubleList.js +288 -0
  195. package/dist/es/models/aiops/v4/stats/DoubleVal.d.ts +61 -0
  196. package/dist/es/models/aiops/v4/stats/DoubleVal.js +280 -0
  197. package/dist/es/models/aiops/v4/stats/Entity.d.ts +57 -0
  198. package/dist/es/models/aiops/v4/stats/Entity.js +413 -0
  199. package/dist/es/models/aiops/v4/stats/EntityListApiResponse.d.ts +99 -0
  200. package/dist/es/models/aiops/v4/stats/EntityListApiResponse.js +365 -0
  201. package/dist/es/models/aiops/v4/stats/IntList.d.ts +61 -0
  202. package/dist/es/models/aiops/v4/stats/IntList.js +288 -0
  203. package/dist/es/models/aiops/v4/stats/IntVal.d.ts +61 -0
  204. package/dist/es/models/aiops/v4/stats/IntVal.js +280 -0
  205. package/dist/es/models/aiops/v4/stats/Metric.d.ts +75 -0
  206. package/dist/es/models/aiops/v4/stats/Metric.js +312 -0
  207. package/dist/es/models/aiops/v4/stats/Point.d.ts +72 -0
  208. package/dist/es/models/aiops/v4/stats/Point.js +356 -0
  209. package/dist/es/models/aiops/v4/stats/StrList.d.ts +61 -0
  210. package/dist/es/models/aiops/v4/stats/StrList.js +288 -0
  211. package/dist/es/models/aiops/v4/stats/StrVal.d.ts +61 -0
  212. package/dist/es/models/aiops/v4/stats/StrVal.js +280 -0
  213. package/dist/es/models/aiops/v4/stats/TimeSeries.d.ts +71 -0
  214. package/dist/es/models/aiops/v4/stats/TimeSeries.js +326 -0
  215. package/dist/es/models/common/v1/config/Flag.d.ts +34 -27
  216. package/dist/es/models/common/v1/config/Flag.js +114 -65
  217. package/dist/es/models/common/v1/config/IPv4Address.d.ts +42 -27
  218. package/dist/es/models/common/v1/config/IPv4Address.js +112 -69
  219. package/dist/es/models/common/v1/config/KVPair.d.ts +37 -29
  220. package/dist/es/models/common/v1/config/KVPair.js +167 -98
  221. package/dist/es/models/common/v1/config/KVStringPair.d.ts +64 -0
  222. package/dist/es/models/common/v1/config/KVStringPair.js +318 -0
  223. package/dist/es/models/common/v1/config/MapOfStringWrapper.d.ts +58 -0
  224. package/dist/es/models/common/v1/config/MapOfStringWrapper.js +275 -0
  225. package/dist/es/models/common/v1/config/Message.d.ts +45 -39
  226. package/dist/es/models/common/v1/config/Message.js +114 -81
  227. package/dist/es/models/common/v1/config/MessageSeverity.js +22 -35
  228. package/dist/es/models/common/v1/config/TenantAwareModel.d.ts +26 -23
  229. package/dist/es/models/common/v1/config/TenantAwareModel.js +99 -60
  230. package/dist/es/models/common/v1/response/ApiLink.d.ts +34 -31
  231. package/dist/es/models/common/v1/response/ApiLink.js +108 -71
  232. package/dist/es/models/common/v1/response/ApiResponseMetadata.d.ts +91 -47
  233. package/dist/es/models/common/v1/response/ApiResponseMetadata.js +148 -108
  234. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.d.ts +27 -20
  235. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.js +126 -95
  236. package/dist/es/models/common/v1/stats/DownSamplingOperator.d.ts +19 -0
  237. package/dist/es/models/common/v1/stats/DownSamplingOperator.js +109 -0
  238. package/dist/es/models/prism/v4/config/TaskReference.d.ts +52 -0
  239. package/dist/es/models/prism/v4/config/TaskReference.js +285 -0
  240. package/dist/es/models/validation/ValidationError.js +12 -19
  241. package/dist/es/models/validation/ValidationScopes.js +2 -7
  242. package/dist/es/utils/ValidationUtils.js +12 -18
  243. package/dist/lib/ApiClient.d.ts +33 -43
  244. package/dist/lib/ApiClient.js +764 -483
  245. package/dist/lib/Paginable.d.ts +9 -9
  246. package/dist/lib/Paginable.js +44 -64
  247. package/dist/lib/apis/scenarios-endpoints.d.ts +217 -0
  248. package/dist/lib/apis/scenarios-endpoints.js +675 -0
  249. package/dist/lib/apis/stats-endpoints.d.ts +102 -0
  250. package/dist/lib/apis/stats-endpoints.js +273 -0
  251. package/dist/lib/index.d.ts +191 -7
  252. package/dist/lib/index.js +754 -45
  253. package/dist/lib/models/aiops/v4/capacityplanning/CapacityDetails.d.ts +110 -0
  254. package/dist/lib/models/aiops/v4/capacityplanning/CapacityDetails.js +459 -0
  255. package/dist/lib/models/aiops/v4/capacityplanning/CapacityUnit.d.ts +19 -0
  256. package/dist/lib/models/aiops/v4/capacityplanning/CapacityUnit.js +85 -0
  257. package/dist/lib/models/aiops/v4/capacityplanning/Runway.d.ts +86 -0
  258. package/dist/lib/models/aiops/v4/capacityplanning/Runway.js +340 -0
  259. package/dist/lib/models/aiops/v4/capacityplanning/RunwayDuration.d.ts +19 -0
  260. package/dist/lib/models/aiops/v4/capacityplanning/RunwayDuration.js +91 -0
  261. package/dist/lib/models/aiops/v4/clusterMetrics/Cluster.d.ts +90 -87
  262. package/dist/lib/models/aiops/v4/clusterMetrics/Cluster.js +151 -145
  263. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterMetrics.d.ts +171 -152
  264. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterMetrics.js +241 -268
  265. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterProjection.d.ts +49 -29
  266. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterProjection.js +186 -87
  267. package/dist/lib/models/aiops/v4/clusterMetrics/Node.d.ts +48 -45
  268. package/dist/lib/models/aiops/v4/clusterMetrics/Node.js +116 -89
  269. package/dist/lib/models/aiops/v4/clusterMetrics/NodeProjection.d.ts +2 -1
  270. package/dist/lib/models/aiops/v4/clusterMetrics/NodeProjection.js +61 -58
  271. package/dist/lib/models/aiops/v4/clusterMetrics/Vm.d.ts +48 -45
  272. package/dist/lib/models/aiops/v4/clusterMetrics/Vm.js +116 -89
  273. package/dist/lib/models/aiops/v4/clusterMetrics/VmProjection.d.ts +2 -1
  274. package/dist/lib/models/aiops/v4/clusterMetrics/VmProjection.js +61 -58
  275. package/dist/lib/models/aiops/v4/common/ClusterType.d.ts +19 -0
  276. package/dist/lib/models/aiops/v4/common/ClusterType.js +79 -0
  277. package/dist/lib/models/aiops/v4/config/CalculateRunwayApiResponse.d.ts +99 -0
  278. package/dist/lib/models/aiops/v4/config/CalculateRunwayApiResponse.js +343 -0
  279. package/dist/lib/models/aiops/v4/config/CapacityUpdateConfig.d.ts +77 -0
  280. package/dist/lib/models/aiops/v4/config/CapacityUpdateConfig.js +322 -0
  281. package/dist/lib/models/aiops/v4/config/CapacityUpdateType.d.ts +19 -0
  282. package/dist/lib/models/aiops/v4/config/CapacityUpdateType.js +85 -0
  283. package/dist/lib/models/aiops/v4/config/CategoryDetail.d.ts +60 -0
  284. package/dist/lib/models/aiops/v4/config/CategoryDetail.js +315 -0
  285. package/dist/lib/models/aiops/v4/config/CitrixXenProvisionType.d.ts +19 -0
  286. package/dist/lib/models/aiops/v4/config/CitrixXenProvisionType.js +85 -0
  287. package/dist/lib/models/aiops/v4/config/CitrixXenWorkload.d.ts +83 -0
  288. package/dist/lib/models/aiops/v4/config/CitrixXenWorkload.js +371 -0
  289. package/dist/lib/models/aiops/v4/config/CitrixXenWorkloadVendor.d.ts +19 -0
  290. package/dist/lib/models/aiops/v4/config/CitrixXenWorkloadVendor.js +79 -0
  291. package/dist/lib/models/aiops/v4/config/ClusterConfig.d.ts +107 -0
  292. package/dist/lib/models/aiops/v4/config/ClusterConfig.js +329 -0
  293. package/dist/lib/models/aiops/v4/config/CreateIgnoreWindowApiResponse.d.ts +99 -0
  294. package/dist/lib/models/aiops/v4/config/CreateIgnoreWindowApiResponse.js +343 -0
  295. package/dist/lib/models/aiops/v4/config/CreateScenarioApiResponse.d.ts +99 -0
  296. package/dist/lib/models/aiops/v4/config/CreateScenarioApiResponse.js +343 -0
  297. package/dist/lib/models/aiops/v4/config/CreateSimulationApiResponse.d.ts +102 -0
  298. package/dist/lib/models/aiops/v4/config/CreateSimulationApiResponse.js +343 -0
  299. package/dist/lib/models/aiops/v4/config/DataStoreConfig.d.ts +205 -0
  300. package/dist/lib/models/aiops/v4/config/DataStoreConfig.js +673 -0
  301. package/dist/lib/models/aiops/v4/config/DeleteIgnoreWindowApiResponse.d.ts +98 -0
  302. package/dist/lib/models/aiops/v4/config/DeleteIgnoreWindowApiResponse.js +345 -0
  303. package/dist/lib/models/aiops/v4/config/DeleteScenarioApiResponse.d.ts +98 -0
  304. package/dist/lib/models/aiops/v4/config/DeleteScenarioApiResponse.js +345 -0
  305. package/dist/lib/models/aiops/v4/config/DeleteSimulationApiResponse.d.ts +98 -0
  306. package/dist/lib/models/aiops/v4/config/DeleteSimulationApiResponse.js +345 -0
  307. package/dist/lib/models/aiops/v4/config/EntityDescriptor.d.ts +68 -0
  308. package/dist/lib/models/aiops/v4/config/EntityDescriptor.js +454 -0
  309. package/dist/lib/models/aiops/v4/config/EntityDescriptorListApiResponse.d.ts +101 -0
  310. package/dist/lib/models/aiops/v4/config/EntityDescriptorListApiResponse.js +365 -0
  311. package/dist/lib/models/aiops/v4/config/EntityType.d.ts +37 -0
  312. package/dist/lib/models/aiops/v4/config/EntityType.js +275 -0
  313. package/dist/lib/models/aiops/v4/config/EntityTypeListApiResponse.d.ts +99 -0
  314. package/dist/lib/models/aiops/v4/config/EntityTypeListApiResponse.js +365 -0
  315. package/dist/lib/models/aiops/v4/config/GenerateRecommendationApiResponse.d.ts +99 -0
  316. package/dist/lib/models/aiops/v4/config/GenerateRecommendationApiResponse.js +343 -0
  317. package/dist/lib/models/aiops/v4/config/GenerateReportApiResponse.d.ts +99 -0
  318. package/dist/lib/models/aiops/v4/config/GenerateReportApiResponse.js +343 -0
  319. package/dist/lib/models/aiops/v4/config/GenerateRunwayApiResponse.d.ts +99 -0
  320. package/dist/lib/models/aiops/v4/config/GenerateRunwayApiResponse.js +343 -0
  321. package/dist/lib/models/aiops/v4/config/GetScenarioApiResponse.d.ts +99 -0
  322. package/dist/lib/models/aiops/v4/config/GetScenarioApiResponse.js +343 -0
  323. package/dist/lib/models/aiops/v4/config/GetScenarioReportApiResponse.d.ts +98 -0
  324. package/dist/lib/models/aiops/v4/config/GetScenarioReportApiResponse.js +342 -0
  325. package/dist/lib/models/aiops/v4/config/GetSimulationApiResponse.d.ts +99 -0
  326. package/dist/lib/models/aiops/v4/config/GetSimulationApiResponse.js +343 -0
  327. package/dist/lib/models/aiops/v4/config/IgnoreWindow.d.ts +111 -0
  328. package/dist/lib/models/aiops/v4/config/IgnoreWindow.js +460 -0
  329. package/dist/lib/models/aiops/v4/config/IgnoreWindowProjection.d.ts +20 -0
  330. package/dist/lib/models/aiops/v4/config/IgnoreWindowProjection.js +173 -0
  331. package/dist/lib/models/aiops/v4/config/ListScenariosApiResponse.d.ts +100 -0
  332. package/dist/lib/models/aiops/v4/config/ListScenariosApiResponse.js +370 -0
  333. package/dist/lib/models/aiops/v4/config/ListSimulationsApiResponse.d.ts +100 -0
  334. package/dist/lib/models/aiops/v4/config/ListSimulationsApiResponse.js +370 -0
  335. package/dist/lib/models/aiops/v4/config/MetricDescriptor.d.ts +182 -0
  336. package/dist/lib/models/aiops/v4/config/MetricDescriptor.js +667 -0
  337. package/dist/lib/models/aiops/v4/config/MicrosoftXenProvisionType.d.ts +19 -0
  338. package/dist/lib/models/aiops/v4/config/MicrosoftXenProvisionType.js +79 -0
  339. package/dist/lib/models/aiops/v4/config/MicrosoftXenWorkload.d.ts +83 -0
  340. package/dist/lib/models/aiops/v4/config/MicrosoftXenWorkload.js +371 -0
  341. package/dist/lib/models/aiops/v4/config/MicrosoftXenWorkloadVendor.d.ts +19 -0
  342. package/dist/lib/models/aiops/v4/config/MicrosoftXenWorkloadVendor.js +79 -0
  343. package/dist/lib/models/aiops/v4/config/NodeConfig.d.ts +143 -0
  344. package/dist/lib/models/aiops/v4/config/NodeConfig.js +490 -0
  345. package/dist/lib/models/aiops/v4/config/NodeSource.d.ts +19 -0
  346. package/dist/lib/models/aiops/v4/config/NodeSource.js +91 -0
  347. package/dist/lib/models/aiops/v4/config/PolicyType.d.ts +19 -0
  348. package/dist/lib/models/aiops/v4/config/PolicyType.js +85 -0
  349. package/dist/lib/models/aiops/v4/config/ReplicationFactor.d.ts +19 -0
  350. package/dist/lib/models/aiops/v4/config/ReplicationFactor.js +85 -0
  351. package/dist/lib/models/aiops/v4/config/ResourceCapacity.d.ts +126 -0
  352. package/dist/lib/models/aiops/v4/config/ResourceCapacity.js +451 -0
  353. package/dist/lib/models/aiops/v4/config/Runway.d.ts +130 -0
  354. package/dist/lib/models/aiops/v4/config/Runway.js +479 -0
  355. package/dist/lib/models/aiops/v4/config/RunwayParams.d.ts +77 -0
  356. package/dist/lib/models/aiops/v4/config/RunwayParams.js +323 -0
  357. package/dist/lib/models/aiops/v4/config/RunwayParamsProjection.d.ts +14 -0
  358. package/dist/lib/models/aiops/v4/config/RunwayParamsProjection.js +159 -0
  359. package/dist/lib/models/aiops/v4/config/Scenario.d.ts +178 -0
  360. package/dist/lib/models/aiops/v4/config/Scenario.js +579 -0
  361. package/dist/lib/models/aiops/v4/config/ScenarioProjection.d.ts +10 -0
  362. package/dist/lib/models/aiops/v4/config/ScenarioProjection.js +156 -0
  363. package/dist/lib/models/aiops/v4/config/SimulatedVmResourceSpec.d.ts +106 -0
  364. package/dist/lib/models/aiops/v4/config/SimulatedVmResourceSpec.js +403 -0
  365. package/dist/lib/models/aiops/v4/config/SimulatedVmResourceSpecProjection.d.ts +16 -0
  366. package/dist/lib/models/aiops/v4/config/SimulatedVmResourceSpecProjection.js +162 -0
  367. package/dist/lib/models/aiops/v4/config/Simulation.d.ts +56 -0
  368. package/dist/lib/models/aiops/v4/config/Simulation.js +317 -0
  369. package/dist/lib/models/aiops/v4/config/SimulationProjection.d.ts +10 -0
  370. package/dist/lib/models/aiops/v4/config/SimulationProjection.js +153 -0
  371. package/dist/lib/models/aiops/v4/config/Source.d.ts +37 -0
  372. package/dist/lib/models/aiops/v4/config/Source.js +275 -0
  373. package/dist/lib/models/aiops/v4/config/SourceListApiResponse.d.ts +106 -0
  374. package/dist/lib/models/aiops/v4/config/SourceListApiResponse.js +365 -0
  375. package/dist/lib/models/aiops/v4/config/SplunkWorkload.d.ts +118 -0
  376. package/dist/lib/models/aiops/v4/config/SplunkWorkload.js +446 -0
  377. package/dist/lib/models/aiops/v4/config/SqlProfileType.d.ts +19 -0
  378. package/dist/lib/models/aiops/v4/config/SqlProfileType.js +91 -0
  379. package/dist/lib/models/aiops/v4/config/SqlTransactionType.d.ts +19 -0
  380. package/dist/lib/models/aiops/v4/config/SqlTransactionType.js +85 -0
  381. package/dist/lib/models/aiops/v4/config/SqlWorkload.d.ts +110 -0
  382. package/dist/lib/models/aiops/v4/config/SqlWorkload.js +415 -0
  383. package/dist/lib/models/aiops/v4/config/UpdateIgnoreWindowApiResponse.d.ts +99 -0
  384. package/dist/lib/models/aiops/v4/config/UpdateIgnoreWindowApiResponse.js +343 -0
  385. package/dist/lib/models/aiops/v4/config/UpdatePolicyTaskApiResponse.d.ts +99 -0
  386. package/dist/lib/models/aiops/v4/config/UpdatePolicyTaskApiResponse.js +343 -0
  387. package/dist/lib/models/aiops/v4/config/UpdateScenarioApiResponse.d.ts +99 -0
  388. package/dist/lib/models/aiops/v4/config/UpdateScenarioApiResponse.js +343 -0
  389. package/dist/lib/models/aiops/v4/config/UpdateSimulationApiResponse.d.ts +99 -0
  390. package/dist/lib/models/aiops/v4/config/UpdateSimulationApiResponse.js +365 -0
  391. package/dist/lib/models/aiops/v4/config/ValueRange.d.ts +64 -0
  392. package/dist/lib/models/aiops/v4/config/ValueRange.js +312 -0
  393. package/dist/lib/models/aiops/v4/config/ValueType.d.ts +19 -0
  394. package/dist/lib/models/aiops/v4/config/ValueType.js +121 -0
  395. package/dist/lib/models/aiops/v4/config/VdiProvisionType.d.ts +19 -0
  396. package/dist/lib/models/aiops/v4/config/VdiProvisionType.js +103 -0
  397. package/dist/lib/models/aiops/v4/config/VdiUserType.d.ts +19 -0
  398. package/dist/lib/models/aiops/v4/config/VdiUserType.js +97 -0
  399. package/dist/lib/models/aiops/v4/config/VdiVendor.d.ts +19 -0
  400. package/dist/lib/models/aiops/v4/config/VdiVendor.js +85 -0
  401. package/dist/lib/models/aiops/v4/config/VdiWorkload.d.ts +109 -0
  402. package/dist/lib/models/aiops/v4/config/VdiWorkload.js +412 -0
  403. package/dist/lib/models/aiops/v4/config/Vendor.d.ts +19 -0
  404. package/dist/lib/models/aiops/v4/config/Vendor.js +127 -0
  405. package/dist/lib/models/aiops/v4/config/VmCategoryWorkload.d.ts +94 -0
  406. package/dist/lib/models/aiops/v4/config/VmCategoryWorkload.js +370 -0
  407. package/dist/lib/models/aiops/v4/config/VmWorkload.d.ts +80 -0
  408. package/dist/lib/models/aiops/v4/config/VmWorkload.js +335 -0
  409. package/dist/lib/models/aiops/v4/config/Workload.d.ts +122 -0
  410. package/dist/lib/models/aiops/v4/config/Workload.js +447 -0
  411. package/dist/lib/models/aiops/v4/config/XenOperatingSystem.d.ts +19 -0
  412. package/dist/lib/models/aiops/v4/config/XenOperatingSystem.js +85 -0
  413. package/dist/lib/models/aiops/v4/config/XenWorkload.d.ts +151 -0
  414. package/dist/lib/models/aiops/v4/config/XenWorkload.js +532 -0
  415. package/dist/lib/models/aiops/v4/config/XfitPolicy.d.ts +161 -0
  416. package/dist/lib/models/aiops/v4/config/XfitPolicy.js +589 -0
  417. package/dist/lib/models/aiops/v4/config/XfitPolicyProjection.d.ts +16 -0
  418. package/dist/lib/models/aiops/v4/config/XfitPolicyProjection.js +167 -0
  419. package/dist/lib/models/aiops/v4/error/AppMessage.d.ts +69 -51
  420. package/dist/lib/models/aiops/v4/error/AppMessage.js +140 -103
  421. package/dist/lib/models/aiops/v4/error/ErrorResponse.d.ts +25 -22
  422. package/dist/lib/models/aiops/v4/error/ErrorResponse.js +159 -103
  423. package/dist/lib/models/aiops/v4/error/SchemaValidationError.d.ts +65 -44
  424. package/dist/lib/models/aiops/v4/error/SchemaValidationError.js +138 -95
  425. package/dist/lib/models/aiops/v4/error/SchemaValidationErrorMessage.d.ts +42 -33
  426. package/dist/lib/models/aiops/v4/error/SchemaValidationErrorMessage.js +115 -72
  427. package/dist/lib/models/aiops/v4/stats/BoolList.d.ts +61 -0
  428. package/dist/lib/models/aiops/v4/stats/BoolList.js +288 -0
  429. package/dist/lib/models/aiops/v4/stats/BoolVal.d.ts +61 -0
  430. package/dist/lib/models/aiops/v4/stats/BoolVal.js +280 -0
  431. package/dist/lib/models/aiops/v4/stats/DoubleList.d.ts +61 -0
  432. package/dist/lib/models/aiops/v4/stats/DoubleList.js +288 -0
  433. package/dist/lib/models/aiops/v4/stats/DoubleVal.d.ts +61 -0
  434. package/dist/lib/models/aiops/v4/stats/DoubleVal.js +280 -0
  435. package/dist/lib/models/aiops/v4/stats/Entity.d.ts +57 -0
  436. package/dist/lib/models/aiops/v4/stats/Entity.js +413 -0
  437. package/dist/lib/models/aiops/v4/stats/EntityListApiResponse.d.ts +99 -0
  438. package/dist/lib/models/aiops/v4/stats/EntityListApiResponse.js +365 -0
  439. package/dist/lib/models/aiops/v4/stats/IntList.d.ts +61 -0
  440. package/dist/lib/models/aiops/v4/stats/IntList.js +288 -0
  441. package/dist/lib/models/aiops/v4/stats/IntVal.d.ts +61 -0
  442. package/dist/lib/models/aiops/v4/stats/IntVal.js +280 -0
  443. package/dist/lib/models/aiops/v4/stats/Metric.d.ts +75 -0
  444. package/dist/lib/models/aiops/v4/stats/Metric.js +312 -0
  445. package/dist/lib/models/aiops/v4/stats/Point.d.ts +72 -0
  446. package/dist/lib/models/aiops/v4/stats/Point.js +356 -0
  447. package/dist/lib/models/aiops/v4/stats/StrList.d.ts +61 -0
  448. package/dist/lib/models/aiops/v4/stats/StrList.js +288 -0
  449. package/dist/lib/models/aiops/v4/stats/StrVal.d.ts +61 -0
  450. package/dist/lib/models/aiops/v4/stats/StrVal.js +280 -0
  451. package/dist/lib/models/aiops/v4/stats/TimeSeries.d.ts +71 -0
  452. package/dist/lib/models/aiops/v4/stats/TimeSeries.js +326 -0
  453. package/dist/lib/models/common/v1/config/Flag.d.ts +34 -27
  454. package/dist/lib/models/common/v1/config/Flag.js +114 -65
  455. package/dist/lib/models/common/v1/config/IPv4Address.d.ts +42 -27
  456. package/dist/lib/models/common/v1/config/IPv4Address.js +112 -69
  457. package/dist/lib/models/common/v1/config/KVPair.d.ts +37 -29
  458. package/dist/lib/models/common/v1/config/KVPair.js +167 -98
  459. package/dist/lib/models/common/v1/config/KVStringPair.d.ts +64 -0
  460. package/dist/lib/models/common/v1/config/KVStringPair.js +318 -0
  461. package/dist/lib/models/common/v1/config/MapOfStringWrapper.d.ts +58 -0
  462. package/dist/lib/models/common/v1/config/MapOfStringWrapper.js +275 -0
  463. package/dist/lib/models/common/v1/config/Message.d.ts +45 -39
  464. package/dist/lib/models/common/v1/config/Message.js +114 -81
  465. package/dist/lib/models/common/v1/config/MessageSeverity.js +22 -35
  466. package/dist/lib/models/common/v1/config/TenantAwareModel.d.ts +26 -23
  467. package/dist/lib/models/common/v1/config/TenantAwareModel.js +99 -60
  468. package/dist/lib/models/common/v1/response/ApiLink.d.ts +34 -31
  469. package/dist/lib/models/common/v1/response/ApiLink.js +108 -71
  470. package/dist/lib/models/common/v1/response/ApiResponseMetadata.d.ts +91 -47
  471. package/dist/lib/models/common/v1/response/ApiResponseMetadata.js +148 -108
  472. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.d.ts +27 -20
  473. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.js +126 -95
  474. package/dist/lib/models/common/v1/stats/DownSamplingOperator.d.ts +19 -0
  475. package/dist/lib/models/common/v1/stats/DownSamplingOperator.js +109 -0
  476. package/dist/lib/models/prism/v4/config/TaskReference.d.ts +52 -0
  477. package/dist/lib/models/prism/v4/config/TaskReference.js +285 -0
  478. package/dist/lib/models/validation/ValidationError.js +12 -19
  479. package/dist/lib/models/validation/ValidationScopes.js +2 -7
  480. package/dist/lib/utils/ValidationUtils.js +12 -18
  481. package/package.json +7 -9
  482. package/dist/es/apis/cluster-endpoints.d.ts +0 -48
  483. package/dist/es/apis/cluster-endpoints.js +0 -145
  484. package/dist/es/models/aiops/v4/clusterMetrics/ClusterApiResponse.d.ts +0 -60
  485. package/dist/es/models/aiops/v4/clusterMetrics/ClusterApiResponse.js +0 -339
  486. package/dist/es/models/aiops/v4/clusterMetrics/ClusterListApiResponse.d.ts +0 -60
  487. package/dist/es/models/aiops/v4/clusterMetrics/ClusterListApiResponse.js +0 -351
  488. package/dist/lib/apis/cluster-endpoints.d.ts +0 -48
  489. package/dist/lib/apis/cluster-endpoints.js +0 -145
  490. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterApiResponse.d.ts +0 -60
  491. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterApiResponse.js +0 -339
  492. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterListApiResponse.d.ts +0 -60
  493. package/dist/lib/models/aiops/v4/clusterMetrics/ClusterListApiResponse.js +0 -351
@@ -4,174 +4,261 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ApiClient = void 0;
7
-
8
7
  var _superagent = _interopRequireDefault(require("superagent"));
9
-
10
- var _querystring = _interopRequireDefault(require("querystring"));
11
-
12
8
  var _Paginable = _interopRequireDefault(require("./Paginable"));
13
-
14
9
  var _uuid = require("uuid");
15
-
16
10
  var _superagentRetryDelay = _interopRequireDefault(require("superagent-retry-delay"));
17
-
18
- var _console = _interopRequireDefault(require("console"));
19
-
20
11
  var _https = _interopRequireDefault(require("https"));
21
-
22
12
  var _fs2 = _interopRequireDefault(require("fs"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
-
26
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
27
-
28
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
-
30
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
-
32
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
33
-
34
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
39
-
13
+ var _path = _interopRequireDefault(require("path"));
14
+ var _buffer = require("buffer");
15
+ var _ApiResponseMetadata = _interopRequireDefault(require("./models/common/v1/response/ApiResponseMetadata"));
16
+ var _Flag = _interopRequireDefault(require("./models/common/v1/config/Flag"));
17
+ var _ApiClient;
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
19
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
20
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
21
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
22
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
25
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
26
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
27
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
28
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
29
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
30
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
31
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
32
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
33
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
35
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
36
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
37
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
38
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
39
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /*
40
+ * Nutanix AIOps APIs
41
+ *
42
+ * OpenAPI spec version: 4.0.1
43
+ *
44
+ * NOTE: This class is auto generated by the Open API Dev Platform.
45
+ *
46
+ * Open API Dev Platform Codegen version: 16.9.0.8546-RELEASE
47
+ *
48
+ * Do not edit the class manually.
49
+ *
50
+ */
40
51
  (0, _superagentRetryDelay["default"])(_superagent["default"]);
41
-
42
52
  /**
43
53
  * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
44
54
  * application to use this class directly - the *Api and model classes provide the public API for the service. The
45
55
  * contents of this file should be regarded as internal but are documented for completeness.
46
56
  * @module ApiClient
47
- * @version 4.0.1-alpha-1
57
+ * @version 4.0.1
48
58
  */
49
- var ApiClient = /*#__PURE__*/function () {
59
+ var _protocol = /*#__PURE__*/new WeakMap();
60
+ var _cookie = /*#__PURE__*/new WeakMap();
61
+ var _logger = /*#__PURE__*/new WeakMap();
62
+ var _verifySslFlag = /*#__PURE__*/new WeakMap();
63
+ var _defaultConnectTimeout = /*#__PURE__*/new WeakMap();
64
+ var _defaultReadTimeout = /*#__PURE__*/new WeakMap();
65
+ var _defaultMaxTimeout = /*#__PURE__*/new WeakMap();
66
+ var _LOG_LEVEL = /*#__PURE__*/new WeakMap();
67
+ var _ApiClient_brand = /*#__PURE__*/new WeakSet();
68
+ var ApiClient = exports.ApiClient = /*#__PURE__*/function () {
50
69
  /**
51
70
  * @alias module:ApiClient
52
71
  * @class
53
72
  */
54
73
  function ApiClient() {
55
74
  _classCallCheck(this, ApiClient);
56
-
57
75
  /*
58
- * The protocol of the base URL, including the colon (:).
59
- * @type {String}
60
- * @default https:
76
+ * Checks whether the given content type represents JSON.<br>
77
+ * JSON content type examples:<br>
78
+ * <ul>
79
+ * <li>application/json</li>
80
+ * <li>application/json; charset=UTF8</li>
81
+ * <li>APPLICATION/JSON</li>
82
+ * </ul>
83
+ * @param {String} contentType The MIME content type to check.
84
+ * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
85
+ */
86
+ _classPrivateMethodInitSpec(this, _ApiClient_brand);
87
+ // PRIVATE VARIABLES
88
+ _classPrivateFieldInitSpec(this, _protocol, void 0);
89
+ _classPrivateFieldInitSpec(this, _cookie, void 0);
90
+ _classPrivateFieldInitSpec(this, _logger, void 0);
91
+ _classPrivateFieldInitSpec(this, _verifySslFlag, void 0);
92
+ _classPrivateFieldInitSpec(this, _defaultConnectTimeout, void 0);
93
+ _classPrivateFieldInitSpec(this, _defaultReadTimeout, void 0);
94
+ _classPrivateFieldInitSpec(this, _defaultMaxTimeout, void 0);
95
+ _classPrivateFieldInitSpec(this, _LOG_LEVEL, void 0);
96
+ _classPrivateFieldSet(_LOG_LEVEL, this, Object.freeze({
97
+ DEBUG: {
98
+ key: "DEBUG",
99
+ value: Symbol(0)
100
+ },
101
+ INFO: {
102
+ key: "INFO",
103
+ value: Symbol(1)
104
+ },
105
+ WARN: {
106
+ key: "WARN",
107
+ value: Symbol(2)
108
+ },
109
+ ERROR: {
110
+ key: "ERROR",
111
+ value: Symbol(3)
112
+ }
113
+ }));
114
+
115
+ /**
116
+ * URI scheme for connecting to the cluster (HTTP or HTTPS using SSL/TLS)
117
+ * @type {String}
118
+ * @default https
61
119
  */
62
- this.protocol = typeof self === 'undefined' ? 'https:' : self.protocol;
120
+ this.scheme = 'https';
121
+
63
122
  /**
64
123
  * The hostname of the URL against which to resolve every API call's (relative) path.
65
124
  * @type {String}
66
125
  * @default localhost
67
126
  */
127
+ this.host = typeof self === 'undefined' ? 'localhost' : self.location.hostname;
68
128
 
69
- this.host = typeof self === 'undefined' ? 'localhost' : self.host;
70
129
  /**
71
130
  * The port of the base URL.
72
131
  * @type {String}
73
132
  * @default 9440
74
133
  */
134
+ this.port = typeof self === 'undefined' ? '9440' : self.location.port;
75
135
 
76
- this.port = typeof self === 'undefined' ? '9440' : self.port;
77
136
  /**
78
137
  * The authentication methods to be included for all API calls.
79
138
  * @type {Array.<String>}
80
139
  */
81
-
82
140
  this.authentications = {
141
+ 'apiKeyAuthScheme': {
142
+ type: 'apiKey',
143
+ 'in': 'header',
144
+ name: 'X-ntnx-api-key'
145
+ },
83
146
  'basicAuthScheme': {
84
147
  type: 'basic'
85
148
  }
86
149
  };
150
+
87
151
  /**
88
152
  * The default HTTP headers to be included for all API calls.
89
153
  * @type {Array.<String>}
90
154
  * @default {}
91
155
  */
92
-
93
156
  this.defaultHeaders = {};
157
+ _classPrivateFieldSet(_defaultConnectTimeout, this, 30000);
158
+ _classPrivateFieldSet(_defaultReadTimeout, this, 30000);
159
+ _classPrivateFieldSet(_defaultMaxTimeout, this, 10800000);
160
+
94
161
  /**
95
- * The default HTTP timeout for all API calls.
162
+ * The default HTTP read timeout in milliseconds for all API calls.
96
163
  * @type {Number}
97
164
  * @default 30000
98
165
  */
166
+ this.readTimeout = _classPrivateFieldGet(_defaultReadTimeout, this);
167
+
168
+ /**
169
+ * The default HTTP connection timeout in milliseconds for all API calls.
170
+ * @type {Number}
171
+ * @default 30000
172
+ */
173
+ this.connectTimeout = _classPrivateFieldGet(_defaultConnectTimeout, this);
99
174
 
100
- this.timeout = 30000;
101
175
  /**
102
176
  * If set to false an additional timestamp parameter is added to all API GET calls to
103
177
  * prevent browser caching
104
178
  * @type {Boolean}
105
179
  * @default true
106
180
  */
107
-
108
181
  this.cache = true;
182
+
109
183
  /**
110
184
  * Saved Cookies
111
185
  * @default null
112
186
  */
187
+ _classPrivateFieldSet(_cookie, this, null);
188
+
189
+ /**
190
+ * The maximum number of redirects to be followed for all API calls.
191
+ * @type {Number}
192
+ * @default 1
193
+ */
194
+ this.maxRedirects = 1;
113
195
 
114
- this.cookie = null;
115
196
  /**
116
197
  * The maximum number of retry attempts to be made by the client
117
198
  * in case of server error.
118
199
  * @type {Number}
119
200
  * @default 5
120
201
  */
121
-
122
202
  this.maxRetryAttempts = 5;
203
+
123
204
  /**
124
205
  * The delay period (in milliseconds) between two consecutive retry attempts
125
206
  * @type {Number}
126
207
  * @default 3000
127
208
  */
128
-
129
209
  this.retryInterval = 3000;
130
-
131
210
  if (typeof self === 'undefined') {
132
211
  this.agent = new _superagent["default"].agent();
133
212
  }
213
+
134
214
  /**
135
215
  * Allow user to override superagent agent
136
216
  */
137
-
138
-
139
217
  this.requestAgent = null;
218
+
140
219
  /**
141
220
  * Allow SDK to print debug logs
142
221
  */
143
-
144
222
  this.debug = false;
145
- this.logger = null;
223
+ _classPrivateFieldSet(_logger, this, null);
224
+
146
225
  /**
147
226
  * Username for basic auth
148
227
  */
149
-
150
228
  this.username = null;
229
+
151
230
  /**
152
231
  * Password for basic auth
153
232
  */
154
-
155
233
  this.password = null;
234
+ _classPrivateFieldSet(_verifySslFlag, this, true);
235
+
156
236
  /*
157
- * Enable/Disable SSL Verification
237
+ * Non Browser Environment : path to directory where downloaded files will be stored
238
+ * Browser Environment : WritableStream to pipe downloaded file to
158
239
  */
240
+ this.downloadDestination = null;
159
241
 
160
- this.verifySsl = null;
161
242
  /*
162
243
  * Log file to write activity logs
163
244
  */
164
-
165
245
  this.loggerFile = null;
166
246
  }
247
+
167
248
  /**
168
249
  * Enable/Disable SSL Verification
169
250
  * @param verifySsl (boolean)
170
251
  */
171
-
172
-
173
- _createClass(ApiClient, [{
252
+ return _createClass(ApiClient, [{
174
253
  key: "verifySsl",
254
+ get: function get() {
255
+ return _classPrivateFieldGet(_verifySslFlag, this);
256
+ }
257
+
258
+ /**
259
+ * Configure log file to write activity logs
260
+ * @param logfile The destination file (write stream / string)
261
+ */,
175
262
  set: function set(verifySsl) {
176
263
  if (verifySsl) {
177
264
  this.requestAgent = null;
@@ -180,12 +267,8 @@ var ApiClient = /*#__PURE__*/function () {
180
267
  rejectUnauthorized: false
181
268
  });
182
269
  }
270
+ _classPrivateFieldSet(_verifySslFlag, this, verifySsl);
183
271
  }
184
- /**
185
- * Configure log file to write activity logs
186
- * @param logfile The destination file (write stream / string)
187
- */
188
-
189
272
  }, {
190
273
  key: "loggerFile",
191
274
  set: function set(logfile) {
@@ -195,182 +278,74 @@ var ApiClient = /*#__PURE__*/function () {
195
278
  flags: 'a'
196
279
  });
197
280
  }
198
-
199
- this.logger = new _console["default"].constructor({
281
+ _classPrivateFieldSet(_logger, this, new console.Console({
200
282
  stdout: logfile,
201
283
  stderr: logfile
202
- });
284
+ }));
203
285
  }
204
286
  }
287
+
205
288
  /**
206
289
  * Adds key value pair to default headers map, (to be added to every API call request)
207
- * @param key The key (string)
208
- * @param value The corresponding value (string)
290
+ * @param {String} key The key
291
+ * @param {String} value The corresponding value
209
292
  */
210
-
211
293
  }, {
212
294
  key: "addDefaultHeader",
213
295
  value: function addDefaultHeader(key, value) {
214
296
  if (key === "Authorization") {
215
- this.cookie = null;
297
+ _classPrivateFieldSet(_cookie, this, null);
216
298
  }
217
-
218
299
  this.defaultHeaders[key] = value;
219
300
  }
301
+
220
302
  /*
221
303
  * Returns a string representation for an actual parameter.
222
304
  * @param param The actual parameter.
223
305
  * @returns {String} The string representation of <code>param</code>.
224
306
  */
225
-
226
307
  }, {
227
308
  key: "paramToString",
228
309
  value: function paramToString(param) {
229
310
  if (param == undefined || param == null) {
230
311
  return '';
231
312
  }
232
-
233
313
  if (param instanceof Date) {
234
314
  return param.toJSON();
235
315
  }
236
-
237
316
  return param.toString();
238
317
  }
239
318
  }, {
240
319
  key: "buildUrl",
241
320
  value: function buildUrl(path, pathParams) {
242
321
  var _this = this;
243
-
244
322
  if (!path.match(/^\//)) {
245
323
  path = '/' + path;
246
324
  }
247
325
 
326
+ // The protocol of the base URL, including the colon (:).
327
+ _classPrivateFieldSet(_protocol, this, typeof self === 'undefined' ? this.scheme + ':' : self.location.protocol);
248
328
  var basePath = ''; //default
249
-
250
- if (this.protocol !== '' && this.host !== '' && this.port !== '') {
251
- basePath = this.protocol + '\/\/' + this.host + ':' + this.port;
329
+ if (_classPrivateFieldGet(_protocol, this) !== '' && this.host !== '' && this.port !== '') {
330
+ basePath = _classPrivateFieldGet(_protocol, this) + '\/\/' + this.host + ':' + this.port;
252
331
  } else if (typeof self !== "undefined") {
253
332
  basePath = self.origin;
254
333
  }
255
-
256
334
  var url = basePath + path;
257
335
  url = url.replace(/\{([\w-]+)\}/g, function (fullMatch, key) {
258
336
  var value;
259
-
260
337
  if (pathParams.hasOwnProperty(key)) {
261
338
  value = _this.paramToString(pathParams[key]);
262
339
  } else {
263
340
  value = fullMatch;
264
341
  }
265
-
266
342
  return encodeURIComponent(value);
267
343
  });
268
- this.debugLog("Request URL :", url);
269
344
  return url;
270
345
  }
271
- /*
272
- * Checks whether the given content type represents JSON.<br>
273
- * JSON content type examples:<br>
274
- * <ul>
275
- * <li>application/json</li>
276
- * <li>application/json; charset=UTF8</li>
277
- * <li>APPLICATION/JSON</li>
278
- * </ul>
279
- * @param {String} contentType The MIME content type to check.
280
- * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
281
- */
282
-
283
- }, {
284
- key: "isJsonMime",
285
- value: function isJsonMime(contentType) {
286
- return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
287
- }
288
- /*
289
- * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
290
- * @param {Array.<String>} contentTypes
291
- * @returns {String} The chosen content type, preferring JSON.
292
- */
293
-
294
346
  }, {
295
- key: "jsonPreferredMime",
296
- value: function jsonPreferredMime(contentTypes) {
297
- for (var i = 0; i < contentTypes.length; i++) {
298
- if (this.isJsonMime(contentTypes[i])) {
299
- return contentTypes[i];
300
- }
301
- }
302
-
303
- return contentTypes[0];
304
- }
305
- /*
306
- * Checks whether the given parameter value represents file-like content.
307
- * @param param The parameter to check.
308
- * @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
309
- */
310
-
311
- }, {
312
- key: "isFileParam",
313
- value: function isFileParam(param) {
314
- // fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
315
- if (typeof require === 'function') {
316
- var _fs;
317
-
318
- try {
319
- _fs = require('fs');
320
- } catch (err) {}
321
-
322
- if (_fs && _fs.ReadStream && param instanceof _fs.ReadStream) {
323
- return true;
324
- }
325
- } // Buffer in Node.js
326
-
327
-
328
- if (typeof Buffer === 'function' && param instanceof Buffer) {
329
- return true;
330
- } // Blob in browser
331
-
332
-
333
- if (typeof Blob === 'function' && param instanceof Blob) {
334
- return true;
335
- } // File in browser (it seems File object is also instance of Blob, but keep this for safe)
336
-
337
-
338
- if (typeof File === 'function' && param instanceof File) {
339
- return true;
340
- }
341
-
342
- return false;
343
- }
344
- /*
345
- * Normalizes parameter values:
346
- * <ul>
347
- * <li>remove nils</li>
348
- * <li>keep files and arrays</li>
349
- * <li>format to string with `paramToString` for other cases</li>
350
- * </ul>
351
- * @param {Object.<String, Object>} params The parameters as object properties.
352
- * @returns {Object.<String, Object>} normalized parameters.
353
- */
354
-
355
- }, {
356
- key: "normalizeParams",
357
- value: function normalizeParams(params) {
358
- var newParams = {};
359
-
360
- for (var key in params) {
361
- if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
362
- var value = params[key];
363
-
364
- if (this.isFileParam(value) || Array.isArray(value)) {
365
- newParams[key] = value;
366
- } else {
367
- newParams[key] = this.paramToString(value);
368
- }
369
- }
370
- }
371
-
372
- return newParams;
373
- }
347
+ key: "buildCollectionParam",
348
+ value:
374
349
  /*
375
350
  * Builds a string representation of an array-type actual parameter, according to the given collection format.
376
351
  * @param {Array} param An array parameter.
@@ -378,164 +353,59 @@ var ApiClient = /*#__PURE__*/function () {
378
353
  * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
379
354
  * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
380
355
  */
381
-
382
- }, {
383
- key: "buildCollectionParam",
384
- value: function buildCollectionParam(param, collectionFormat) {
356
+ function buildCollectionParam(param, collectionFormat) {
385
357
  if (param == null) {
386
358
  return null;
387
359
  }
388
-
389
360
  switch (collectionFormat) {
390
361
  case 'csv':
391
362
  return param.map(this.paramToString).join(',');
392
-
393
363
  case 'ssv':
394
364
  return param.map(this.paramToString).join(' ');
395
-
396
365
  case 'tsv':
397
366
  return param.map(this.paramToString).join('\t');
398
-
399
367
  case 'pipes':
400
368
  return param.map(this.paramToString).join('|');
401
-
402
369
  case 'multi':
403
370
  //return the array directly as SuperAgent will handle it as expected
404
371
  return param.map(this.paramToString);
405
-
406
372
  default:
407
373
  throw new Error('Unknown collection format: ' + collectionFormat);
408
374
  }
409
375
  }
410
- /*
411
- * Applies authentication headers to the request.
412
- * @param {Object} request The request object created by a <code>superagent()</code> call.
413
- * @param {Array.<String>} authNames An array of authentication method names.
414
- */
415
-
416
- }, {
417
- key: "applyAuthToRequest",
418
- value: function applyAuthToRequest(request, authNames) {
419
- var _this2 = this;
420
-
421
- authNames.forEach(function (authName) {
422
- var auth = _this2.authentications[authName];
423
-
424
- switch (auth.type) {
425
- case 'basic':
426
- if (auth.username || auth.password) {
427
- request.auth(auth.username || '', auth.password || '');
428
- } else if (_this2.username || _this2.password) {
429
- request.auth(_this2.username || '', _this2.password || '');
430
- }
431
-
432
- _this2.debugLog("Basic Auth applied to request");
433
-
434
- break;
435
-
436
- case 'apiKey':
437
- if (auth.apiKey) {
438
- var data = {};
439
-
440
- if (auth.apiKeyPrefix) {
441
- data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
442
- } else {
443
- data[auth.name] = auth.apiKey;
444
- }
445
-
446
- if (auth['in'] === 'header') {
447
- request.set(data);
448
- } else {
449
- request.query(data);
450
- }
451
- }
452
-
453
- _this2.debugLog("apiKey applied to request");
454
-
455
- break;
456
376
 
457
- case 'oauth2':
458
- if (auth.accessToken) {
459
- request.set({
460
- 'Authorization': 'Bearer ' + auth.accessToken
461
- });
462
- }
463
-
464
- _this2.debugLog("apiKey applied to request");
465
-
466
- break;
467
-
468
- default:
469
- throw new Error('Unknown authentication type: ' + auth.type);
470
- }
471
- });
472
- }
473
- /**
474
- * Deserializes an HTTP response body into a value of the specified type.
475
- * @param {Object} response A SuperAgent response object.
476
- * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
477
- * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
478
- * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
479
- * all properties on <code>data<code> will be converted to this type.
480
- * @returns A value of the specified type.
377
+ /*
378
+ * Sets API key for authentication
379
+ *
380
+ * @param {String} key The API key for authentication
481
381
  */
482
-
483
382
  }, {
484
- key: "deserialize",
485
- value: function deserialize(response, returnType) {
486
- if (response == null || returnType == null || response.status == 204) {
487
- return null;
488
- } // Rely on SuperAgent for parsing response body.
489
- // See http://visionmedia.github.io/superagent/#parsing-response-bodies
490
-
491
-
492
- var data = response.body;
493
-
494
- if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
495
- // SuperAgent does not always produce a body; use the unparsed response as a fallback
496
- data = response.text;
383
+ key: "setApiKey",
384
+ value: function setApiKey(key) {
385
+ if (key == undefined || typeof key === 'string' || key instanceof String) {
386
+ this.authentications['apiKeyAuthScheme']['apiKey'] = key;
387
+ } else {
388
+ this.authentications['apiKeyAuthScheme']['apiKey'] = undefined;
497
389
  }
498
-
499
- return ApiClient.convertToType(data, returnType);
500
390
  }
501
- /**
502
- * Set pagination data if response is a Paginable object
503
- * @param {Object} data The response data already passed through deserialize
504
- * @param {String} path The path given to callApi method
505
- * @param {Object.<String, Object>} queryParams The queryParams given to callApi method
506
- */
507
-
508
- }, {
509
- key: "paginateIfNeeded",
510
- value: function paginateIfNeeded(data, path, queryParams) {
511
- // If response is not a Paginable instance, nothing to do
512
- if (!(data instanceof _Paginable["default"])) {
513
- return;
514
- } // Retrieve current page number, defaults to 0
515
-
516
-
517
- var page = parseInt(this.constructor.parseQueryParam(path, queryParams, '$page', "0"), 10); // Retrieve current limit (results per page) number, defaults to 50
518
391
 
519
- var resultsPerPage = parseInt(this.constructor.parseQueryParam(path, queryParams, '$limit', "50"), 10); // Populate pagination data
520
-
521
- data.populatePaginationMetadata(this, // current ApiClient instance
522
- page, resultsPerPage);
523
- }
392
+ /*
393
+ * Applies authentication headers to the request.
394
+ * @param {Object} request The request object created by a <code>superagent()</code> call.
395
+ * @param {Array.<String>} authNames An array of authentication method names.
396
+ */
524
397
  }, {
525
398
  key: "addEtagToReservedMap",
526
399
  value: function addEtagToReservedMap(response, data) {
527
400
  if (response.hasOwnProperty("headers") && response.headers.hasOwnProperty("etag")) {
528
401
  var etagRef = response.headers.etag;
529
-
530
402
  if (data.getData() !== undefined) {
531
403
  if (Array.isArray(data.getData()) && data.getData().length > 0) {
532
404
  var _iterator = _createForOfIteratorHelper(data.getData()),
533
- _step;
534
-
405
+ _step;
535
406
  try {
536
407
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
537
408
  var item = _step.value;
538
-
539
409
  if (item.hasOwnProperty("$reserved") && item.get$Reserved() !== undefined) {
540
410
  item.get$Reserved()["ETag"] = etagRef;
541
411
  }
@@ -550,88 +420,20 @@ var ApiClient = /*#__PURE__*/function () {
550
420
  }
551
421
  }
552
422
  }
553
-
554
423
  return data;
555
424
  }
425
+
556
426
  /**
557
427
  * Get ETag from an object if exists.
558
428
  * The ETag is usually provided in the response of the GET API calls,
559
429
  * which can further be used in other HTTP operations.
560
430
  *
561
431
  * @param object Object from which ETag needs to be retrieved
562
- * @returns returns ETag header in the object if it's an API response object, otherwise null
432
+ * @returns {(String|null)} returns ETag header in the object if it's an API response object, otherwise null
563
433
  */
564
-
565
434
  }, {
566
- key: "updateCookies",
567
- value: // If enabled, update cookie information to reuse in subsequent requests for a valid response
568
- function updateCookies(response) {
569
- if (response.hasOwnProperty("headers") && response.headers.hasOwnProperty("set-cookie")) {
570
- var finalCookie = "";
571
- var cookieList = response.headers["set-cookie"];
572
-
573
- if (cookieList.length > 0) {
574
- // add all cookies separated by ;
575
- var _iterator2 = _createForOfIteratorHelper(cookieList),
576
- _step2;
577
-
578
- try {
579
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
580
- var cookieItem = _step2.value;
581
- cookieItem = cookieItem.split(";")[0];
582
-
583
- if (cookieItem.includes("=")) {
584
- cookieItem.trim();
585
- finalCookie = finalCookie.concat(cookieItem).concat(";");
586
- }
587
- } // remove trailing ;
588
-
589
- } catch (err) {
590
- _iterator2.e(err);
591
- } finally {
592
- _iterator2.f();
593
- }
594
-
595
- if (finalCookie !== "") {
596
- finalCookie = finalCookie.substr(0, finalCookie.length - 1);
597
- }
598
- }
599
-
600
- this.cookie = finalCookie;
601
- this.debugLog("Retained cookie :", finalCookie);
602
- } else {
603
- this.cookie = null;
604
- }
605
- } // If enabled, attach saved cookies to request
606
-
607
- }, {
608
- key: "attachCookies",
609
- value: function attachCookies(request) {
610
- if (this.cookie != null) {
611
- request.set(this.normalizeParams({
612
- 'Cookie': this.cookie
613
- }));
614
- }
615
- }
616
- }, {
617
- key: "debugLog",
618
- value: function debugLog() {
619
- for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) {
620
- messages[_key] = arguments[_key];
621
- }
622
-
623
- if (this.debug) {
624
- messages = messages.map(function (message) {
625
- return typeof message === "string" ? message : JSON.stringify(message, null, 2);
626
- });
627
-
628
- if (typeof this.logger !== "undefined" && this.logger !== null && typeof this.logger.log === 'function') {
629
- this.logger.log(messages.join(' ') + '\n');
630
- } else {
631
- console.log(messages.join(' '));
632
- }
633
- }
634
- }
435
+ key: "callApi",
436
+ value:
635
437
  /**
636
438
  * Invokes the REST service using the supplied settings and parameters.
637
439
  * @param {String} path The base URL to invoke.
@@ -648,65 +450,72 @@ var ApiClient = /*#__PURE__*/function () {
648
450
  * constructor for a complex type.
649
451
  * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
650
452
  */
651
-
652
- }, {
653
- key: "callApi",
654
- value: function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType) {
655
- var _this3 = this;
656
-
453
+ function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType) {
454
+ var _this2 = this;
657
455
  var url = this.buildUrl(path, pathParams);
658
- var request = (0, _superagent["default"])(httpMethod, url); // override request callback to retry only required status codes
456
+ var request = (0, _superagent["default"])(httpMethod, url);
659
457
 
458
+ // override request callback to retry only required status codes
660
459
  request.oldCallback = request.callback;
661
-
662
460
  request.callback = function (err, res) {
663
461
  if (res && res.status) {
664
462
  var status = res.status;
665
-
666
- if (status >= 400 && !(status === 401 || status === 408 || status === 503 || status === 504)) {
463
+ if (status >= 400 && !(status === 401 || status === 408 || status === 429 || status === 503 || status === 504)) {
667
464
  this._maxRetries = 0;
668
465
  }
669
-
670
466
  if (res.status === 401) {
671
467
  this.unset("Cookie");
672
468
  this._maxRetries = 1;
673
469
  }
470
+ if (status === 429) {
471
+ var retryAfter = res.headers['retry-after'];
472
+ if (retryAfter) {
473
+ var delay = parseInt(retryAfter, 10) * 1000;
474
+ this._retryDelays[this._retries] = delay;
475
+ }
476
+ }
674
477
  }
675
-
676
478
  this.oldCallback(err, res);
677
- }; // apply authentications
678
-
479
+ };
679
480
 
680
- this.applyAuthToRequest(request, authNames); // set query parameters
481
+ // apply authentications
482
+ _assertClassBrand(_ApiClient_brand, this, _applyAuthToRequest).call(this, request, authNames);
681
483
 
484
+ // set query parameters
682
485
  if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
683
486
  queryParams['_'] = new Date().getTime();
684
487
  }
488
+ request.query(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, queryParams));
685
489
 
686
- request.query(_querystring["default"].stringify(this.normalizeParams(queryParams))); // set header parameters
687
-
688
- request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
689
-
490
+ // set header parameters
491
+ request.set(this.defaultHeaders).set(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, headerParams));
690
492
  if ((this.defaultHeaders['NTNX-Request-Id'] === null || this.defaultHeaders['NTNX-Request-Id'] === undefined) && (headerParams['NTNX-Request-Id'] === null || headerParams['NTNX-Request-Id'] === undefined)) {
691
493
  var requestId = (0, _uuid.v4)();
692
- request.set(this.normalizeParams({
494
+ request.set(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, {
693
495
  'NTNX-Request-Id': requestId
694
496
  }));
695
- } // set requestAgent if it is set by user
497
+ }
696
498
 
499
+ // Set User-Agent header only if it is not a browser environment
500
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
501
+ if (!isBrowser) {
502
+ this.downloadDestination = '.';
503
+ request.set(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, {
504
+ 'User-Agent': 'Nutanix-aiops-js-client/4.0.1'
505
+ }));
506
+ }
697
507
 
508
+ // set requestAgent if it is set by user
698
509
  if (this.requestAgent) {
699
510
  request.agent(this.requestAgent);
700
- } // set request timeout
701
-
702
-
703
- if (!this.timeout < 0) {
704
- // other faulty values handled by superagent library
705
- request.timeout(this.timeout);
706
511
  }
707
512
 
708
- var contentType = this.jsonPreferredMime(contentTypes);
709
-
513
+ // set request timeouts
514
+ var timeoutOptions = {};
515
+ timeoutOptions["response"] = _assertClassBrand(_ApiClient_brand, this, _getValidTimeout).call(this, this.connectTimeout, _classPrivateFieldGet(_defaultConnectTimeout, this));
516
+ timeoutOptions["deadline"] = _assertClassBrand(_ApiClient_brand, this, _getValidTimeout).call(this, this.readTimeout, _classPrivateFieldGet(_defaultReadTimeout, this));
517
+ request.timeout(timeoutOptions);
518
+ var contentType = headerParams.hasOwnProperty("Content-Type") ? headerParams["Content-Type"] : _assertClassBrand(_ApiClient_brand, this, _jsonPreferredMime).call(this, contentTypes);
710
519
  if (contentType) {
711
520
  // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
712
521
  if (contentType != 'multipart/form-data') {
@@ -715,15 +524,15 @@ var ApiClient = /*#__PURE__*/function () {
715
524
  } else if (!request.header['Content-Type']) {
716
525
  request.type('application/json');
717
526
  }
718
-
527
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).INFO, null, "Request URL :", httpMethod, url);
528
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, _assertClassBrand(_ApiClient_brand, this, _flatten), "Request Headers :", typeof request.header === "undefined" ? "" : request.header);
719
529
  if (contentType === 'application/x-www-form-urlencoded') {
720
- request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
530
+ request.send(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, formParams));
721
531
  } else if (contentType == 'multipart/form-data') {
722
- var _formParams = this.normalizeParams(formParams);
723
-
532
+ var _formParams = _assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, formParams);
724
533
  for (var key in _formParams) {
725
534
  if (_formParams.hasOwnProperty(key)) {
726
- if (this.isFileParam(_formParams[key])) {
535
+ if (_assertClassBrand(_ApiClient_brand, this, _isFileParam).call(this, _formParams[key])) {
727
536
  // file field
728
537
  request.attach(key, _formParams[key]);
729
538
  } else {
@@ -731,61 +540,174 @@ var ApiClient = /*#__PURE__*/function () {
731
540
  }
732
541
  }
733
542
  }
543
+ } else if (contentType === 'application/octet-stream' && bodyParam !== null && typeof bodyParam !== 'undefined' && typeof bodyParam.pipe === 'function') {
544
+ // FILE UPLOAD SUPPORT
545
+
546
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).INFO, null, "Piping octet-stream request");
547
+ if (typeof bodyParam.pipe === 'function') {
548
+ bodyParam.pipe(request);
549
+ } else if (typeof require === 'function') {
550
+ var webstream;
551
+ try {
552
+ webstream = require('stream/web');
553
+ } catch (err) {
554
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).ERROR, null, "Error fetching steam/web");
555
+ }
556
+ if (bodyParam instanceof webstream.ReadableStream) {
557
+ bodyParam.pipeTo(new webstream.WritableStream({
558
+ write: function write(chunk) {
559
+ request.write(chunk);
560
+ },
561
+ close: function close() {
562
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).INFO, null, "READABLE STREAM CLOSED");
563
+ },
564
+ abort: function abort(err) {
565
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).ERROR, null, "READABLE STREAM ABORTED");
566
+ }
567
+ }));
568
+ } else {
569
+ request.send(bodyParam);
570
+ }
571
+ } else {
572
+ request.send(bodyParam);
573
+ }
574
+ return new Promise(function (resolve, reject) {
575
+ request.on('error', function (err) {
576
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).DEBUG, null, "Caught the following error :", err);
577
+ reject(err);
578
+ }).on('response', function (response) {
579
+ _assertClassBrand(_ApiClient_brand, _this2, _handleApiResponseForPromise).call(_this2, response, path, queryParams, returnType, resolve, reject);
580
+ });
581
+ });
734
582
  } else if (bodyParam) {
735
583
  request.send(bodyParam);
736
584
  }
737
-
738
- var accept = this.jsonPreferredMime(accepts);
739
-
740
- if (accept) {
741
- request.accept(accept);
742
- }
743
-
744
- if (returnType === 'Blob') {
585
+ if (typeof returnType === 'Blob') {
745
586
  request.responseType('blob');
746
587
  } else if (returnType === 'String') {
747
588
  request.responseType('string');
748
589
  }
749
-
750
- this.attachCookies(request);
751
- this.debugLog("Request Headers :", typeof request.headers === "undefined" ? "undefined" : request.headers);
752
- this.debugLog("Request Body :", typeof request.body === "undefined" ? "undefined" : request.body);
590
+ _assertClassBrand(_ApiClient_brand, this, _attachCookies).call(this, request);
591
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, null, "Request Body :", typeof request._data === "undefined" ? "" : request._data);
592
+ var accept = headerParams.hasOwnProperty("Accept") && headerParams["Accept"] != undefined ? headerParams["Accept"] : accepts.join(', ');
593
+ var binaryMediaTypes = ['application/octet-stream', 'application/pdf', 'application/zip'];
594
+ if (accept) {
595
+ request.accept(accept);
596
+ }
753
597
  return new Promise(function (resolve, reject) {
754
- request.retry(_this3.maxRetryAttempts, _this3.retryInterval, []).end(function (error, response) {
755
- _this3.updateCookies(response || {});
756
-
598
+ request.buffer(false).redirects(0).retry(_this2.maxRetryAttempts, _this2.retryInterval, []).on('error', function (err) {
599
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).DEBUG, null, "Caught the following error :", err);
600
+ }).end(function (error, response) {
757
601
  if (error) {
758
- error.data = _this3.deserialize(response, returnType);
759
-
760
- if (response !== null && typeof response !== 'undefined') {
761
- _this3.debugLog("Response Status :", response.status);
602
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).DEBUG, null, "Caught error during the request!");
603
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).ERROR, null, error);
604
+ if (error.response !== null && typeof error.response !== 'undefined') {
605
+ error.data = _assertClassBrand(_ApiClient_brand, _this2, _deserialize).call(_this2, error.response, returnType);
606
+ } else {
607
+ error.data = _assertClassBrand(_ApiClient_brand, _this2, _wrapErrorInResponse).call(_this2, error);
762
608
  }
763
-
764
- _this3.debugLog("Error :", error.data);
765
-
766
609
  reject(error);
767
610
  } else {
768
- _this3.debugLog("Response Status :", response.status);
769
-
770
- try {
771
- var data = _this3.deserialize(response, returnType);
772
-
773
- _this3.debugLog("Response Headers :", response.headers);
774
-
775
- _this3.debugLog("Response Body :", data);
776
-
777
- _this3.addEtagToReservedMap(response, data);
778
-
779
- _this3.paginateIfNeeded(data, path, queryParams);
780
-
781
- resolve({
782
- data: data,
783
- response: response
611
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).INFO, null, "Response Status :", response.status);
612
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).DEBUG, _assertClassBrand(_ApiClient_brand, _this2, _flatten), "Response Headers :", response.headers);
613
+ var _contentType = '';
614
+ if (response.headers.hasOwnProperty('content-type')) {
615
+ _contentType = response.headers["content-type"];
616
+ }
617
+ var fetchStream = binaryMediaTypes.some(function (binaryMediaType) {
618
+ return _contentType.includes(binaryMediaType);
619
+ });
620
+ if (fetchStream) {
621
+ /*
622
+ * Browser environment :
623
+ * uses Web Streams, downloadDestination expected to be a WritableStream (i.e. sink for response to be streamed to)
624
+ * Node.js environment :
625
+ * uses File System, downloadDestination expected to be a directory path, file is downloaded to this directory
626
+ */
627
+ if (isBrowser) {
628
+ /*
629
+ * Browser environment :
630
+ * - fetch webstream module
631
+ * - write file to WritableStream downloadDestination
632
+ * - if webstream if not available or downloadDestination is not instance of WritableStream
633
+ * code flow goes to main request.then execution
634
+ */
635
+ if (typeof require === 'function') {
636
+ var _webstream;
637
+ try {
638
+ _webstream = require('stream/web');
639
+ } catch (err) {
640
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).ERROR, null, "Error fetching steam/web");
641
+ }
642
+ if (_this2.downloadDestination instanceof _webstream.WritableStream) {
643
+ // Piping Data
644
+ var writer = _this2.downloadDestination.getWriter();
645
+ try {
646
+ response.on('data', function (chunk) {
647
+ writer.write(chunk);
648
+ });
649
+ } catch (err) {
650
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).ERROR, null, "Issue while downloading file", err);
651
+ }
652
+ response.on('end', function () {
653
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).INFO, null, "Finished streaming response");
654
+ writer.close();
655
+ var data = _assertClassBrand(_ApiClient_brand, _this2, _deserialize).call(_this2, response, returnType);
656
+ resolve({
657
+ data: data,
658
+ response: response
659
+ });
660
+ }).on('error', function (err) {
661
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).ERROR, null, "Caught the following error :", err);
662
+ err.data = _assertClassBrand(_ApiClient_brand, _this2, _wrapErrorInResponse).call(_this2, err);
663
+ reject(err);
664
+ });
665
+ } else {
666
+ var errMsg = "Incompatible downloadDestination for Browser Environment, must be WritableStream";
667
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).ERROR, null, errMsg);
668
+ reject(errMsg);
669
+ }
670
+ }
671
+ } else {
672
+ /*
673
+ * Non Browser environment :
674
+ * - stream data to file
675
+ * - fetch response headers and body (if exists)
676
+ * - return in case of error or after stream finish
677
+ *
678
+ * NOTE :
679
+ * superagent does not provide access to headers before pipe, therefore response is piped to
680
+ * file with temporary name, which is renamed to proper filename after Content-Disposition header is available
681
+ */
682
+
683
+ var tempFilename = _this2.downloadDestination + '/downloaded_file_' + Date.now() + '.txt'; // temporary filename
684
+ var stream = _fs2["default"].createWriteStream(tempFilename);
685
+ _assertClassBrand(_ApiClient_brand, _this2, _processDownloadedFile).call(_this2, response, stream, tempFilename, resolve, reject, returnType);
686
+ }
687
+ } else if (response.status == 302) {
688
+ /*
689
+ * Handling 302 Redirects
690
+ * - Reads X-Redirect-Token header from response and writes into Cookie header for redirected request
691
+ */
692
+ var _tempFilename = _this2.downloadDestination + '/downloaded_file_' + Date.now() + '.txt'; // temporary filename
693
+ var context = _this2;
694
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).INFO, null, "Redirecting to :", response.headers.location);
695
+ var redirectRequest = (0, _superagent["default"])(httpMethod, response.headers.location);
696
+ redirectRequest.set(request.header);
697
+ if (response.headers.hasOwnProperty("x-redirect-token")) {
698
+ _assertClassBrand(_ApiClient_brand, _this2, _log).call(_this2, _classPrivateFieldGet(_LOG_LEVEL, _this2).INFO, null, "Writing X-Redirect-Token into Cookie");
699
+ redirectRequest.set("Cookie", response.headers["x-redirect-token"]);
700
+ }
701
+ redirectRequest.redirects(0);
702
+ redirectRequest.buffer(false);
703
+ var redirectedStream = _fs2["default"].createWriteStream(_tempFilename);
704
+ redirectRequest.pipe(redirectedStream);
705
+ redirectRequest.on('response', function (redirectResponse) {
706
+ _assertClassBrand(_ApiClient_brand, context, _log).call(context, _classPrivateFieldGet(_LOG_LEVEL, context).INFO, null, "Received response after redirection :", redirectResponse.status);
707
+ _assertClassBrand(_ApiClient_brand, context, _processDownloadedFile).call(context, redirectResponse, redirectedStream, _tempFilename, resolve, reject, returnType);
784
708
  });
785
- } catch (err) {
786
- _this3.debugLog("Error :", err);
787
-
788
- reject(err);
709
+ } else {
710
+ _assertClassBrand(_ApiClient_brand, _this2, _handleApiResponseForPromise).call(_this2, response, path, queryParams, returnType, resolve, reject);
789
711
  }
790
712
  }
791
713
  });
@@ -795,17 +717,14 @@ var ApiClient = /*#__PURE__*/function () {
795
717
  key: "getEtag",
796
718
  value: function getEtag(object) {
797
719
  var etag = null;
798
-
799
720
  if (object !== undefined) {
800
721
  if (object.hasOwnProperty('$reserved') && object.get$Reserved() !== undefined) {
801
722
  etag = this.getValueForCaseInsensitiveKeyMatch(object.get$Reserved(), 'ETag');
802
723
  }
803
-
804
724
  if (etag == null && object.hasOwnProperty("data") && object.getData().hasOwnProperty('$reserved') && object.getData().get$Reserved() !== undefined) {
805
725
  etag = this.getValueForCaseInsensitiveKeyMatch(object.getData().get$Reserved(), 'ETag');
806
726
  }
807
727
  }
808
-
809
728
  return etag;
810
729
  }
811
730
  }, {
@@ -818,9 +737,12 @@ var ApiClient = /*#__PURE__*/function () {
818
737
  });
819
738
  return matchedKey ? object[matchedKey] : null;
820
739
  }
821
-
822
740
  return null;
823
741
  }
742
+
743
+ // Gets a valid timeout
744
+ // 1. Sets to provided default timeout in case invalid value is passed
745
+ // 2. Sets to default max value of 30 minutes in case a value of more than 30 minutes is passed
824
746
  }, {
825
747
  key: "addEtagReferenceToHeader",
826
748
  value: function addEtagReferenceToHeader(bodyParam, headerParams) {
@@ -828,24 +750,24 @@ var ApiClient = /*#__PURE__*/function () {
828
750
  if (typeof bodyParam !== 'undefined' && bodyParam !== null) {
829
751
  if (bodyParam.hasOwnProperty('$reserved') && bodyParam.$reserved.hasOwnProperty('ETag')) {
830
752
  var eTagReference = bodyParam.$reserved['ETag'];
831
-
832
753
  if (typeof eTagReference !== 'undefined' && eTagReference !== null && eTagReference !== "") {
833
754
  headerParams['If-Match'] = eTagReference;
834
755
  }
835
756
  }
836
757
  }
837
758
  }
759
+
838
760
  /*
839
761
  * Parses an ISO-8601 string representation of a date value.
840
762
  * @param {String} str The date value as a string.
841
763
  * @returns {Date} The parsed date object.
842
764
  */
843
-
844
765
  }, {
845
766
  key: "parseDate",
846
767
  value: function parseDate(str) {
847
768
  return new Date(str);
848
769
  }
770
+
849
771
  /*
850
772
  * Parses queryParams and path to find a given query param value
851
773
  * @param {String} path The path given to callApi method
@@ -854,31 +776,26 @@ var ApiClient = /*#__PURE__*/function () {
854
776
  * @param {String} defaultValue The default value for the missing param if not present
855
777
  * @returns {String} The value of given parameter
856
778
  */
857
-
858
779
  }, {
859
780
  key: "parseQueryParam",
860
781
  value: function parseQueryParam(path, queryParams, param, defaultValue) {
861
782
  var value = null;
862
-
863
783
  if (typeof queryParams !== 'undefined' && queryParams.hasOwnProperty(param)) {
864
784
  value = queryParams[param];
865
785
  }
866
-
867
786
  if (value === null && (typeof path === 'string' || path instanceof String)) {
868
787
  var escapedParam = param.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
869
788
  var regexResult = path.match(new RegExp("".concat(escapedParam, "=([0-9]+)")));
870
-
871
789
  if (regexResult) {
872
790
  value = regexResult[1];
873
791
  }
874
792
  }
875
-
876
793
  if (value === null) {
877
794
  value = defaultValue;
878
795
  }
879
-
880
796
  return value;
881
797
  }
798
+
882
799
  /**
883
800
  * Converts a value to the specified type.
884
801
  * @param {(String|Object)} data The data to convert, as a string or object.
@@ -888,31 +805,23 @@ var ApiClient = /*#__PURE__*/function () {
888
805
  * all properties on <code>data<code> will be converted to this type.
889
806
  * @returns An instance of the specified type or null or undefined if data is null or undefined.
890
807
  */
891
-
892
808
  }, {
893
809
  key: "convertToType",
894
810
  value: function convertToType(data, type) {
895
811
  if (data === null || data === undefined) return data;
896
-
897
812
  switch (type) {
898
813
  case 'Boolean':
899
814
  return Boolean(data);
900
-
901
815
  case 'Integer':
902
816
  return parseInt(data, 10);
903
-
904
817
  case 'Number':
905
818
  return parseFloat(data);
906
-
907
819
  case 'String':
908
820
  return String(data);
909
-
910
821
  case 'Date':
911
822
  return ApiClient.parseDate(String(data));
912
-
913
823
  case 'Blob':
914
824
  return data;
915
-
916
825
  default:
917
826
  if (type === Object) {
918
827
  // generic object, return directly
@@ -929,7 +838,6 @@ var ApiClient = /*#__PURE__*/function () {
929
838
  } else if (_typeof(type) === 'object') {
930
839
  // for plain object type like: {'String': 'Integer'}
931
840
  var keyType, valueType;
932
-
933
841
  for (var k in type) {
934
842
  if (type.hasOwnProperty(k)) {
935
843
  keyType = k;
@@ -937,9 +845,7 @@ var ApiClient = /*#__PURE__*/function () {
937
845
  break;
938
846
  }
939
847
  }
940
-
941
848
  var result = {};
942
-
943
849
  for (var k in data) {
944
850
  if (data.hasOwnProperty(k)) {
945
851
  var key = ApiClient.convertToType(k, keyType);
@@ -947,21 +853,19 @@ var ApiClient = /*#__PURE__*/function () {
947
853
  result[key] = value;
948
854
  }
949
855
  }
950
-
951
856
  return result;
952
857
  } else {
953
858
  // for unknown type, return the data directly
954
859
  return data;
955
860
  }
956
-
957
861
  }
958
862
  }
863
+
959
864
  /**
960
865
  * Constructs a new map or array model from REST data.
961
866
  * @param data {Object|Array} The REST data.
962
867
  * @param obj {Object|Array} The target object or array.
963
868
  */
964
-
965
869
  }, {
966
870
  key: "constructFromObject",
967
871
  value: function constructFromObject(data, obj, itemType) {
@@ -976,15 +880,392 @@ var ApiClient = /*#__PURE__*/function () {
976
880
  }
977
881
  }
978
882
  }]);
979
-
980
- return ApiClient;
981
883
  }();
982
884
  /**
983
885
  * The default API client implementation.
984
886
  * @type {ApiClient}
985
887
  * @memberOf ApiClient
986
888
  */
889
+ _ApiClient = ApiClient;
890
+ function _isJsonMime(contentType) {
891
+ return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
892
+ }
893
+ /*
894
+ * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
895
+ * @param {Array.<String>} contentTypes
896
+ * @returns {String} The chosen content type, preferring JSON.
897
+ */
898
+ function _jsonPreferredMime(contentTypes) {
899
+ for (var i = 0; i < contentTypes.length; i++) {
900
+ if (_assertClassBrand(_ApiClient_brand, this, _isJsonMime).call(this, contentTypes[i])) {
901
+ return contentTypes[i];
902
+ }
903
+ }
904
+ return contentTypes[0];
905
+ }
906
+ /*
907
+ * Checks whether the given parameter value represents file-like content.
908
+ * @param param The parameter to check.
909
+ * @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
910
+ */
911
+ function _isFileParam(param) {
912
+ // fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
913
+ if (typeof require === 'function') {
914
+ var _fs;
915
+ try {
916
+ _fs = require('fs');
917
+ } catch (err) {}
918
+ if (_fs && _fs.ReadStream && param instanceof _fs.ReadStream) {
919
+ return true;
920
+ }
921
+ }
922
+
923
+ // Buffer in Node.js
924
+ if (typeof Buffer === 'function' && param instanceof Buffer) {
925
+ return true;
926
+ }
927
+
928
+ // Blob in browser
929
+ if (typeof _buffer.Blob === 'function' && param instanceof _buffer.Blob) {
930
+ return true;
931
+ }
932
+
933
+ // File in browser (it seems File object is also instance of Blob, but keep this for safe)
934
+ if (typeof File === 'function' && param instanceof File) {
935
+ return true;
936
+ }
937
+ return false;
938
+ }
939
+ /*
940
+ * Normalizes parameter values:
941
+ * <ul>
942
+ * <li>remove nils</li>
943
+ * <li>keep files and arrays</li>
944
+ * <li>format to string with `paramToString` for other cases</li>
945
+ * </ul>
946
+ * @param {Object.<String, Object>} params The parameters as object properties.
947
+ * @returns {Object.<String, Object>} normalized parameters.
948
+ */
949
+ function _normalizeParams(params) {
950
+ var newParams = {};
951
+ for (var key in params) {
952
+ if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
953
+ var value = params[key];
954
+ if (_assertClassBrand(_ApiClient_brand, this, _isFileParam).call(this, value) || Array.isArray(value)) {
955
+ newParams[key] = value;
956
+ } else {
957
+ newParams[key] = this.paramToString(value);
958
+ }
959
+ }
960
+ }
961
+ return newParams;
962
+ }
963
+ function _applyAuthToRequest(request, authNames) {
964
+ var _this3 = this;
965
+ authNames.forEach(function (authName) {
966
+ var auth = _this3.authentications[authName];
967
+ switch (auth.type) {
968
+ case 'basic':
969
+ if (auth.username || auth.password) {
970
+ request.auth(auth.username || '', auth.password || '');
971
+ } else if (_this3.username || _this3.password) {
972
+ request.auth(_this3.username || '', _this3.password || '');
973
+ }
974
+ _assertClassBrand(_ApiClient_brand, _this3, _log).call(_this3, _classPrivateFieldGet(_LOG_LEVEL, _this3).DEBUG, null, "Basic Auth applied to request");
975
+ break;
976
+ case 'apiKey':
977
+ if (auth.apiKey) {
978
+ var data = {};
979
+ if (auth.apiKeyPrefix) {
980
+ data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
981
+ } else {
982
+ data[auth.name] = auth.apiKey;
983
+ }
984
+ if (auth['in'] === 'header') {
985
+ request.set(data);
986
+ } else {
987
+ request.query(data);
988
+ }
989
+ }
990
+ _assertClassBrand(_ApiClient_brand, _this3, _log).call(_this3, _classPrivateFieldGet(_LOG_LEVEL, _this3).DEBUG, null, "apiKey applied to request");
991
+ break;
992
+ case 'oauth2':
993
+ if (auth.accessToken) {
994
+ request.set({
995
+ 'Authorization': 'Bearer ' + auth.accessToken
996
+ });
997
+ }
998
+ _assertClassBrand(_ApiClient_brand, _this3, _log).call(_this3, _classPrivateFieldGet(_LOG_LEVEL, _this3).DEBUG, null, "oauth2 applied to request");
999
+ break;
1000
+ default:
1001
+ _assertClassBrand(_ApiClient_brand, _this3, _log).call(_this3, _classPrivateFieldGet(_LOG_LEVEL, _this3).ERROR, null, "Unknown authentication type:", auth.type);
1002
+ throw new Error('Unknown authentication type: ' + auth.type);
1003
+ }
1004
+ });
1005
+ }
1006
+ /**
1007
+ * Wraps errors in generic response format.
1008
+ * @param {Object} error object encountered during request.
1009
+ * @returns an error object with wrapped response within error.data .
1010
+ */
1011
+ function _wrapErrorInResponse(error) {
1012
+ var response = {
1013
+ data: {},
1014
+ metadata: {}
1015
+ };
1016
+ response.data.status = error.status;
1017
+ response.data.message = error.message;
1018
+ }
1019
+ /**
1020
+ * Deserializes an HTTP response body into a value of the specified type.
1021
+ * @param {Object} response A SuperAgent response object.
1022
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
1023
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
1024
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
1025
+ * all properties on <code>data<code> will be converted to this type.
1026
+ * @returns A value of the specified type.
1027
+ */
1028
+ function _deserialize(response, returnType) {
1029
+ if (response == null || returnType == null || response.status == 204) {
1030
+ return null;
1031
+ }
987
1032
 
1033
+ // Handle text response
1034
+ if (response.headers && ['text/event-stream', 'text/html', 'text/xml', 'text/csv', 'text/javascript', 'text/markdown', 'text/vcard'].includes(response.headers['content-type'])) {
1035
+ var data = new returnType();
1036
+ data.data = new _buffer.Blob([response.text], {
1037
+ type: response.headers['content-type']
1038
+ });
1039
+ var flag = new _Flag["default"]();
1040
+ flag.name = "hasError";
1041
+ flag.value = false;
1042
+ var flags = [flag];
1043
+ var metadata = new _ApiResponseMetadata["default"]();
1044
+ metadata.flags = flags;
1045
+ data.metadata = metadata;
1046
+ return data;
1047
+ }
988
1048
 
989
- exports.ApiClient = ApiClient;
1049
+ // Rely on SuperAgent for parsing response body.
1050
+ // See http://visionmedia.github.io/superagent/#parsing-response-bodies
1051
+ var data = response.body;
1052
+ if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
1053
+ // SuperAgent does not always produce a body; use the unparsed response as a fallback
1054
+ data = response.text;
1055
+ }
1056
+ return _ApiClient.convertToType(data, returnType);
1057
+ }
1058
+ /**
1059
+ * Set pagination data if response is a Paginable object
1060
+ * @param {Object} data The response data already passed through deserialize
1061
+ * @param {String} path The path given to callApi method
1062
+ * @param {Object.<String, Object>} queryParams The queryParams given to callApi method
1063
+ */
1064
+ function _paginateIfNeeded(data, path, queryParams) {
1065
+ // If response is not a Paginable instance, nothing to do
1066
+ if (!(data instanceof _Paginable["default"])) {
1067
+ return;
1068
+ }
1069
+ // Retrieve current page number, defaults to 0
1070
+ var page = parseInt(this.constructor.parseQueryParam(path, queryParams, '$page', "0"), 10);
1071
+ // Retrieve current limit (results per page) number, defaults to 50
1072
+ var resultsPerPage = parseInt(this.constructor.parseQueryParam(path, queryParams, '$limit', "50"), 10);
1073
+
1074
+ // Populate pagination data
1075
+ data.populatePaginationMetadata(this,
1076
+ // current ApiClient instance
1077
+ page, resultsPerPage);
1078
+ }
1079
+ function _getValidTimeout(timeout, defaultTimeout) {
1080
+ if (timeout <= 0) {
1081
+ timeout = defaultTimeout;
1082
+ } else if (timeout > _classPrivateFieldGet(_defaultMaxTimeout, this)) {
1083
+ timeout = _classPrivateFieldGet(_defaultMaxTimeout, this);
1084
+ }
1085
+ return timeout;
1086
+ }
1087
+ // If enabled, update cookie information to reuse in subsequent requests for a valid response
1088
+ function _updateCookies(response) {
1089
+ if (response.hasOwnProperty("headers") && response.headers.hasOwnProperty("set-cookie")) {
1090
+ var finalCookie = "";
1091
+ var cookieList = response.headers["set-cookie"];
1092
+ if (cookieList.length > 0) {
1093
+ // add all cookies separated by ;
1094
+ var _iterator2 = _createForOfIteratorHelper(cookieList),
1095
+ _step2;
1096
+ try {
1097
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1098
+ var cookieItem = _step2.value;
1099
+ cookieItem = cookieItem.split(";")[0];
1100
+ if (cookieItem.includes("=")) {
1101
+ cookieItem.trim();
1102
+ finalCookie = finalCookie.concat(cookieItem).concat(";");
1103
+ }
1104
+ }
1105
+ // remove trailing ;
1106
+ } catch (err) {
1107
+ _iterator2.e(err);
1108
+ } finally {
1109
+ _iterator2.f();
1110
+ }
1111
+ if (finalCookie !== "") {
1112
+ finalCookie = finalCookie.substr(0, finalCookie.length - 1);
1113
+ }
1114
+ }
1115
+ _classPrivateFieldSet(_cookie, this, finalCookie);
1116
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, null, "Retained cookie :", finalCookie);
1117
+ } else {
1118
+ _classPrivateFieldSet(_cookie, this, null);
1119
+ }
1120
+ }
1121
+ // If enabled, attach saved cookies to request
1122
+ function _attachCookies(request) {
1123
+ if (_classPrivateFieldGet(_cookie, this) != null) {
1124
+ request.set(_assertClassBrand(_ApiClient_brand, this, _normalizeParams).call(this, {
1125
+ 'Cookie': _classPrivateFieldGet(_cookie, this)
1126
+ }));
1127
+ }
1128
+ }
1129
+ function _log(level, mapper) {
1130
+ for (var _len = arguments.length, messages = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1131
+ messages[_key - 2] = arguments[_key];
1132
+ }
1133
+ // Set default log level to INFO
1134
+ if (_typeof(level) !== "object" || !("key" in level) || !("value" in level) || _typeof(level["value"]) !== "symbol") {
1135
+ level = _classPrivateFieldGet(_LOG_LEVEL, this).INFO;
1136
+ }
1137
+ if (!_assertClassBrand(_ApiClient_brand, this, _skipLogging).call(this, level)) {
1138
+ // Preprocess message to prefix with timestamp and log level
1139
+ messages = messages.map(function (message) {
1140
+ return typeof message === "string" ? message : mapper ? mapper(message) : JSON.stringify(message);
1141
+ });
1142
+ var message = messages.join(' ');
1143
+ message = _assertClassBrand(_ApiClient_brand, this, _getLocalDateTime).call(this) + ' ' + level.key + ' - ' + message;
1144
+ if (typeof _classPrivateFieldGet(_logger, this) !== "undefined" && _classPrivateFieldGet(_logger, this) !== null && typeof _classPrivateFieldGet(_logger, this).log === 'function') {
1145
+ _classPrivateFieldGet(_logger, this).log(message);
1146
+ } else {
1147
+ console.log(message);
1148
+ }
1149
+ }
1150
+ }
1151
+ function _skipLogging(level) {
1152
+ // Skip logging if log level is DEBUG but debug is not enabled.
1153
+ return !this.debug && level === _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG;
1154
+ }
1155
+ function _getLocalDateTime() {
1156
+ // Current epoch UTC time in milliseconds
1157
+ var epochTime = Date.now();
1158
+
1159
+ // "getTimezoneOffset" returns the difference, in minutes, between a date as evaluated in the UTC time zone,
1160
+ // and the same date as evaluated in the local time zone.
1161
+ // if you are in timezone UTC-1, outputs 60
1162
+ // if you are in timezone UTC+3, outputs -180
1163
+ var timezoneOffsetInMinutes = new Date().getTimezoneOffset();
1164
+ var timezoneOffsetInMilliseconds = timezoneOffsetInMinutes * 60 * 1000;
1165
+
1166
+ // Create a new date with adjusted epoch time based on timezone offset
1167
+ var date = new Date(epochTime - timezoneOffsetInMilliseconds);
1168
+ return date.toISOString().slice(0, 23);
1169
+ }
1170
+ // A mapper function to flatten a simple non-nested (key:value) object to string
1171
+ function _flatten(obj) {
1172
+ if (_typeof(obj) !== "object") {
1173
+ return obj;
1174
+ }
1175
+ var output = '\n';
1176
+ if (obj) {
1177
+ Object.keys(obj).forEach(function (e) {
1178
+ output += e + '=[' + obj[e] + ']\n';
1179
+ });
1180
+ }
1181
+ return output === '\n' ? obj : output;
1182
+ }
1183
+ // handle and deserialize received response
1184
+ function _handleApiResponseForPromise(response, path, queryParams, returnType, resolve, reject) {
1185
+ try {
1186
+ var data = _assertClassBrand(_ApiClient_brand, this, _deserialize).call(this, response, returnType);
1187
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).INFO, null, "Response Status :", response.status);
1188
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, _assertClassBrand(_ApiClient_brand, this, _flatten), "Response Headers :", response.headers);
1189
+ _assertClassBrand(_ApiClient_brand, this, _updateCookies).call(this, response || {});
1190
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, null, "Response Body :", data);
1191
+ if (response.status == 204 && data == null) {
1192
+ resolve({
1193
+ data: data,
1194
+ response: response
1195
+ });
1196
+ } else if (response.ok && data != null) {
1197
+ this.addEtagToReservedMap(response, data);
1198
+ _assertClassBrand(_ApiClient_brand, this, _paginateIfNeeded).call(this, data, path, queryParams);
1199
+ resolve({
1200
+ data: data,
1201
+ response: response
1202
+ });
1203
+ } else {
1204
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).ERROR, null, data);
1205
+ reject(_objectSpread(_objectSpread({}, response.error), {}, {
1206
+ data: data
1207
+ }));
1208
+ }
1209
+ } catch (err) {
1210
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).DEBUG, null, "Caught error while processing response!");
1211
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).ERROR, null, err);
1212
+ err.data = _assertClassBrand(_ApiClient_brand, this, _wrapErrorInResponse).call(this, err);
1213
+ reject(err);
1214
+ }
1215
+ }
1216
+ function _processDownloadedFile(response, stream, tempFilename, resolve, reject, returnType) {
1217
+ var _this4 = this;
1218
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).INFO, null, "Streaming response to : ", tempFilename);
1219
+ try {
1220
+ response.on('data', function (chunk) {
1221
+ stream.write(chunk);
1222
+ });
1223
+ } catch (err) {
1224
+ _assertClassBrand(_ApiClient_brand, this, _log).call(this, _classPrivateFieldGet(_LOG_LEVEL, this).ERROR, null, "Issue while downloading file", err);
1225
+ }
1226
+ var data = new returnType();
1227
+ // Fetch filename
1228
+ var filename = "";
1229
+ if (typeof response.headers['content-disposition'] !== 'undefined' && response.headers['content-disposition'] !== null) {
1230
+ var match = response.headers['content-disposition'].match(/*#__PURE__*/_wrapRegExp(/.*filename="(.*)".*/, {
1231
+ filename: 1
1232
+ }));
1233
+ var filepath = _path["default"].parse(match.groups['filename']);
1234
+ filename = this.downloadDestination + '/' + filepath.name + '_' + Date.now() + filepath.ext;
1235
+ data.data = {
1236
+ "path": _path["default"].parse(filename),
1237
+ $objectType: "Path"
1238
+ };
1239
+ var flag = new _Flag["default"]();
1240
+ flag.name = "hasError";
1241
+ flag.value = false;
1242
+ var flags = [flag];
1243
+ var metadata = new _ApiResponseMetadata["default"]();
1244
+ metadata.flags = flags;
1245
+ data.metadata = metadata;
1246
+ }
1247
+ response.on('end', function () {
1248
+ _assertClassBrand(_ApiClient_brand, _this4, _log).call(_this4, _classPrivateFieldGet(_LOG_LEVEL, _this4).INFO, null, "Finished streaming response");
1249
+ if (filename.length !== 0) {
1250
+ _assertClassBrand(_ApiClient_brand, _this4, _log).call(_this4, _classPrivateFieldGet(_LOG_LEVEL, _this4).INFO, null, "Content-Disposition header found [", filename, "] is final filename");
1251
+ stream.close();
1252
+ _fs2["default"].renameSync(tempFilename, filename);
1253
+ resolve({
1254
+ data: data,
1255
+ response: response
1256
+ });
1257
+ } else {
1258
+ _assertClassBrand(_ApiClient_brand, _this4, _log).call(_this4, _classPrivateFieldGet(_LOG_LEVEL, _this4).ERROR, null, "Content-Disposition header not found [", tempFilename, "] is final filename");
1259
+ resolve({
1260
+ data: data,
1261
+ response: response
1262
+ });
1263
+ }
1264
+ });
1265
+ response.on('error', function (err) {
1266
+ _assertClassBrand(_ApiClient_brand, _this4, _log).call(_this4, _classPrivateFieldGet(_LOG_LEVEL, _this4).ERROR, null, "Caught the following error :", err);
1267
+ error.data = _assertClassBrand(_ApiClient_brand, _this4, _wrapErrorInResponse).call(_this4, error);
1268
+ reject(err);
1269
+ });
1270
+ }
990
1271
  ApiClient.instance = new ApiClient();