@seamapi/nextlove-sdk-generator 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/LICENSE.txt +20 -0
  2. package/README.md +16 -0
  3. package/index.d.ts +6 -0
  4. package/index.js +7 -0
  5. package/index.js.map +1 -0
  6. package/lib/cli.d.ts +2 -0
  7. package/lib/cli.js +53 -0
  8. package/lib/cli.js.map +1 -0
  9. package/lib/fs-util/index.d.ts +2 -0
  10. package/lib/fs-util/index.js +3 -0
  11. package/lib/fs-util/index.js.map +1 -0
  12. package/lib/fs-util/populate-fs.d.ts +1 -0
  13. package/lib/fs-util/populate-fs.js +11 -0
  14. package/lib/fs-util/populate-fs.js.map +1 -0
  15. package/lib/fs-util/write-fs.d.ts +1 -0
  16. package/lib/fs-util/write-fs.js +10 -0
  17. package/lib/fs-util/write-fs.js.map +1 -0
  18. package/lib/generate-csharp-sdk/codegen.d.ts +235 -0
  19. package/lib/generate-csharp-sdk/codegen.js +432 -0
  20. package/lib/generate-csharp-sdk/codegen.js.map +1 -0
  21. package/lib/generate-csharp-sdk/constants.d.ts +1 -0
  22. package/lib/generate-csharp-sdk/constants.js +2 -0
  23. package/lib/generate-csharp-sdk/constants.js.map +1 -0
  24. package/lib/generate-csharp-sdk/generate-csharp-sdk.d.ts +1 -0
  25. package/lib/generate-csharp-sdk/generate-csharp-sdk.js +81 -0
  26. package/lib/generate-csharp-sdk/generate-csharp-sdk.js.map +1 -0
  27. package/lib/generate-csharp-sdk/generate-csproj.d.ts +1 -0
  28. package/lib/generate-csharp-sdk/generate-csproj.js +45 -0
  29. package/lib/generate-csharp-sdk/generate-csproj.js.map +1 -0
  30. package/lib/generate-csharp-sdk/templates/dataclass.d.ts +24 -0
  31. package/lib/generate-csharp-sdk/templates/dataclass.js +468 -0
  32. package/lib/generate-csharp-sdk/templates/dataclass.js.map +1 -0
  33. package/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
  34. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
  35. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
  36. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
  37. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
  38. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
  39. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
  40. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
  41. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
  42. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
  43. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
  44. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
  45. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
  46. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
  47. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
  48. package/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
  49. package/lib/generate-php-sdk/generate-php-sdk.d.ts +1 -0
  50. package/lib/generate-php-sdk/generate-php-sdk.js +127 -0
  51. package/lib/generate-php-sdk/generate-php-sdk.js.map +1 -0
  52. package/lib/generate-php-sdk/index.d.ts +1 -0
  53. package/lib/generate-php-sdk/index.js +2 -0
  54. package/lib/generate-php-sdk/index.js.map +1 -0
  55. package/lib/generate-php-sdk/templates/composer.json.template.d.ts +2 -0
  56. package/lib/generate-php-sdk/templates/composer.json.template.js +25 -0
  57. package/lib/generate-php-sdk/templates/composer.json.template.js.map +1 -0
  58. package/lib/generate-php-sdk/templates/env.example.template.d.ts +2 -0
  59. package/lib/generate-php-sdk/templates/env.example.template.js +4 -0
  60. package/lib/generate-php-sdk/templates/env.example.template.js.map +1 -0
  61. package/lib/generate-php-sdk/templates/gitignore.template.d.ts +2 -0
  62. package/lib/generate-php-sdk/templates/gitignore.template.js +6 -0
  63. package/lib/generate-php-sdk/templates/gitignore.template.js.map +1 -0
  64. package/lib/generate-php-sdk/templates/package.json.template.d.ts +2 -0
  65. package/lib/generate-php-sdk/templates/package.json.template.js +12 -0
  66. package/lib/generate-php-sdk/templates/package.json.template.js.map +1 -0
  67. package/lib/generate-php-sdk/templates/readme.md.template.d.ts +2 -0
  68. package/lib/generate-php-sdk/templates/readme.md.template.js +86 -0
  69. package/lib/generate-php-sdk/templates/readme.md.template.js.map +1 -0
  70. package/lib/generate-php-sdk/templates/smoke-test.template.d.ts +2 -0
  71. package/lib/generate-php-sdk/templates/smoke-test.template.js +30 -0
  72. package/lib/generate-php-sdk/templates/smoke-test.template.js.map +1 -0
  73. package/lib/generate-php-sdk/templates/test-fixture.template.d.ts +2 -0
  74. package/lib/generate-php-sdk/templates/test-fixture.template.js +21 -0
  75. package/lib/generate-php-sdk/templates/test-fixture.template.js.map +1 -0
  76. package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.d.ts +16 -0
  77. package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js +97 -0
  78. package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js.map +1 -0
  79. package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.d.ts +2 -0
  80. package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js +95 -0
  81. package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js.map +1 -0
  82. package/lib/generate-php-sdk/utils/generate-resource-object-class.d.ts +8 -0
  83. package/lib/generate-php-sdk/utils/generate-resource-object-class.js +73 -0
  84. package/lib/generate-php-sdk/utils/generate-resource-object-class.js.map +1 -0
  85. package/lib/generate-php-sdk/utils/generate-seam-client.d.ts +7 -0
  86. package/lib/generate-php-sdk/utils/generate-seam-client.js +103 -0
  87. package/lib/generate-php-sdk/utils/generate-seam-client.js.map +1 -0
  88. package/lib/generate-php-sdk/utils/get-php-type.d.ts +1 -0
  89. package/lib/generate-php-sdk/utils/get-php-type.js +17 -0
  90. package/lib/generate-php-sdk/utils/get-php-type.js.map +1 -0
  91. package/lib/generate-php-sdk/utils/php-client.d.ts +31 -0
  92. package/lib/generate-php-sdk/utils/php-client.js +130 -0
  93. package/lib/generate-php-sdk/utils/php-client.js.map +1 -0
  94. package/lib/generate-python-sdk/class-file.d.ts +20 -0
  95. package/lib/generate-python-sdk/class-file.js +75 -0
  96. package/lib/generate-python-sdk/class-file.js.map +1 -0
  97. package/lib/generate-python-sdk/generate-python-sdk.d.ts +1 -0
  98. package/lib/generate-python-sdk/generate-python-sdk.js +117 -0
  99. package/lib/generate-python-sdk/generate-python-sdk.js.map +1 -0
  100. package/lib/generate-python-sdk/index.d.ts +1 -0
  101. package/lib/generate-python-sdk/index.js +2 -0
  102. package/lib/generate-python-sdk/index.js.map +1 -0
  103. package/lib/generate-python-sdk/map-python-type.d.ts +2 -0
  104. package/lib/generate-python-sdk/map-python-type.js +26 -0
  105. package/lib/generate-python-sdk/map-python-type.js.map +1 -0
  106. package/lib/generate-python-sdk/templates/conftest.py.template.d.ts +2 -0
  107. package/lib/generate-python-sdk/templates/conftest.py.template.js +12 -0
  108. package/lib/generate-python-sdk/templates/conftest.py.template.js.map +1 -0
  109. package/lib/generate-python-sdk/templates/pyproject.toml.template.d.ts +2 -0
  110. package/lib/generate-python-sdk/templates/pyproject.toml.template.js +21 -0
  111. package/lib/generate-python-sdk/templates/pyproject.toml.template.js.map +1 -0
  112. package/lib/generate-python-sdk/templates/readme.md.template.d.ts +2 -0
  113. package/lib/generate-python-sdk/templates/readme.md.template.js +48 -0
  114. package/lib/generate-python-sdk/templates/readme.md.template.js.map +1 -0
  115. package/lib/generate-python-sdk/templates/routes.py.template.d.ts +2 -0
  116. package/lib/generate-python-sdk/templates/routes.py.template.js +13 -0
  117. package/lib/generate-python-sdk/templates/routes.py.template.js.map +1 -0
  118. package/lib/generate-python-sdk/templates/seam.py.template.d.ts +2 -0
  119. package/lib/generate-python-sdk/templates/seam.py.template.js +74 -0
  120. package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -0
  121. package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.d.ts +2 -0
  122. package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js +9 -0
  123. package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js.map +1 -0
  124. package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.d.ts +2 -0
  125. package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +9 -0
  126. package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -0
  127. package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.d.ts +5 -0
  128. package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js +10 -0
  129. package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js.map +1 -0
  130. package/lib/generate-python-sdk/templates/test_smoke.py.template.d.ts +2 -0
  131. package/lib/generate-python-sdk/templates/test_smoke.py.template.js +13 -0
  132. package/lib/generate-python-sdk/templates/test_smoke.py.template.js.map +1 -0
  133. package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.d.ts +2 -0
  134. package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js +28 -0
  135. package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js.map +1 -0
  136. package/lib/generate-ruby-sdk/generate-ruby-sdk.d.ts +1 -0
  137. package/lib/generate-ruby-sdk/generate-ruby-sdk.js +132 -0
  138. package/lib/generate-ruby-sdk/generate-ruby-sdk.js.map +1 -0
  139. package/lib/generate-ruby-sdk/index.d.ts +1 -0
  140. package/lib/generate-ruby-sdk/index.js +2 -0
  141. package/lib/generate-ruby-sdk/index.js.map +1 -0
  142. package/lib/generate-ruby-sdk/request.rb.template.d.ts +1 -0
  143. package/lib/generate-ruby-sdk/request.rb.template.js +2 -0
  144. package/lib/generate-ruby-sdk/request.rb.template.js.map +1 -0
  145. package/lib/generate-ruby-sdk/ruby-client.d.ts +35 -0
  146. package/lib/generate-ruby-sdk/ruby-client.js +59 -0
  147. package/lib/generate-ruby-sdk/ruby-client.js.map +1 -0
  148. package/lib/generate-ruby-sdk/templates/base_client.rb.template.d.ts +2 -0
  149. package/lib/generate-ruby-sdk/templates/base_client.rb.template.js +22 -0
  150. package/lib/generate-ruby-sdk/templates/base_client.rb.template.js.map +1 -0
  151. package/lib/generate-ruby-sdk/templates/base_resource.rb.template.d.ts +2 -0
  152. package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js +59 -0
  153. package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js.map +1 -0
  154. package/lib/generate-ruby-sdk/templates/client.rb.template.d.ts +2 -0
  155. package/lib/generate-ruby-sdk/templates/client.rb.template.js +74 -0
  156. package/lib/generate-ruby-sdk/templates/client.rb.template.js.map +1 -0
  157. package/lib/generate-ruby-sdk/templates/gemfile.template.d.ts +2 -0
  158. package/lib/generate-ruby-sdk/templates/gemfile.template.js +7 -0
  159. package/lib/generate-ruby-sdk/templates/gemfile.template.js.map +1 -0
  160. package/lib/generate-ruby-sdk/templates/logger.rb.template.d.ts +2 -0
  161. package/lib/generate-ruby-sdk/templates/logger.rb.template.js +13 -0
  162. package/lib/generate-ruby-sdk/templates/logger.rb.template.js.map +1 -0
  163. package/lib/generate-ruby-sdk/templates/rakefile.template.d.ts +2 -0
  164. package/lib/generate-ruby-sdk/templates/rakefile.template.js +23 -0
  165. package/lib/generate-ruby-sdk/templates/rakefile.template.js.map +1 -0
  166. package/lib/generate-ruby-sdk/templates/readme.md.template.d.ts +2 -0
  167. package/lib/generate-ruby-sdk/templates/readme.md.template.js +184 -0
  168. package/lib/generate-ruby-sdk/templates/readme.md.template.js.map +1 -0
  169. package/lib/generate-ruby-sdk/templates/request.rb.template.d.ts +2 -0
  170. package/lib/generate-ruby-sdk/templates/request.rb.template.js +71 -0
  171. package/lib/generate-ruby-sdk/templates/request.rb.template.js.map +1 -0
  172. package/lib/generate-ruby-sdk/templates/resource_error.rb.template.d.ts +2 -0
  173. package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js +8 -0
  174. package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js.map +1 -0
  175. package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.d.ts +2 -0
  176. package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js +10 -0
  177. package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js.map +1 -0
  178. package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.d.ts +2 -0
  179. package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js +8 -0
  180. package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js.map +1 -0
  181. package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.d.ts +2 -0
  182. package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js +10 -0
  183. package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js.map +1 -0
  184. package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.d.ts +2 -0
  185. package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js +41 -0
  186. package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js.map +1 -0
  187. package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.d.ts +6 -0
  188. package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js +15 -0
  189. package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js.map +1 -0
  190. package/lib/generate-ruby-sdk/templates/version.rb.template.d.ts +2 -0
  191. package/lib/generate-ruby-sdk/templates/version.rb.template.js +6 -0
  192. package/lib/generate-ruby-sdk/templates/version.rb.template.js.map +1 -0
  193. package/lib/index.d.ts +2 -0
  194. package/lib/index.js +3 -0
  195. package/lib/index.js.map +1 -0
  196. package/lib/openapi/flatten-obj-schema.d.ts +5 -0
  197. package/lib/openapi/flatten-obj-schema.js +86 -0
  198. package/lib/openapi/flatten-obj-schema.js.map +1 -0
  199. package/lib/openapi/get-parameter-and-response-schema.d.ts +20 -0
  200. package/lib/openapi/get-parameter-and-response-schema.js +42 -0
  201. package/lib/openapi/get-parameter-and-response-schema.js.map +1 -0
  202. package/lib/openapi/index.d.ts +2 -0
  203. package/lib/openapi/index.js +3 -0
  204. package/lib/openapi/index.js.map +1 -0
  205. package/lib/types.d.ts +91 -0
  206. package/lib/types.js +2 -0
  207. package/lib/types.js.map +1 -0
  208. package/package.json +95 -0
  209. package/src/index.ts +6 -0
  210. package/src/lib/cli.ts +71 -0
  211. package/src/lib/fs-util/index.ts +2 -0
  212. package/src/lib/fs-util/populate-fs.ts +14 -0
  213. package/src/lib/fs-util/write-fs.ts +10 -0
  214. package/src/lib/generate-csharp-sdk/codegen.ts +648 -0
  215. package/src/lib/generate-csharp-sdk/constants.ts +1 -0
  216. package/src/lib/generate-csharp-sdk/generate-csharp-sdk.ts +126 -0
  217. package/src/lib/generate-csharp-sdk/generate-csproj.ts +45 -0
  218. package/src/lib/generate-csharp-sdk/templates/dataclass.ts +973 -0
  219. package/src/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
  220. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
  221. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
  222. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
  223. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
  224. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
  225. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
  226. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
  227. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
  228. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
  229. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
  230. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
  231. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
  232. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
  233. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
  234. package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
  235. package/src/lib/generate-php-sdk/generate-php-sdk.ts +176 -0
  236. package/src/lib/generate-php-sdk/index.ts +1 -0
  237. package/src/lib/generate-php-sdk/templates/composer.json.template.ts +24 -0
  238. package/src/lib/generate-php-sdk/templates/env.example.template.ts +3 -0
  239. package/src/lib/generate-php-sdk/templates/gitignore.template.ts +5 -0
  240. package/src/lib/generate-php-sdk/templates/package.json.template.ts +11 -0
  241. package/src/lib/generate-php-sdk/templates/readme.md.template.ts +85 -0
  242. package/src/lib/generate-php-sdk/templates/smoke-test.template.ts +29 -0
  243. package/src/lib/generate-php-sdk/templates/test-fixture.template.ts +20 -0
  244. package/src/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.ts +160 -0
  245. package/src/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.ts +128 -0
  246. package/src/lib/generate-php-sdk/utils/generate-resource-object-class.ts +105 -0
  247. package/src/lib/generate-php-sdk/utils/generate-seam-client.ts +115 -0
  248. package/src/lib/generate-php-sdk/utils/get-php-type.ts +21 -0
  249. package/src/lib/generate-php-sdk/utils/php-client.ts +189 -0
  250. package/src/lib/generate-python-sdk/class-file.ts +114 -0
  251. package/src/lib/generate-python-sdk/generate-python-sdk.ts +147 -0
  252. package/src/lib/generate-python-sdk/index.ts +1 -0
  253. package/src/lib/generate-python-sdk/map-python-type.ts +29 -0
  254. package/src/lib/generate-python-sdk/templates/conftest.py.template.ts +11 -0
  255. package/src/lib/generate-python-sdk/templates/pyproject.toml.template.ts +20 -0
  256. package/src/lib/generate-python-sdk/templates/readme.md.template.ts +47 -0
  257. package/src/lib/generate-python-sdk/templates/routes.py.template.ts +13 -0
  258. package/src/lib/generate-python-sdk/templates/seam.py.template.ts +73 -0
  259. package/src/lib/generate-python-sdk/templates/snippets/abstract-routes.template.ts +9 -0
  260. package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +8 -0
  261. package/src/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.ts +15 -0
  262. package/src/lib/generate-python-sdk/templates/test_smoke.py.template.ts +12 -0
  263. package/src/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.ts +27 -0
  264. package/src/lib/generate-ruby-sdk/generate-ruby-sdk.ts +153 -0
  265. package/src/lib/generate-ruby-sdk/index.ts +1 -0
  266. package/src/lib/generate-ruby-sdk/request.rb.template.ts +0 -0
  267. package/src/lib/generate-ruby-sdk/ruby-client.ts +81 -0
  268. package/src/lib/generate-ruby-sdk/templates/base_client.rb.template.ts +21 -0
  269. package/src/lib/generate-ruby-sdk/templates/base_resource.rb.template.ts +58 -0
  270. package/src/lib/generate-ruby-sdk/templates/client.rb.template.ts +73 -0
  271. package/src/lib/generate-ruby-sdk/templates/gemfile.template.ts +6 -0
  272. package/src/lib/generate-ruby-sdk/templates/logger.rb.template.ts +12 -0
  273. package/src/lib/generate-ruby-sdk/templates/rakefile.template.ts +22 -0
  274. package/src/lib/generate-ruby-sdk/templates/readme.md.template.ts +183 -0
  275. package/src/lib/generate-ruby-sdk/templates/request.rb.template.ts +70 -0
  276. package/src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts +7 -0
  277. package/src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts +9 -0
  278. package/src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts +7 -0
  279. package/src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts +9 -0
  280. package/src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts +40 -0
  281. package/src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts +24 -0
  282. package/src/lib/generate-ruby-sdk/templates/version.rb.template.ts +5 -0
  283. package/src/lib/index.ts +2 -0
  284. package/src/lib/openapi/flatten-obj-schema.ts +124 -0
  285. package/src/lib/openapi/get-parameter-and-response-schema.ts +59 -0
  286. package/src/lib/openapi/index.ts +2 -0
  287. package/src/lib/types.ts +96 -0
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Seam Connect
3
+ *
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ * Generated by: https://github.com/openapitools/openapi-generator.git
8
+ */
9
+
10
+
11
+ using System;
12
+ using System.Threading.Tasks;
13
+
14
+ namespace Seam.Client
15
+ {
16
+ /// <summary>
17
+ /// Contract for Asynchronous RESTful API interactions.
18
+ ///
19
+ /// This interface allows consumers to provide a custom API accessor client.
20
+ /// </summary>
21
+ public interface IAsynchronousSeam
22
+ {
23
+ /// <summary>
24
+ /// Executes a non-blocking call to some <paramref name="path"/> using the GET http verb.
25
+ /// </summary>
26
+ /// <param name="path">The relative path to invoke.</param>
27
+ /// <param name="options">The request parameters to pass along to the client.</param>
28
+ /// <param name="configuration">Per-request configurable settings.</param>
29
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
30
+ /// <typeparam name="T">The return type.</typeparam>
31
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
32
+ Task<ApiResponse<T>> GetAsync<T>(
33
+ string path,
34
+ RequestOptions options,
35
+ IReadableSeamRequestConfiguration configuration = null,
36
+ System.Threading.CancellationToken cancellationToken =
37
+ default(System.Threading.CancellationToken)
38
+ );
39
+
40
+ /// <summary>
41
+ /// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
42
+ /// </summary>
43
+ /// <param name="path">The relative path to invoke.</param>
44
+ /// <param name="options">The request parameters to pass along to the client.</param>
45
+ /// <param name="configuration">Per-request configurable settings.</param>
46
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
47
+ /// <typeparam name="T">The return type.</typeparam>
48
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
49
+ Task<ApiResponse<T>> PostAsync<T>(
50
+ string path,
51
+ RequestOptions options,
52
+ IReadableSeamRequestConfiguration configuration = null,
53
+ System.Threading.CancellationToken cancellationToken =
54
+ default(System.Threading.CancellationToken)
55
+ );
56
+
57
+ /// <summary>
58
+ /// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
59
+ /// </summary>
60
+ /// <param name="path">The relative path to invoke.</param>
61
+ /// <param name="options">The request parameters to pass along to the client.</param>
62
+ /// <param name="configuration">Per-request configurable settings.</param>
63
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
64
+ /// <typeparam name="T">The return type.</typeparam>
65
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
66
+ Task<ApiResponse<T>> PutAsync<T>(
67
+ string path,
68
+ RequestOptions options,
69
+ IReadableSeamRequestConfiguration configuration = null,
70
+ System.Threading.CancellationToken cancellationToken =
71
+ default(System.Threading.CancellationToken)
72
+ );
73
+
74
+ /// <summary>
75
+ /// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
76
+ /// </summary>
77
+ /// <param name="path">The relative path to invoke.</param>
78
+ /// <param name="options">The request parameters to pass along to the client.</param>
79
+ /// <param name="configuration">Per-request configurable settings.</param>
80
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
81
+ /// <typeparam name="T">The return type.</typeparam>
82
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
83
+ Task<ApiResponse<T>> DeleteAsync<T>(
84
+ string path,
85
+ RequestOptions options,
86
+ IReadableSeamRequestConfiguration configuration = null,
87
+ System.Threading.CancellationToken cancellationToken =
88
+ default(System.Threading.CancellationToken)
89
+ );
90
+
91
+ /// <summary>
92
+ /// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
93
+ /// </summary>
94
+ /// <param name="path">The relative path to invoke.</param>
95
+ /// <param name="options">The request parameters to pass along to the client.</param>
96
+ /// <param name="configuration">Per-request configurable settings.</param>
97
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
98
+ /// <typeparam name="T">The return type.</typeparam>
99
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
100
+ Task<ApiResponse<T>> HeadAsync<T>(
101
+ string path,
102
+ RequestOptions options,
103
+ IReadableSeamRequestConfiguration configuration = null,
104
+ System.Threading.CancellationToken cancellationToken =
105
+ default(System.Threading.CancellationToken)
106
+ );
107
+
108
+ /// <summary>
109
+ /// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
110
+ /// </summary>
111
+ /// <param name="path">The relative path to invoke.</param>
112
+ /// <param name="options">The request parameters to pass along to the client.</param>
113
+ /// <param name="configuration">Per-request configurable settings.</param>
114
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
115
+ /// <typeparam name="T">The return type.</typeparam>
116
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
117
+ Task<ApiResponse<T>> OptionsAsync<T>(
118
+ string path,
119
+ RequestOptions options,
120
+ IReadableSeamRequestConfiguration configuration = null,
121
+ System.Threading.CancellationToken cancellationToken =
122
+ default(System.Threading.CancellationToken)
123
+ );
124
+
125
+ /// <summary>
126
+ /// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
127
+ /// </summary>
128
+ /// <param name="path">The relative path to invoke.</param>
129
+ /// <param name="options">The request parameters to pass along to the client.</param>
130
+ /// <param name="configuration">Per-request configurable settings.</param>
131
+ /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
132
+ /// <typeparam name="T">The return type.</typeparam>
133
+ /// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
134
+ Task<ApiResponse<T>> PatchAsync<T>(
135
+ string path,
136
+ RequestOptions options,
137
+ IReadableSeamRequestConfiguration configuration = null,
138
+ System.Threading.CancellationToken cancellationToken =
139
+ default(System.Threading.CancellationToken)
140
+ );
141
+ }
142
+ }
@@ -0,0 +1,68 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Net;
4
+ using System.Net.Security;
5
+ using System.Security.Cryptography.X509Certificates;
6
+
7
+ namespace Seam.Client
8
+ {
9
+ /// <summary>
10
+ /// Represents a readable-only configuration contract.
11
+ /// </summary>
12
+ public interface IReadableSeamRequestConfiguration
13
+ {
14
+ /// <summary>
15
+ /// Gets the base path.
16
+ /// </summary>
17
+ /// <value>Base path.</value>
18
+ string BasePath { get; }
19
+
20
+ /// <summary>
21
+ /// Gets the date time format.
22
+ /// </summary>
23
+ /// <value>Date time format.</value>
24
+ string DateTimeFormat { get; }
25
+
26
+ /// <summary>
27
+ /// Gets the default headers.
28
+ /// </summary>
29
+ /// <value>Default headers.</value>
30
+ IDictionary<string, string> DefaultHeaders { get; }
31
+
32
+ /// <summary>
33
+ /// Gets the temp folder path.
34
+ /// </summary>
35
+ /// <value>Temp folder path.</value>
36
+ string TempFolderPath { get; }
37
+
38
+ /// <summary>
39
+ /// Gets the HTTP connection timeout (in milliseconds)
40
+ /// </summary>
41
+ /// <value>HTTP connection timeout.</value>
42
+ int Timeout { get; }
43
+
44
+ /// <summary>
45
+ /// Gets the proxy.
46
+ /// </summary>
47
+ /// <value>Proxy.</value>
48
+ WebProxy Proxy { get; }
49
+
50
+ /// <summary>
51
+ /// Gets the user agent.
52
+ /// </summary>
53
+ /// <value>User agent.</value>
54
+ string UserAgent { get; }
55
+
56
+ /// <summary>
57
+ /// Gets certificate collection to be sent with requests.
58
+ /// </summary>
59
+ /// <value>X509 Certificate collection.</value>
60
+ X509CertificateCollection ClientCertificates { get; }
61
+
62
+ /// <summary>
63
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
64
+ /// overriding certificate errors in the scope of a request.
65
+ /// </summary>
66
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
67
+ }
68
+ }
@@ -0,0 +1,103 @@
1
+ namespace Seam.Client
2
+ {
3
+ public interface ISynchronousSeam
4
+ {
5
+ /// <summary>
6
+ /// Executes a blocking call to some <paramref name="path"/> using the GET http verb.
7
+ /// </summary>
8
+ /// <param name="path">The relative path to invoke.</param>
9
+ /// <param name="options">The request parameters to pass along to the client.</param>
10
+ /// <param name="configuration">Per-request configurable settings.</param>
11
+ /// <typeparam name="T">The return type.</typeparam>
12
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
13
+ ApiResponse<T> Get<T>(
14
+ string path,
15
+ RequestOptions options,
16
+ IReadableSeamRequestConfiguration configuration = null
17
+ );
18
+
19
+ /// <summary>
20
+ /// Executes a blocking call to some <paramref name="path"/> using the POST http verb.
21
+ /// </summary>
22
+ /// <param name="path">The relative path to invoke.</param>
23
+ /// <param name="options">The request parameters to pass along to the client.</param>
24
+ /// <param name="configuration">Per-request configurable settings.</param>
25
+ /// <typeparam name="T">The return type.</typeparam>
26
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
27
+ ApiResponse<T> Post<T>(
28
+ string path,
29
+ RequestOptions options,
30
+ IReadableSeamRequestConfiguration configuration = null
31
+ );
32
+
33
+ /// <summary>
34
+ /// Executes a blocking call to some <paramref name="path"/> using the PUT http verb.
35
+ /// </summary>
36
+ /// <param name="path">The relative path to invoke.</param>
37
+ /// <param name="options">The request parameters to pass along to the client.</param>
38
+ /// <param name="configuration">Per-request configurable settings.</param>
39
+ /// <typeparam name="T">The return type.</typeparam>
40
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
41
+ ApiResponse<T> Put<T>(
42
+ string path,
43
+ RequestOptions options,
44
+ IReadableSeamRequestConfiguration configuration = null
45
+ );
46
+
47
+ /// <summary>
48
+ /// Executes a blocking call to some <paramref name="path"/> using the DELETE http verb.
49
+ /// </summary>
50
+ /// <param name="path">The relative path to invoke.</param>
51
+ /// <param name="options">The request parameters to pass along to the client.</param>
52
+ /// <param name="configuration">Per-request configurable settings.</param>
53
+ /// <typeparam name="T">The return type.</typeparam>
54
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
55
+ ApiResponse<T> Delete<T>(
56
+ string path,
57
+ RequestOptions options,
58
+ IReadableSeamRequestConfiguration configuration = null
59
+ );
60
+
61
+ /// <summary>
62
+ /// Executes a blocking call to some <paramref name="path"/> using the HEAD http verb.
63
+ /// </summary>
64
+ /// <param name="path">The relative path to invoke.</param>
65
+ /// <param name="options">The request parameters to pass along to the client.</param>
66
+ /// <param name="configuration">Per-request configurable settings.</param>
67
+ /// <typeparam name="T">The return type.</typeparam>
68
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
69
+ ApiResponse<T> Head<T>(
70
+ string path,
71
+ RequestOptions options,
72
+ IReadableSeamRequestConfiguration configuration = null
73
+ );
74
+
75
+ /// <summary>
76
+ /// Executes a blocking call to some <paramref name="path"/> using the OPTIONS http verb.
77
+ /// </summary>
78
+ /// <param name="path">The relative path to invoke.</param>
79
+ /// <param name="options">The request parameters to pass along to the client.</param>
80
+ /// <param name="configuration">Per-request configurable settings.</param>
81
+ /// <typeparam name="T">The return type.</typeparam>
82
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
83
+ ApiResponse<T> Options<T>(
84
+ string path,
85
+ RequestOptions options,
86
+ IReadableSeamRequestConfiguration configuration = null
87
+ );
88
+
89
+ /// <summary>
90
+ /// Executes a blocking call to some <paramref name="path"/> using the PATCH http verb.
91
+ /// </summary>
92
+ /// <param name="path">The relative path to invoke.</param>
93
+ /// <param name="options">The request parameters to pass along to the client.</param>
94
+ /// <param name="configuration">Per-request configurable settings.</param>
95
+ /// <typeparam name="T">The return type.</typeparam>
96
+ /// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
97
+ ApiResponse<T> Patch<T>(
98
+ string path,
99
+ RequestOptions options,
100
+ IReadableSeamRequestConfiguration configuration = null
101
+ );
102
+ }
103
+ }
@@ -0,0 +1,286 @@
1
+ using System;
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+
5
+ namespace Seam.Client
6
+ {
7
+ /// <summary>
8
+ /// A dictionary in which one key has many associated values.
9
+ /// </summary>
10
+ /// <typeparam name="TKey">The type of the key</typeparam>
11
+ /// <typeparam name="TValue">The type of the value associated with the key.</typeparam>
12
+ public class Multimap<TKey, TValue> : IDictionary<TKey, IList<TValue>>
13
+ {
14
+ #region Private Fields
15
+
16
+ private readonly Dictionary<TKey, IList<TValue>> _dictionary;
17
+
18
+ #endregion Private Fields
19
+
20
+ #region Constructors
21
+
22
+ /// <summary>
23
+ /// Empty Constructor.
24
+ /// </summary>
25
+ public Multimap()
26
+ {
27
+ _dictionary = new Dictionary<TKey, IList<TValue>>();
28
+ }
29
+
30
+ /// <summary>
31
+ /// Constructor with comparer.
32
+ /// </summary>
33
+ /// <param name="comparer"></param>
34
+ public Multimap(IEqualityComparer<TKey> comparer)
35
+ {
36
+ _dictionary = new Dictionary<TKey, IList<TValue>>(comparer);
37
+ }
38
+
39
+ #endregion Constructors
40
+
41
+ #region Enumerators
42
+
43
+ /// <summary>
44
+ /// To get the enumerator.
45
+ /// </summary>
46
+ /// <returns>Enumerator</returns>
47
+ public IEnumerator<KeyValuePair<TKey, IList<TValue>>> GetEnumerator()
48
+ {
49
+ return _dictionary.GetEnumerator();
50
+ }
51
+
52
+ /// <summary>
53
+ /// To get the enumerator.
54
+ /// </summary>
55
+ /// <returns>Enumerator</returns>
56
+ IEnumerator IEnumerable.GetEnumerator()
57
+ {
58
+ return _dictionary.GetEnumerator();
59
+ }
60
+
61
+ #endregion Enumerators
62
+
63
+ #region Public Members
64
+ /// <summary>
65
+ /// Add values to Multimap
66
+ /// </summary>
67
+ /// <param name="item">Key value pair</param>
68
+ public void Add(KeyValuePair<TKey, IList<TValue>> item)
69
+ {
70
+ if (!TryAdd(item.Key, item.Value))
71
+ throw new InvalidOperationException("Could not add values to Multimap.");
72
+ }
73
+
74
+ /// <summary>
75
+ /// Add Multimap to Multimap
76
+ /// </summary>
77
+ /// <param name="multimap">Multimap</param>
78
+ public void Add(Multimap<TKey, TValue> multimap)
79
+ {
80
+ foreach (var item in multimap)
81
+ {
82
+ if (!TryAdd(item.Key, item.Value))
83
+ throw new InvalidOperationException("Could not add values to Multimap.");
84
+ }
85
+ }
86
+
87
+ /// <summary>
88
+ /// Clear Multimap
89
+ /// </summary>
90
+ public void Clear()
91
+ {
92
+ _dictionary.Clear();
93
+ }
94
+
95
+ /// <summary>
96
+ /// Determines whether Multimap contains the specified item.
97
+ /// </summary>
98
+ /// <param name="item">Key value pair</param>
99
+ /// <exception cref="NotImplementedException">Method needs to be implemented</exception>
100
+ /// <returns>true if the Multimap contains the item; otherwise, false.</returns>
101
+ public bool Contains(KeyValuePair<TKey, IList<TValue>> item)
102
+ {
103
+ throw new NotImplementedException();
104
+ }
105
+
106
+ /// <summary>
107
+ /// Copy items of the Multimap to an array,
108
+ /// starting at a particular array index.
109
+ /// </summary>
110
+ /// <param name="array">The array that is the destination of the items copied
111
+ /// from Multimap. The array must have zero-based indexing.</param>
112
+ /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
113
+ /// <exception cref="NotImplementedException">Method needs to be implemented</exception>
114
+ public void CopyTo(KeyValuePair<TKey, IList<TValue>>[] array, int arrayIndex)
115
+ {
116
+ throw new NotImplementedException();
117
+ }
118
+
119
+ /// <summary>
120
+ /// Removes the specified item from the Multimap.
121
+ /// </summary>
122
+ /// <param name="item">Key value pair</param>
123
+ /// <returns>true if the item is successfully removed; otherwise, false.</returns>
124
+ /// <exception cref="NotImplementedException">Method needs to be implemented</exception>
125
+ public bool Remove(KeyValuePair<TKey, IList<TValue>> item)
126
+ {
127
+ throw new NotImplementedException();
128
+ }
129
+
130
+ /// <summary>
131
+ /// Gets the number of items contained in the Multimap.
132
+ /// </summary>
133
+ public int Count => _dictionary.Count;
134
+
135
+ /// <summary>
136
+ /// Gets a value indicating whether the Multimap is read-only.
137
+ /// </summary>
138
+ public bool IsReadOnly => false;
139
+
140
+ /// <summary>
141
+ /// Adds an item with the provided key and value to the Multimap.
142
+ /// </summary>
143
+ /// <param name="key">The object to use as the key of the item to add.</param>
144
+ /// <param name="value">The object to use as the value of the item to add.</param>
145
+ /// <exception cref="InvalidOperationException">Thrown when couldn't add the value to Multimap.</exception>
146
+ public void Add(TKey key, IList<TValue> value)
147
+ {
148
+ if (value != null && value.Count > 0)
149
+ {
150
+ if (_dictionary.TryGetValue(key, out var list))
151
+ {
152
+ foreach (var k in value)
153
+ list.Add(k);
154
+ }
155
+ else
156
+ {
157
+ list = new List<TValue>(value);
158
+ if (!TryAdd(key, list))
159
+ throw new InvalidOperationException("Could not add values to Multimap.");
160
+ }
161
+ }
162
+ }
163
+
164
+ /// <summary>
165
+ /// Determines whether the Multimap contains an item with the specified key.
166
+ /// </summary>
167
+ /// <param name="key">The key to locate in the Multimap.</param>
168
+ /// <returns>true if the Multimap contains an item with
169
+ /// the key; otherwise, false.</returns>
170
+ public bool ContainsKey(TKey key)
171
+ {
172
+ return _dictionary.ContainsKey(key);
173
+ }
174
+
175
+ /// <summary>
176
+ /// Removes item with the specified key from the Multimap.
177
+ /// </summary>
178
+ /// <param name="key">The key to locate in the Multimap.</param>
179
+ /// <returns>true if the item is successfully removed; otherwise, false.</returns>
180
+ public bool Remove(TKey key)
181
+ {
182
+ return TryRemove(key, out var _);
183
+ }
184
+
185
+ /// <summary>
186
+ /// Gets the value associated with the specified key.
187
+ /// </summary>
188
+ /// <param name="key">The key whose value to get.</param>
189
+ /// <param name="value">When this method returns, the value associated with the specified key, if the
190
+ /// key is found; otherwise, the default value for the type of the value parameter.
191
+ /// This parameter is passed uninitialized.</param>
192
+ /// <returns> true if the object that implements Multimap contains
193
+ /// an item with the specified key; otherwise, false.</returns>
194
+ public bool TryGetValue(TKey key, out IList<TValue> value)
195
+ {
196
+ return _dictionary.TryGetValue(key, out value);
197
+ }
198
+
199
+ /// <summary>
200
+ /// Gets or sets the item with the specified key.
201
+ /// </summary>
202
+ /// <param name="key">The key of the item to get or set.</param>
203
+ /// <returns>The value of the specified key.</returns>
204
+ public IList<TValue> this[TKey key]
205
+ {
206
+ get => _dictionary[key];
207
+ set => _dictionary[key] = value;
208
+ }
209
+
210
+ /// <summary>
211
+ /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap.
212
+ /// </summary>
213
+ public ICollection<TKey> Keys => _dictionary.Keys;
214
+
215
+ /// <summary>
216
+ /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap.
217
+ /// </summary>
218
+ public ICollection<IList<TValue>> Values => _dictionary.Values;
219
+
220
+ /// <summary>
221
+ /// Copy the items of the Multimap to an System.Array,
222
+ /// starting at a particular System.Array index.
223
+ /// </summary>
224
+ /// <param name="array">The one-dimensional System.Array that is the destination of the items copied
225
+ /// from Multimap. The System.Array must have zero-based indexing.</param>
226
+ /// <param name="index">The zero-based index in array at which copying begins.</param>
227
+ public void CopyTo(Array array, int index)
228
+ {
229
+ ((ICollection)_dictionary).CopyTo(array, index);
230
+ }
231
+
232
+ /// <summary>
233
+ /// Adds an item with the provided key and value to the Multimap.
234
+ /// </summary>
235
+ /// <param name="key">The object to use as the key of the item to add.</param>
236
+ /// <param name="value">The object to use as the value of the item to add.</param>
237
+ /// <exception cref="InvalidOperationException">Thrown when couldn't add value to Multimap.</exception>
238
+ public void Add(TKey key, TValue value)
239
+ {
240
+ if (value != null)
241
+ {
242
+ if (_dictionary.TryGetValue(key, out var list))
243
+ {
244
+ list.Add(value);
245
+ }
246
+ else
247
+ {
248
+ list = new List<TValue> { value };
249
+ if (!TryAdd(key, list))
250
+ throw new InvalidOperationException("Could not add value to Multimap.");
251
+ }
252
+ }
253
+ }
254
+
255
+ #endregion Public Members
256
+
257
+ #region Private Members
258
+
259
+ /**
260
+ * Helper method to encapsulate generator differences between dictionary types.
261
+ */
262
+ private bool TryRemove(TKey key, out IList<TValue> value)
263
+ {
264
+ _dictionary.TryGetValue(key, out value);
265
+ return _dictionary.Remove(key);
266
+ }
267
+
268
+ /**
269
+ * Helper method to encapsulate generator differences between dictionary types.
270
+ */
271
+ private bool TryAdd(TKey key, IList<TValue> value)
272
+ {
273
+ try
274
+ {
275
+ _dictionary.Add(key, value);
276
+ }
277
+ catch (ArgumentException)
278
+ {
279
+ return false;
280
+ }
281
+
282
+ return true;
283
+ }
284
+ #endregion Private Members
285
+ }
286
+ }