@kattebak/openapi-generator-ts 1.0.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 (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/dist/cli/commands/generate.d.ts +23 -0
  4. package/dist/cli/commands/generate.d.ts.map +1 -0
  5. package/dist/cli/commands/generate.js +116 -0
  6. package/dist/cli/commands/generate.js.map +1 -0
  7. package/dist/cli/commands/list.d.ts +2 -0
  8. package/dist/cli/commands/list.d.ts.map +1 -0
  9. package/dist/cli/commands/list.js +26 -0
  10. package/dist/cli/commands/list.js.map +1 -0
  11. package/dist/cli/commands/validate.d.ts +6 -0
  12. package/dist/cli/commands/validate.d.ts.map +1 -0
  13. package/dist/cli/commands/validate.js +80 -0
  14. package/dist/cli/commands/validate.js.map +1 -0
  15. package/dist/cli/convert-template.d.ts +31 -0
  16. package/dist/cli/convert-template.d.ts.map +1 -0
  17. package/dist/cli/convert-template.js +204 -0
  18. package/dist/cli/convert-template.js.map +1 -0
  19. package/dist/cli/convert-template.test.d.ts +2 -0
  20. package/dist/cli/convert-template.test.d.ts.map +1 -0
  21. package/dist/cli/convert-template.test.js +74 -0
  22. package/dist/cli/convert-template.test.js.map +1 -0
  23. package/dist/cli/index.d.ts +3 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +246 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/core/config.d.ts +252 -0
  28. package/dist/core/config.d.ts.map +1 -0
  29. package/dist/core/config.js +31 -0
  30. package/dist/core/config.js.map +1 -0
  31. package/dist/core/generator.d.ts +99 -0
  32. package/dist/core/generator.d.ts.map +1 -0
  33. package/dist/core/generator.js +492 -0
  34. package/dist/core/generator.js.map +1 -0
  35. package/dist/core/index.d.ts +4 -0
  36. package/dist/core/index.d.ts.map +1 -0
  37. package/dist/core/index.js +4 -0
  38. package/dist/core/index.js.map +1 -0
  39. package/dist/core/types.d.ts +47 -0
  40. package/dist/core/types.d.ts.map +1 -0
  41. package/dist/core/types.js +5 -0
  42. package/dist/core/types.js.map +1 -0
  43. package/dist/generators/generators.test.d.ts +6 -0
  44. package/dist/generators/generators.test.d.ts.map +1 -0
  45. package/dist/generators/generators.test.js +247 -0
  46. package/dist/generators/generators.test.js.map +1 -0
  47. package/dist/generators/go.d.ts +10 -0
  48. package/dist/generators/go.d.ts.map +1 -0
  49. package/dist/generators/go.js +327 -0
  50. package/dist/generators/go.js.map +1 -0
  51. package/dist/generators/index.d.ts +29 -0
  52. package/dist/generators/index.d.ts.map +1 -0
  53. package/dist/generators/index.js +58 -0
  54. package/dist/generators/index.js.map +1 -0
  55. package/dist/generators/php.d.ts +14 -0
  56. package/dist/generators/php.d.ts.map +1 -0
  57. package/dist/generators/php.js +241 -0
  58. package/dist/generators/php.js.map +1 -0
  59. package/dist/generators/python.d.ts +10 -0
  60. package/dist/generators/python.d.ts.map +1 -0
  61. package/dist/generators/python.js +273 -0
  62. package/dist/generators/python.js.map +1 -0
  63. package/dist/generators/typescript-fetch.d.ts +14 -0
  64. package/dist/generators/typescript-fetch.d.ts.map +1 -0
  65. package/dist/generators/typescript-fetch.js +217 -0
  66. package/dist/generators/typescript-fetch.js.map +1 -0
  67. package/dist/index.d.ts +14 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +16 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/models/codegen-model.d.ts +123 -0
  72. package/dist/models/codegen-model.d.ts.map +1 -0
  73. package/dist/models/codegen-model.js +64 -0
  74. package/dist/models/codegen-model.js.map +1 -0
  75. package/dist/models/codegen-model.test.d.ts +6 -0
  76. package/dist/models/codegen-model.test.d.ts.map +1 -0
  77. package/dist/models/codegen-model.test.js +143 -0
  78. package/dist/models/codegen-model.test.js.map +1 -0
  79. package/dist/models/codegen-operation.d.ts +95 -0
  80. package/dist/models/codegen-operation.d.ts.map +1 -0
  81. package/dist/models/codegen-operation.js +54 -0
  82. package/dist/models/codegen-operation.js.map +1 -0
  83. package/dist/models/codegen-parameter.d.ts +86 -0
  84. package/dist/models/codegen-parameter.d.ts.map +1 -0
  85. package/dist/models/codegen-parameter.js +47 -0
  86. package/dist/models/codegen-parameter.js.map +1 -0
  87. package/dist/models/codegen-property.d.ts +95 -0
  88. package/dist/models/codegen-property.d.ts.map +1 -0
  89. package/dist/models/codegen-property.js +47 -0
  90. package/dist/models/codegen-property.js.map +1 -0
  91. package/dist/models/codegen-response.d.ts +64 -0
  92. package/dist/models/codegen-response.d.ts.map +1 -0
  93. package/dist/models/codegen-response.js +42 -0
  94. package/dist/models/codegen-response.js.map +1 -0
  95. package/dist/models/codegen-security.d.ts +34 -0
  96. package/dist/models/codegen-security.d.ts.map +1 -0
  97. package/dist/models/codegen-security.js +18 -0
  98. package/dist/models/codegen-security.js.map +1 -0
  99. package/dist/models/index.d.ts +8 -0
  100. package/dist/models/index.d.ts.map +1 -0
  101. package/dist/models/index.js +7 -0
  102. package/dist/models/index.js.map +1 -0
  103. package/dist/parser/index.d.ts +4 -0
  104. package/dist/parser/index.d.ts.map +1 -0
  105. package/dist/parser/index.js +4 -0
  106. package/dist/parser/index.js.map +1 -0
  107. package/dist/parser/openapi-parser.d.ts +71 -0
  108. package/dist/parser/openapi-parser.d.ts.map +1 -0
  109. package/dist/parser/openapi-parser.js +195 -0
  110. package/dist/parser/openapi-parser.js.map +1 -0
  111. package/dist/parser/openapi-parser.test.d.ts +6 -0
  112. package/dist/parser/openapi-parser.test.d.ts.map +1 -0
  113. package/dist/parser/openapi-parser.test.js +238 -0
  114. package/dist/parser/openapi-parser.test.js.map +1 -0
  115. package/dist/parser/operation-transformer.d.ts +95 -0
  116. package/dist/parser/operation-transformer.d.ts.map +1 -0
  117. package/dist/parser/operation-transformer.js +634 -0
  118. package/dist/parser/operation-transformer.js.map +1 -0
  119. package/dist/parser/schema-transformer.d.ts +134 -0
  120. package/dist/parser/schema-transformer.d.ts.map +1 -0
  121. package/dist/parser/schema-transformer.js +557 -0
  122. package/dist/parser/schema-transformer.js.map +1 -0
  123. package/dist/template/engine-adapter.d.ts +55 -0
  124. package/dist/template/engine-adapter.d.ts.map +1 -0
  125. package/dist/template/engine-adapter.js +178 -0
  126. package/dist/template/engine-adapter.js.map +1 -0
  127. package/dist/template/engine-adapter.test.d.ts +6 -0
  128. package/dist/template/engine-adapter.test.d.ts.map +1 -0
  129. package/dist/template/engine-adapter.test.js +186 -0
  130. package/dist/template/engine-adapter.test.js.map +1 -0
  131. package/dist/template/index.d.ts +5 -0
  132. package/dist/template/index.d.ts.map +1 -0
  133. package/dist/template/index.js +5 -0
  134. package/dist/template/index.js.map +1 -0
  135. package/dist/template/lambdas/indent-lambdas.d.ts +40 -0
  136. package/dist/template/lambdas/indent-lambdas.d.ts.map +1 -0
  137. package/dist/template/lambdas/indent-lambdas.js +98 -0
  138. package/dist/template/lambdas/indent-lambdas.js.map +1 -0
  139. package/dist/template/lambdas/index.d.ts +44 -0
  140. package/dist/template/lambdas/index.d.ts.map +1 -0
  141. package/dist/template/lambdas/index.js +79 -0
  142. package/dist/template/lambdas/index.js.map +1 -0
  143. package/dist/template/lambdas/string-lambdas.d.ts +78 -0
  144. package/dist/template/lambdas/string-lambdas.d.ts.map +1 -0
  145. package/dist/template/lambdas/string-lambdas.js +148 -0
  146. package/dist/template/lambdas/string-lambdas.js.map +1 -0
  147. package/dist/template/lambdas/string-lambdas.test.d.ts +6 -0
  148. package/dist/template/lambdas/string-lambdas.test.d.ts.map +1 -0
  149. package/dist/template/lambdas/string-lambdas.test.js +158 -0
  150. package/dist/template/lambdas/string-lambdas.test.js.map +1 -0
  151. package/dist/template/template-locator.d.ts +72 -0
  152. package/dist/template/template-locator.d.ts.map +1 -0
  153. package/dist/template/template-locator.js +173 -0
  154. package/dist/template/template-locator.js.map +1 -0
  155. package/dist/template/template-manager.d.ts +65 -0
  156. package/dist/template/template-manager.d.ts.map +1 -0
  157. package/dist/template/template-manager.js +185 -0
  158. package/dist/template/template-manager.js.map +1 -0
  159. package/package.json +67 -0
  160. package/templates/go/.travis.yml +8 -0
  161. package/templates/go/README.mustache +236 -0
  162. package/templates/go/api.mustache +452 -0
  163. package/templates/go/api_doc.mustache +92 -0
  164. package/templates/go/api_test.mustache +59 -0
  165. package/templates/go/client.mustache +761 -0
  166. package/templates/go/configuration.mustache +332 -0
  167. package/templates/go/git_push.sh.mustache +57 -0
  168. package/templates/go/gitignore.mustache +24 -0
  169. package/templates/go/go.mod.mustache +16 -0
  170. package/templates/go/go.sum.mustache +19 -0
  171. package/templates/go/model.mustache +21 -0
  172. package/templates/go/model_anyof.mustache +93 -0
  173. package/templates/go/model_doc.mustache +97 -0
  174. package/templates/go/model_enum.mustache +101 -0
  175. package/templates/go/model_oneof.mustache +160 -0
  176. package/templates/go/model_simple.mustache +572 -0
  177. package/templates/go/nullable_model.mustache +35 -0
  178. package/templates/go/openapi.mustache +1 -0
  179. package/templates/go/partial_header.mustache +18 -0
  180. package/templates/go/response.mustache +38 -0
  181. package/templates/go/signing.mustache +453 -0
  182. package/templates/go/utils.mustache +352 -0
  183. package/templates/php/.php-cs-fixer.dist.php +29 -0
  184. package/templates/php/.travis.yml +8 -0
  185. package/templates/php/ApiException.mustache +111 -0
  186. package/templates/php/Configuration.mustache +606 -0
  187. package/templates/php/FormDataProcessor.mustache +238 -0
  188. package/templates/php/HeaderSelector.mustache +265 -0
  189. package/templates/php/ModelInterface.mustache +103 -0
  190. package/templates/php/ObjectSerializer.mustache +591 -0
  191. package/templates/php/README.mustache +151 -0
  192. package/templates/php/api.mustache +891 -0
  193. package/templates/php/api_doc.mustache +105 -0
  194. package/templates/php/api_test.mustache +80 -0
  195. package/templates/php/composer.mustache +44 -0
  196. package/templates/php/git_push.sh.mustache +57 -0
  197. package/templates/php/gitignore +15 -0
  198. package/templates/php/libraries/psr-18/ApiException.mustache +114 -0
  199. package/templates/php/libraries/psr-18/DebugPlugin.mustache +93 -0
  200. package/templates/php/libraries/psr-18/README.mustache +161 -0
  201. package/templates/php/libraries/psr-18/api.mustache +833 -0
  202. package/templates/php/libraries/psr-18/api_doc.mustache +79 -0
  203. package/templates/php/libraries/psr-18/composer.mustache +56 -0
  204. package/templates/php/model.mustache +47 -0
  205. package/templates/php/model_doc.mustache +10 -0
  206. package/templates/php/model_enum.mustache +33 -0
  207. package/templates/php/model_generic.mustache +565 -0
  208. package/templates/php/model_test.mustache +88 -0
  209. package/templates/php/partial_header.mustache +18 -0
  210. package/templates/php/php_doc_auth_partial.mustache +23 -0
  211. package/templates/php/phpunit.xml.mustache +18 -0
  212. package/templates/python/README.mustache +60 -0
  213. package/templates/python/README_onlypackage.mustache +50 -0
  214. package/templates/python/__init__.mustache +1 -0
  215. package/templates/python/__init__api.mustache +19 -0
  216. package/templates/python/__init__model.mustache +22 -0
  217. package/templates/python/__init__package.mustache +49 -0
  218. package/templates/python/api.mustache +244 -0
  219. package/templates/python/api_client.mustache +822 -0
  220. package/templates/python/api_doc.mustache +81 -0
  221. package/templates/python/api_doc_example.mustache +38 -0
  222. package/templates/python/api_response.mustache +21 -0
  223. package/templates/python/api_test.mustache +48 -0
  224. package/templates/python/asyncio/rest.mustache +209 -0
  225. package/templates/python/common_README.mustache +85 -0
  226. package/templates/python/configuration.mustache +806 -0
  227. package/templates/python/exceptions.mustache +210 -0
  228. package/templates/python/exports_api.mustache +3 -0
  229. package/templates/python/exports_model.mustache +3 -0
  230. package/templates/python/exports_package.mustache +20 -0
  231. package/templates/python/git_push.sh.mustache +57 -0
  232. package/templates/python/github-workflow.mustache +35 -0
  233. package/templates/python/gitignore.mustache +66 -0
  234. package/templates/python/gitlab-ci.mustache +31 -0
  235. package/templates/python/httpx/rest.mustache +190 -0
  236. package/templates/python/model.mustache +16 -0
  237. package/templates/python/model_anyof.mustache +182 -0
  238. package/templates/python/model_doc.mustache +40 -0
  239. package/templates/python/model_enum.mustache +36 -0
  240. package/templates/python/model_generic.mustache +403 -0
  241. package/templates/python/model_oneof.mustache +209 -0
  242. package/templates/python/model_test.mustache +60 -0
  243. package/templates/python/partial_api.mustache +52 -0
  244. package/templates/python/partial_api_args.mustache +18 -0
  245. package/templates/python/partial_header.mustache +19 -0
  246. package/templates/python/py.typed.mustache +1 -0
  247. package/templates/python/pyproject.mustache +172 -0
  248. package/templates/python/python_doc_auth_partial.mustache +108 -0
  249. package/templates/python/requirements.mustache +23 -0
  250. package/templates/python/rest.mustache +254 -0
  251. package/templates/python/setup.mustache +60 -0
  252. package/templates/python/setup_cfg.mustache +2 -0
  253. package/templates/python/signing.mustache +422 -0
  254. package/templates/python/test-requirements.mustache +6 -0
  255. package/templates/python/tornado/rest.mustache +148 -0
  256. package/templates/python/tox.mustache +9 -0
  257. package/templates/python/travis.mustache +17 -0
  258. package/templates/typescript-fetch/ApiEntitiesRecord.mustache +26 -0
  259. package/templates/typescript-fetch/ApiEntitiesReducer.mustache +21 -0
  260. package/templates/typescript-fetch/ApiEntitiesSelectors.mustache +5 -0
  261. package/templates/typescript-fetch/README.mustache +127 -0
  262. package/templates/typescript-fetch/allSagas.mustache +19 -0
  263. package/templates/typescript-fetch/api_doc.mustache +63 -0
  264. package/templates/typescript-fetch/api_example.mustache +44 -0
  265. package/templates/typescript-fetch/apis.index.mustache +16 -0
  266. package/templates/typescript-fetch/apis.mustache +483 -0
  267. package/templates/typescript-fetch/apisAssignQueryParam.mustache +12 -0
  268. package/templates/typescript-fetch/gitignore +4 -0
  269. package/templates/typescript-fetch/index.mustache +17 -0
  270. package/templates/typescript-fetch/licenseInfo.mustache +11 -0
  271. package/templates/typescript-fetch/modelEnum.mustache +28 -0
  272. package/templates/typescript-fetch/modelEnumInterfaces.mustache +37 -0
  273. package/templates/typescript-fetch/modelGeneric.mustache +261 -0
  274. package/templates/typescript-fetch/modelGenericInterfaces.mustache +50 -0
  275. package/templates/typescript-fetch/modelOneOf.mustache +255 -0
  276. package/templates/typescript-fetch/modelOneOfInterfaces.mustache +6 -0
  277. package/templates/typescript-fetch/model_doc.mustache +41 -0
  278. package/templates/typescript-fetch/models.index.mustache +32 -0
  279. package/templates/typescript-fetch/models.mustache +24 -0
  280. package/templates/typescript-fetch/npmignore.mustache +1 -0
  281. package/templates/typescript-fetch/package.mustache +43 -0
  282. package/templates/typescript-fetch/recordGeneric.mustache +295 -0
  283. package/templates/typescript-fetch/records.mustache +17 -0
  284. package/templates/typescript-fetch/runtime.mustache +424 -0
  285. package/templates/typescript-fetch/runtimeSagasAndRecords.mustache +120 -0
  286. package/templates/typescript-fetch/sagaApiManager.mustache +28 -0
  287. package/templates/typescript-fetch/sagas.mustache +245 -0
  288. package/templates/typescript-fetch/sourceLibraryIndex.mustache +1 -0
  289. package/templates/typescript-fetch/tsconfig.esm.mustache +7 -0
  290. package/templates/typescript-fetch/tsconfig.mustache +25 -0
@@ -0,0 +1,105 @@
1
+ # {{invokerPackage}}\{{classname}}{{#operationTagDescription}}
2
+
3
+ {{operationTagDescription}}{{/operationTagDescription}}
4
+
5
+ All URIs are relative to {{basePath}}, except if the operation defines another base path.
6
+
7
+ | Method | HTTP request | Description |
8
+ | ------------- | ------------- | ------------- |
9
+ {{#operations}}{{#operation}}| [**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} |
10
+ {{/operation}}{{/operations}}{{#operations}}{{#operation}}
11
+
12
+ ## `{{{operationId}}}()`
13
+
14
+ ```php
15
+ {{{operationId}}}({{#allParams}}${{paramName}}{{#unless @last}}, {{/unless}}{{/allParams}}){{#if returnType}}: {{{returnType}}}{{/if}}
16
+ ```
17
+ {{#servers}}
18
+ {{#if @first}}
19
+ ### URI(s):
20
+ {{/if}}
21
+ - {{{url}}} {{description}}{{#variables}}
22
+ {{#if @first}}
23
+ - Variables:
24
+ {{/if}}
25
+ - {{{name}}}: {{{description}}}{{#unless description}} No description provided{{/unless}}{{#enumValues}}
26
+ {{#if @first}}
27
+ - Allowed values:
28
+ {{/if}}
29
+ - {{{.}}}{{/enumValues}}{{#if defaultValue}}
30
+ - Default value: {{{defaultValue}}}
31
+ {{/if}}{{/variables}}{{/servers}}
32
+ {{{summary}}}{{#if notes}}
33
+
34
+ {{{notes}}}{{/if}}
35
+
36
+ ### Example
37
+
38
+ ```php
39
+ <?php
40
+ require_once(__DIR__ . '/vendor/autoload.php');
41
+
42
+ {{> php_doc_auth_partial}}
43
+
44
+ $apiInstance = new {{invokerPackage}}\Api\{{classname}}(
45
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
46
+ // This is optional, `GuzzleHttp\Client` will be used as default.
47
+ new GuzzleHttp\Client(){{#hasAuthMethods}},
48
+ $config{{/hasAuthMethods}}
49
+ );
50
+ {{^exts.x-group-parameters}}
51
+ {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#if description}} | {{{description}}}{{/if}}
52
+ {{/allParams}}{{#servers}}{{#if @first}}
53
+ $hostIndex = 0;
54
+ $variables = [{{#variables}}
55
+ '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}}
56
+ ];
57
+ {{/if}}{{/servers}}{{/exts.x-group-parameters}}{{#exts.x-group-parameters}}
58
+ $associative_array = [
59
+ {{#allParams}} '{{paramName}}' => {{{example}}}, // {{{dataType}}}{{#if description}} | {{{description}}}{{/if}}
60
+ {{/allParams}}
61
+ {{#servers}}{{#if @first}}
62
+ 'hostIndex' => 0,
63
+ $variables = [{{#variables}}
64
+ '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}}
65
+ ],
66
+ {{/if}}{{/servers}}];
67
+ {{/exts.x-group-parameters}}
68
+
69
+ try {
70
+ {{#if returnType}}$result = {{/if}}$apiInstance->{{{operationId}}}({{^exts.x-group-parameters}}{{#allParams}}${{paramName}}{{#unless @last}}, {{/unless}}{{/allParams}}{{#servers}}{{#if @first}}{{#allParams}}{{#if @first}}, {{/if}}{{/allParams}}$hostIndex, $variables{{/if}}{{/servers}}{{/exts.x-group-parameters}}{{#exts.x-group-parameters}}$associate_array{{/exts.x-group-parameters}});{{#if returnType}}
71
+ print_r($result);{{/if}}
72
+ } catch (Exception $e) {
73
+ echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
74
+ }
75
+ ```
76
+
77
+ ### Parameters
78
+
79
+ {{#exts.x-group-parameters}}
80
+ Note: the input parameter is an associative array with the keys listed as the parameter names below.
81
+
82
+ {{/exts.x-group-parameters}}
83
+ {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#if @last}}| Name | Type | Description | Notes |
84
+ | ------------- | ------------- | ------------- | ------------- |{{/if}}{{/allParams}}
85
+ {{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#if defaultValue}} [default to {{defaultValue}}]{{/if}} |
86
+ {{/allParams}}{{#servers}}{{#if @first}}| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
87
+ | variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |{{/if}}
88
+ {{/servers}}
89
+
90
+ ### Return type
91
+
92
+ {{#if returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/if}}{{#unless returnType}}void (empty response body){{/unless}}
93
+
94
+ ### Authorization
95
+
96
+ {{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../../README.md#{{{name}}}){{#unless @last}}, {{/unless}}{{/authMethods}}
97
+
98
+ ### HTTP request headers
99
+
100
+ - **Content-Type**: {{#consumes}}`{{{mediaType}}}`{{#unless @last}}, {{/unless}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
101
+ - **Accept**: {{#produces}}`{{{mediaType}}}`{{#unless @last}}, {{/unless}}{{/produces}}{{^produces}}Not defined{{/produces}}
102
+
103
+ [[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
104
+ [[Back to Model list]](../../README.md#models)
105
+ [[Back to README]](../../README.md){{/operation}}{{/operations}}
@@ -0,0 +1,80 @@
1
+ <?php
2
+ /**
3
+ * {{classname}}Test
4
+ * PHP version 8.1
5
+ *
6
+ * @category Class
7
+ * @package {{invokerPackage}}
8
+ * @author OpenAPI Generator team
9
+ * @link https://openapi-generator.tech
10
+ */
11
+
12
+ {{>partial_header}}
13
+
14
+ /**
15
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
16
+ * https://openapi-generator.tech
17
+ * Please update the test case below to test the endpoint.
18
+ */
19
+
20
+ namespace {{invokerPackage}}\Test\Api;
21
+
22
+ use \{{invokerPackage}}\Configuration;
23
+ use \{{invokerPackage}}\ApiException;
24
+ use \{{invokerPackage}}\ObjectSerializer;
25
+ use PHPUnit\Framework\TestCase;
26
+
27
+ /**
28
+ * {{classname}}Test Class Doc Comment
29
+ *
30
+ * @category Class
31
+ * @package {{invokerPackage}}
32
+ * @author OpenAPI Generator team
33
+ * @link https://openapi-generator.tech
34
+ */
35
+ {{#operations}}class {{classname}}Test extends TestCase
36
+ {
37
+
38
+ /**
39
+ * Setup before running any test cases
40
+ */
41
+ public static function setUpBeforeClass(): void
42
+ {
43
+ }
44
+
45
+ /**
46
+ * Setup before running each test case
47
+ */
48
+ public function setUp(): void
49
+ {
50
+ }
51
+
52
+ /**
53
+ * Clean up after running each test case
54
+ */
55
+ public function tearDown(): void
56
+ {
57
+ }
58
+
59
+ /**
60
+ * Clean up after running all test cases
61
+ */
62
+ public static function tearDownAfterClass(): void
63
+ {
64
+ }
65
+ {{#operation}}
66
+
67
+ /**
68
+ * Test case for {{{operationId}}}
69
+ *
70
+ * {{{summary}}}.
71
+ *
72
+ */
73
+ public function test{{exts.x-test-operation-id}}()
74
+ {
75
+ // TODO: implement
76
+ self::markTestIncomplete('Not implemented');
77
+ }
78
+ {{/operation}}
79
+ }
80
+ {{/operations}}
@@ -0,0 +1,44 @@
1
+ {
2
+ {{#composerPackageName}}
3
+ "name": "{{{.}}}",
4
+ {{/composerPackageName}}
5
+ {{#artifactVersion}}
6
+ "version": "{{{.}}}",
7
+ {{/artifactVersion}}
8
+ "description": "{{{appDescription}}}",
9
+ "keywords": [
10
+ "openapitools",
11
+ "openapi-generator",
12
+ "openapi",
13
+ "php",
14
+ "sdk",
15
+ "rest",
16
+ "api"
17
+ ],
18
+ "homepage": "{{{artifactUrl}}}",
19
+ "license": "{{{licenseName}}}",
20
+ "authors": [
21
+ {
22
+ "name": "{{{developerOrganization}}}",
23
+ "homepage": "{{{developerOrganizationUrl}}}"
24
+ }
25
+ ],
26
+ "require": {
27
+ "php": "^8.1",
28
+ "ext-curl": "*",
29
+ "ext-json": "*",
30
+ "ext-mbstring": "*",
31
+ "guzzlehttp/guzzle": "^7.3",
32
+ "guzzlehttp/psr7": "^1.7 || ^2.0"
33
+ },
34
+ "require-dev": {
35
+ "phpunit/phpunit": "^8.0 || ^9.0",
36
+ "friendsofphp/php-cs-fixer": "^3.5"
37
+ },
38
+ "autoload": {
39
+ "psr-4": { "{{{escapedInvokerPackage}}}\\" : "{{{srcBasePath}}}/" }
40
+ },
41
+ "autoload-dev": {
42
+ "psr-4": { "{{{escapedInvokerPackage}}}\\Test\\" : "{{{testBasePath}}}/" }
43
+ }
44
+ }
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="{{{gitHost}}}"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="{{{gitUserId}}}"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="{{{gitRepoId}}}"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="{{{releaseNote}}}"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
@@ -0,0 +1,15 @@
1
+ # ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
2
+
3
+ composer.phar
4
+ /vendor/
5
+
6
+ # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
7
+ # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
8
+ # composer.lock
9
+
10
+ # php-cs-fixer cache
11
+ .php_cs.cache
12
+ .php-cs-fixer.cache
13
+
14
+ # PHPUnit cache
15
+ .phpunit.result.cache
@@ -0,0 +1,114 @@
1
+ <?php
2
+ /**
3
+ * ApiException
4
+ * PHP version 7.2
5
+ *
6
+ * @category Class
7
+ * @package {{invokerPackage}}
8
+ * @author OpenAPI Generator team
9
+ * @link https://openapi-generator.tech
10
+ */
11
+
12
+ {{>partial_header}}
13
+
14
+ /**
15
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
16
+ * https://openapi-generator.tech
17
+ * Do not edit the class manually.
18
+ */
19
+
20
+ namespace {{invokerPackage}};
21
+
22
+ use Exception;
23
+ use Http\Client\Exception\RequestException;
24
+ use Psr\Http\Message\RequestInterface;
25
+ use Psr\Http\Message\ResponseInterface;
26
+
27
+ /**
28
+ * ApiException Class Doc Comment
29
+ *
30
+ * @category Class
31
+ * @package {{invokerPackage}}
32
+ * @author OpenAPI Generator team
33
+ * @link https://openapi-generator.tech
34
+ */
35
+ class ApiException extends RequestException
36
+ {
37
+
38
+ /**
39
+ * The HTTP body of the server response either as Json or string.
40
+ *
41
+ * @var string|null
42
+ */
43
+ protected $responseBody;
44
+
45
+ /**
46
+ * The HTTP header of the server response.
47
+ *
48
+ * @var string[][]|null
49
+ */
50
+ protected $responseHeaders;
51
+
52
+ /**
53
+ * The deserialized response object
54
+ *
55
+ * @var \stdClass|string|null
56
+ */
57
+ protected $responseObject;
58
+
59
+ public function __construct(
60
+ $message,
61
+ RequestInterface $request,
62
+ ?ResponseInterface $response = null,
63
+ ?Exception $previous = null
64
+ ) {
65
+ parent::__construct($message, $request, $previous);
66
+ if ($response) {
67
+ $this->responseHeaders = $response->getHeaders();
68
+ $this->responseBody = (string) $response->getBody();
69
+ $this->code = $response->getStatusCode();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Gets the HTTP response header
75
+ *
76
+ * @return string[][]|null HTTP response header
77
+ */
78
+ public function getResponseHeaders()
79
+ {
80
+ return $this->responseHeaders;
81
+ }
82
+
83
+ /**
84
+ * Gets the HTTP body of the server response either as Json or string
85
+ *
86
+ * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
87
+ */
88
+ public function getResponseBody()
89
+ {
90
+ return $this->responseBody;
91
+ }
92
+
93
+ /**
94
+ * Sets the deserialized response object (during deserialization)
95
+ *
96
+ * @param mixed $obj Deserialized response object
97
+ *
98
+ * @return void
99
+ */
100
+ public function setResponseObject($obj)
101
+ {
102
+ $this->responseObject = $obj;
103
+ }
104
+
105
+ /**
106
+ * Gets the deserialized response object (during deserialization)
107
+ *
108
+ * @return mixed the deserialized response object
109
+ */
110
+ public function getResponseObject()
111
+ {
112
+ return $this->responseObject;
113
+ }
114
+ }
@@ -0,0 +1,93 @@
1
+ <?php
2
+ /**
3
+ * Configuration
4
+ * PHP version 7.2
5
+ *
6
+ * @category Class
7
+ * @package {{invokerPackage}}
8
+ * @author OpenAPI Generator team
9
+ * @link https://openapi-generator.tech
10
+ */
11
+
12
+ {{>partial_header}}
13
+
14
+ /**
15
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
16
+ * https://openapi-generator.tech
17
+ * Do not edit the class manually.
18
+ */
19
+
20
+ namespace {{invokerPackage}};
21
+
22
+ use Http\Client\Common\Plugin;
23
+ use Http\Promise\Promise;
24
+ use Psr\Http\Client\ClientExceptionInterface;
25
+ use Psr\Http\Message\RequestInterface;
26
+ use Psr\Http\Message\ResponseInterface;
27
+ use function is_resource;
28
+
29
+ /**
30
+ * Configuration Class Doc Comment
31
+ * PHP version 7.2
32
+ *
33
+ * @category Class
34
+ * @package {{invokerPackage}}
35
+ * @author OpenAPI Generator team
36
+ * @link https://openapi-generator.tech
37
+ */
38
+ class DebugPlugin implements Plugin
39
+ {
40
+
41
+ /**
42
+ * @var resource
43
+ */
44
+ private $output;
45
+
46
+ /**
47
+ * DebuggingPlugin constructor.
48
+ *
49
+ * @param resource $output
50
+ */
51
+ public function __construct($output)
52
+ {
53
+ if (!is_resource($output)) {
54
+ throw new \InvalidArgumentException('debugging resource is not valid');
55
+ }
56
+ $this->output = $output;
57
+ }
58
+
59
+ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
60
+ {
61
+ return $next($request)->then(
62
+ function (ResponseInterface $response) use ($request) {
63
+ $this->logSuccess($request, $response);
64
+
65
+ return $response;
66
+ },
67
+ function (ClientExceptionInterface $exception) use ($request) {
68
+ $this->logError($request, $exception);
69
+
70
+ throw $exception;
71
+ }
72
+ );
73
+ }
74
+
75
+ private function logSuccess(RequestInterface $request, ResponseInterface $response): void
76
+ {
77
+ $methodAndPath = $request->getMethod() . ' ' . $request->getUri()->getPath();
78
+ $protocol = $response->getProtocolVersion();
79
+ $responseCode = $response->getStatusCode();
80
+ \fprintf($this->output, '<%s HTTP/%s> %s', $methodAndPath, $protocol, $responseCode);
81
+ \fwrite($this->output, "\n");
82
+ }
83
+
84
+ private function logError(RequestInterface $request, ClientExceptionInterface $exception): void
85
+ {
86
+ $methodAndPath = $request->getMethod() . ' ' . $request->getUri()->getPath();
87
+ $protocol = $request->getProtocolVersion();
88
+ $error = $exception->getMessage();
89
+ $responseCode = $exception->getCode();
90
+ \fprintf($this->output, '<%s HTTP/%s> %s %s', $methodAndPath, $responseCode, $error, $protocol);
91
+ \fwrite($this->output, "\n");
92
+ }
93
+ }
@@ -0,0 +1,161 @@
1
+ # {{packageName}}
2
+
3
+ {{#if appDescriptionWithNewLines}}
4
+ {{{appDescriptionWithNewLines}}}
5
+ {{/if}}
6
+
7
+ {{#if infoUrl}}
8
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}).
9
+ {{/if}}
10
+
11
+ ## Installation & Usage
12
+
13
+ ### Requirements
14
+
15
+ PHP 7.2 and later.
16
+
17
+ ### Composer
18
+
19
+ To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
20
+
21
+ ```json
22
+ {
23
+ "repositories": [
24
+ {
25
+ "type": "vcs",
26
+ "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
27
+ }
28
+ ],
29
+ "require": {
30
+ "{{gitUserId}}/{{gitRepoId}}": "*@dev"
31
+ }
32
+ }
33
+ ```
34
+
35
+ Then run `composer install`
36
+
37
+ Your project is free to choose the http client of your choice
38
+ Please require packages that will provide http client functionality:
39
+ https://packagist.org/providers/psr/http-client-implementation
40
+ https://packagist.org/providers/php-http/async-client-implementation
41
+ https://packagist.org/providers/psr/http-factory-implementation
42
+
43
+ As an example:
44
+
45
+ ```
46
+ composer require guzzlehttp/guzzle php-http/guzzle7-adapter http-interop/http-factory-guzzle
47
+ ```
48
+
49
+ ### Manual Installation
50
+
51
+ Download the files and include `autoload.php`:
52
+
53
+ ```php
54
+ <?php
55
+ require_once('/path/to/{{packageName}}/vendor/autoload.php');
56
+ ```
57
+
58
+ ## Getting Started
59
+
60
+ Please follow the [installation procedure](#installation--usage) and then run the following:
61
+
62
+ ```php
63
+ <?php
64
+ require_once(__DIR__ . '/vendor/autoload.php');
65
+
66
+ {{#apiInfo}}{{#apis}}{{#if @first}}{{#operations}}{{#operation}}{{#if @first}}
67
+ {{> php_doc_auth_partial}}
68
+
69
+ $apiInstance = new {{invokerPackage}}\Api\{{classname}}(
70
+ // If you want use custom http client, pass your client which implements `Psr\Http\Client\ClientInterface`.
71
+ // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface
72
+ new GuzzleHttp\Client(){{#hasAuthMethods}},
73
+ $config{{/hasAuthMethods}}
74
+ );
75
+ {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#if description}} | {{{description}}}{{/if}}
76
+ {{/allParams}}
77
+
78
+ try {
79
+ {{#if returnType}}$result = {{/if}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{#unless @last}}, {{/unless}}{{/allParams}});{{#if returnType}}
80
+ print_r($result);{{/if}}
81
+ } catch (Exception $e) {
82
+ echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
83
+ }
84
+ {{/if}}{{/operation}}{{/operations}}{{/if}}{{/apis}}{{/apiInfo}}
85
+ ```
86
+
87
+ ## API Endpoints
88
+
89
+ All URIs are relative to *{{basePath}}*
90
+
91
+ Class | Method | HTTP request | Description
92
+ ------------ | ------------- | ------------- | -------------
93
+ {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#if summary}}{{summary}}{{/if}}
94
+ {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
95
+ ## Models
96
+
97
+ {{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}}
98
+ {{/models}}
99
+
100
+ ## Authorization
101
+ {{^authMethods}}
102
+ All endpoints do not require authorization.
103
+ {{/authMethods}}
104
+ {{#authMethods}}
105
+ {{#last}} Authentication schemes defined for the API:{{/last}}
106
+ ### {{{name}}}
107
+ {{#isApiKey}}
108
+
109
+ - **Type**: API key
110
+ - **API key parameter name**: {{{keyParamName}}}
111
+ - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
112
+
113
+ {{/isApiKey}}
114
+ {{#isBasic}}
115
+ {{#isBasicBasic}}
116
+
117
+ - **Type**: HTTP basic authentication
118
+ {{/isBasicBasic}}
119
+ {{#isBasicBearer}}
120
+
121
+ - **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
122
+ {{/isBasicBearer}}
123
+ {{/isBasic}}
124
+ {{#isOAuth}}
125
+
126
+ - **Type**: `OAuth`
127
+ - **Flow**: `{{{flow}}}`
128
+ - **Authorization URL**: `{{{authorizationUrl}}}`
129
+ - **Scopes**: {{^scopes}}N/A{{/scopes}}
130
+ {{#scopes}}
131
+ - **{{{scope}}}**: {{{description}}}
132
+ {{/scopes}}
133
+ {{/isOAuth}}
134
+
135
+ {{/authMethods}}
136
+ ## Tests
137
+
138
+ To run the tests, use:
139
+
140
+ ```bash
141
+ composer install
142
+ vendor/bin/phpunit
143
+ ```
144
+
145
+ ## Author
146
+
147
+ {{#apiInfo}}{{#apis}}{{#if @last}}{{infoEmail}}
148
+ {{/if}}{{/apis}}{{/apiInfo}}
149
+ ## About this package
150
+
151
+ This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
152
+
153
+ - API version: `{{appVersion}}`
154
+ {{#artifactVersion}}
155
+ - Package version: `{{artifactVersion}}`
156
+ {{/artifactVersion}}
157
+ {{^hideGenerationTimestamp}}
158
+ - Build date: `{{generatedDate}}`
159
+ {{/hideGenerationTimestamp}}
160
+ - Generator version: `{{generatorVersion}}`
161
+ - Build package: `{{generatorClass}}`