@apimatic/cli 1.1.0-alpha.1 → 1.1.0-alpha.11
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.
- package/README.md +221 -73
- package/bin/run.js +5 -0
- package/lib/actions/portal/generate.d.ts +7 -0
- package/lib/actions/portal/generate.js +54 -0
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/actions/portal/recipe/new-recipe.js +258 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +17 -0
- package/lib/actions/portal/toc/new-toc.js +130 -0
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
- package/lib/application/portal/recipe/portal-recipe.js +33 -0
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
- package/lib/application/portal/recipe/recipe-generator.js +147 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/toc/sdl-parser.d.ts +16 -0
- package/lib/application/portal/toc/sdl-parser.js +74 -0
- package/lib/application/portal/toc/sdl-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
- package/lib/application/portal/toc/toc-content-parser.js +44 -0
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
- package/lib/application/portal/toc/toc-structure-generator.js +84 -0
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +9 -13
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/client-utils/sdk-client.js +24 -23
- package/lib/client-utils/sdk-client.js.map +1 -0
- package/lib/commands/api/transform.d.ts +7 -7
- package/lib/commands/api/transform.js +39 -38
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +4 -4
- package/lib/commands/api/validate.js +24 -23
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +2 -2
- package/lib/commands/auth/login.js +33 -18
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +1 -1
- package/lib/commands/auth/logout.js +6 -7
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -1
- package/lib/commands/auth/status.js +6 -7
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +12 -7
- package/lib/commands/portal/generate.js +73 -87
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/quickstart.d.ts +10 -0
- package/lib/commands/portal/quickstart.js +77 -0
- package/lib/commands/portal/quickstart.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +12 -0
- package/lib/commands/portal/recipe/new.js +44 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +16 -0
- package/lib/commands/portal/serve.js +135 -0
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +15 -0
- package/lib/commands/portal/toc/new.js +63 -0
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +8 -8
- package/lib/commands/sdk/generate.js +40 -41
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.d.ts +2 -0
- package/lib/config/axios-config.js +10 -0
- package/lib/config/axios-config.js.map +1 -0
- package/lib/config/env.d.ts +27 -1
- package/lib/config/env.js +28 -4
- package/lib/config/env.js.map +1 -0
- package/lib/controllers/api/transform.d.ts +1 -1
- package/lib/controllers/api/transform.js +23 -22
- package/lib/controllers/api/transform.js.map +1 -0
- package/lib/controllers/api/validate.d.ts +3 -3
- package/lib/controllers/api/validate.js +19 -12
- package/lib/controllers/api/validate.js.map +1 -0
- package/lib/controllers/portal/generate.d.ts +3 -2
- package/lib/controllers/portal/generate.js +105 -48
- package/lib/controllers/portal/generate.js.map +1 -0
- package/lib/controllers/portal/quickstart.d.ts +14 -0
- package/lib/controllers/portal/quickstart.js +253 -0
- package/lib/controllers/portal/quickstart.js.map +1 -0
- package/lib/controllers/portal/serve.d.ts +3 -0
- package/lib/controllers/portal/serve.js +133 -0
- package/lib/controllers/portal/serve.js.map +1 -0
- package/lib/controllers/sdk/generate.d.ts +4 -4
- package/lib/controllers/sdk/generate.js +23 -26
- package/lib/controllers/sdk/generate.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +16 -0
- package/lib/infrastructure/services/portal-service.js +129 -0
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +10 -0
- package/lib/prompts/portal/generate.js +57 -0
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +31 -0
- package/lib/prompts/portal/quickstart.js +212 -0
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -0
- package/lib/prompts/portal/recipe/new-recipe.js +193 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +7 -0
- package/lib/prompts/portal/serve.js +21 -0
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +10 -0
- package/lib/prompts/portal/toc/new-toc.js +42 -0
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/services/portal/server.d.ts +14 -0
- package/lib/services/portal/server.js +97 -0
- package/lib/services/portal/server.js.map +1 -0
- package/lib/types/api/transform.d.ts +19 -4
- package/lib/types/api/transform.js +19 -4
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/api/validate.d.ts +3 -3
- package/lib/types/api/validate.js +2 -2
- package/lib/types/api/validate.js.map +1 -0
- package/lib/types/common/result.d.ts +17 -0
- package/lib/types/common/result.js +32 -0
- package/lib/types/common/result.js.map +1 -0
- package/lib/types/portal/generate.d.ts +26 -9
- package/lib/types/portal/generate.js +3 -2
- package/lib/types/portal/generate.js.map +1 -0
- package/lib/types/portal/quickstart.d.ts +17 -0
- package/lib/types/portal/quickstart.js +2 -0
- package/lib/types/portal/quickstart.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +37 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +6 -5
- package/lib/types/sdk/generate.js +5 -6
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +12 -0
- package/lib/types/sdl/sdl.js +2 -0
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/toc/toc.d.ts +31 -0
- package/lib/types/toc/toc.js +9 -0
- package/lib/types/toc/toc.js.map +1 -0
- package/lib/types/utils.d.ts +3 -3
- package/lib/types/utils.js +2 -2
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/utils.d.ts +31 -5
- package/lib/utils/utils.js +316 -74
- package/lib/utils/utils.js.map +1 -0
- package/lib/validators/common/directoryValidator.d.ts +9 -0
- package/lib/validators/common/directoryValidator.js +49 -0
- package/lib/validators/common/directoryValidator.js.map +1 -0
- package/lib/validators/common/portValidator.d.ts +5 -0
- package/lib/validators/common/portValidator.js +16 -0
- package/lib/validators/common/portValidator.js.map +1 -0
- package/lib/validators/portal/serveValidator.d.ts +6 -0
- package/lib/validators/portal/serveValidator.js +17 -0
- package/lib/validators/portal/serveValidator.js.map +1 -0
- package/package.json +86 -38
- package/bin/run +0 -5
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@apimatic/cli
|
|
2
2
|
=============
|
|
3
|
+
apimatic is in Alpha.
|
|
3
4
|
|
|
4
5
|
The official CLI for APIMatic.
|
|
5
6
|
|
|
@@ -8,18 +9,22 @@ The official CLI for APIMatic.
|
|
|
8
9
|
[](https://npmjs.org/package/@apimatic/cli)
|
|
9
10
|
[](https://github.com/apimatic/apimatic-cli/blob/master/package.json)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
# Getting Started
|
|
13
|
+
|
|
14
|
+
To get started with APIMatic's CLI using a step by step wizard, run the following command:
|
|
15
|
+
|
|
16
|
+
```sh-session
|
|
17
|
+
$ apimatic portal:quickstart
|
|
18
|
+
```
|
|
19
|
+
|
|
15
20
|
# Usage
|
|
16
21
|
<!-- usage -->
|
|
17
22
|
```sh-session
|
|
18
|
-
$ npm install -g @apimatic/cli
|
|
23
|
+
$ npm install -g @apimatic/cli
|
|
19
24
|
$ apimatic COMMAND
|
|
20
25
|
running command...
|
|
21
|
-
$ apimatic (
|
|
22
|
-
@apimatic/cli/
|
|
26
|
+
$ apimatic (--version)
|
|
27
|
+
@apimatic/cli/1.1.0-alpha.10 win32-x64 node-v23.4.0
|
|
23
28
|
$ apimatic --help [COMMAND]
|
|
24
29
|
USAGE
|
|
25
30
|
$ apimatic COMMAND
|
|
@@ -37,6 +42,10 @@ USAGE
|
|
|
37
42
|
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
|
|
38
43
|
* [`apimatic help [COMMAND]`](#apimatic-help-command)
|
|
39
44
|
* [`apimatic portal:generate`](#apimatic-portalgenerate)
|
|
45
|
+
* [`apimatic portal:quickstart`](#apimatic-portalquickstart)
|
|
46
|
+
* [`apimatic portal:recipe:new`](#apimatic-portalrecipenew)
|
|
47
|
+
* [`apimatic portal:serve`](#apimatic-portalserve)
|
|
48
|
+
* [`apimatic portal:toc:new`](#apimatic-portaltocnew)
|
|
40
49
|
* [`apimatic sdk:generate`](#apimatic-sdkgenerate)
|
|
41
50
|
|
|
42
51
|
## `apimatic api:transform`
|
|
@@ -45,24 +54,25 @@ Transform API specifications from one format to another. Supports [10+ different
|
|
|
45
54
|
|
|
46
55
|
```
|
|
47
56
|
USAGE
|
|
48
|
-
$ apimatic api:transform
|
|
57
|
+
$ apimatic api:transform --format <value> [--file <value>] [--url <value>] [--destination <value>] [-f]
|
|
58
|
+
[--auth-key <value>]
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
FLAGS
|
|
51
61
|
-f, --force overwrite if same file exist in the destination
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
--file=file path to the API specification file to transform
|
|
58
|
-
|
|
59
|
-
--format=format (required) specification format to transform API specification into
|
|
62
|
+
--auth-key=<value> override current authentication state with an authentication key
|
|
63
|
+
--destination=<value> [default: ./] directory to download transformed file to
|
|
64
|
+
--file=<value> path to the API specification file to transform
|
|
65
|
+
--format=<value> (required) specification format to transform API specification into
|
|
60
66
|
APIMATIC|WADL2009|WSDL|SWAGGER10|SWAGGER20|SWAGGERYAML|OAS3|OPENAPI3YAML|APIBLUEPRINT|RAML|
|
|
61
67
|
RAML10|POSTMAN10|POSTMAN20|GRAPHQLSCHEMA
|
|
62
|
-
|
|
63
|
-
--url=url URL to the API specification file to transform. Can be used in place of the --file option
|
|
68
|
+
--url=<value> URL to the API specification file to transform. Can be used in place of the --file option
|
|
64
69
|
if the API specification is publicly available.
|
|
65
70
|
|
|
71
|
+
DESCRIPTION
|
|
72
|
+
Transform API specifications from one format to another. Supports [10+ different
|
|
73
|
+
formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman
|
|
74
|
+
Collections.
|
|
75
|
+
|
|
66
76
|
EXAMPLES
|
|
67
77
|
$ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
|
|
68
78
|
Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
|
|
@@ -71,7 +81,7 @@ EXAMPLES
|
|
|
71
81
|
Success! Your transformed file is located at D:/swagger_raml.yaml
|
|
72
82
|
```
|
|
73
83
|
|
|
74
|
-
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
84
|
+
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
|
|
75
85
|
|
|
76
86
|
## `apimatic api:validate`
|
|
77
87
|
|
|
@@ -79,14 +89,16 @@ Validate the syntactic and semantic correctness of an API specification
|
|
|
79
89
|
|
|
80
90
|
```
|
|
81
91
|
USAGE
|
|
82
|
-
$ apimatic api:validate
|
|
92
|
+
$ apimatic api:validate [--file <value>] [--url <value>] [--auth-key <value>]
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
--auth-key
|
|
86
|
-
--file
|
|
94
|
+
FLAGS
|
|
95
|
+
--auth-key=<value> override current authentication state with an authentication key
|
|
96
|
+
--file=<value> Path to the API specification file to validate
|
|
97
|
+
--url=<value> URL to the specification file to validate. Can be used in place of the --file option if the API
|
|
98
|
+
specification is publicly available.
|
|
87
99
|
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
DESCRIPTION
|
|
101
|
+
Validate the syntactic and semantic correctness of an API specification
|
|
90
102
|
|
|
91
103
|
EXAMPLES
|
|
92
104
|
$ apimatic api:validate --file="./specs/sample.json"
|
|
@@ -96,7 +108,7 @@ EXAMPLES
|
|
|
96
108
|
Specification file provided is valid
|
|
97
109
|
```
|
|
98
110
|
|
|
99
|
-
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
111
|
+
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
|
|
100
112
|
|
|
101
113
|
## `apimatic auth:login`
|
|
102
114
|
|
|
@@ -104,23 +116,25 @@ Login using your APIMatic credentials or an API Key
|
|
|
104
116
|
|
|
105
117
|
```
|
|
106
118
|
USAGE
|
|
107
|
-
$ apimatic auth:login
|
|
119
|
+
$ apimatic auth:login [--auth-key <value>]
|
|
120
|
+
|
|
121
|
+
FLAGS
|
|
122
|
+
--auth-key=<value> Set authentication key for all commands
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
|
|
124
|
+
DESCRIPTION
|
|
125
|
+
Login using your APIMatic credentials or an API Key
|
|
111
126
|
|
|
112
127
|
EXAMPLES
|
|
113
128
|
$ apimatic auth:login
|
|
114
|
-
|
|
129
|
+
Enter your registered email: apimatic-user@gmail.com
|
|
115
130
|
Please enter your password: *********
|
|
116
|
-
|
|
117
131
|
You have successfully logged into APIMatic
|
|
118
132
|
|
|
119
133
|
$ apimatic auth:login --auth-key=xxxxxx
|
|
120
134
|
Authentication key successfully set
|
|
121
135
|
```
|
|
122
136
|
|
|
123
|
-
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
137
|
+
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
|
|
124
138
|
|
|
125
139
|
## `apimatic auth:logout`
|
|
126
140
|
|
|
@@ -130,12 +144,15 @@ Clear local login credentials
|
|
|
130
144
|
USAGE
|
|
131
145
|
$ apimatic auth:logout
|
|
132
146
|
|
|
133
|
-
|
|
147
|
+
DESCRIPTION
|
|
148
|
+
Clear local login credentials
|
|
149
|
+
|
|
150
|
+
EXAMPLES
|
|
134
151
|
$ apimatic auth:logout
|
|
135
152
|
Logged out
|
|
136
153
|
```
|
|
137
154
|
|
|
138
|
-
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
155
|
+
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
|
|
139
156
|
|
|
140
157
|
## `apimatic auth:status`
|
|
141
158
|
|
|
@@ -145,27 +162,33 @@ View current authentication state
|
|
|
145
162
|
USAGE
|
|
146
163
|
$ apimatic auth:status
|
|
147
164
|
|
|
148
|
-
|
|
165
|
+
DESCRIPTION
|
|
166
|
+
View current authentication state
|
|
167
|
+
|
|
168
|
+
EXAMPLES
|
|
149
169
|
$ apimatic auth:status
|
|
150
170
|
Currently logged in as apimatic-client@gmail.com
|
|
151
171
|
```
|
|
152
172
|
|
|
153
|
-
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
173
|
+
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
|
|
154
174
|
|
|
155
175
|
## `apimatic autocomplete [SHELL]`
|
|
156
176
|
|
|
157
|
-
|
|
177
|
+
Display autocomplete installation instructions.
|
|
158
178
|
|
|
159
179
|
```
|
|
160
180
|
USAGE
|
|
161
|
-
$ apimatic autocomplete [SHELL]
|
|
181
|
+
$ apimatic autocomplete [SHELL] [-r]
|
|
162
182
|
|
|
163
183
|
ARGUMENTS
|
|
164
184
|
SHELL shell type
|
|
165
185
|
|
|
166
|
-
|
|
186
|
+
FLAGS
|
|
167
187
|
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
168
188
|
|
|
189
|
+
DESCRIPTION
|
|
190
|
+
Display autocomplete installation instructions.
|
|
191
|
+
|
|
169
192
|
EXAMPLES
|
|
170
193
|
$ apimatic autocomplete
|
|
171
194
|
$ apimatic autocomplete bash
|
|
@@ -173,74 +196,199 @@ EXAMPLES
|
|
|
173
196
|
$ apimatic autocomplete --refresh-cache
|
|
174
197
|
```
|
|
175
198
|
|
|
176
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/
|
|
199
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/main/src/commands/autocomplete/index.ts)_
|
|
177
200
|
|
|
178
201
|
## `apimatic help [COMMAND]`
|
|
179
202
|
|
|
180
|
-
|
|
203
|
+
Display help for apimatic.
|
|
181
204
|
|
|
182
205
|
```
|
|
183
206
|
USAGE
|
|
184
|
-
$ apimatic help [COMMAND]
|
|
207
|
+
$ apimatic help [COMMAND...] [-n]
|
|
185
208
|
|
|
186
209
|
ARGUMENTS
|
|
187
|
-
COMMAND
|
|
210
|
+
COMMAND... Command to show help for.
|
|
188
211
|
|
|
189
|
-
|
|
190
|
-
--
|
|
212
|
+
FLAGS
|
|
213
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
214
|
+
|
|
215
|
+
DESCRIPTION
|
|
216
|
+
Display help for apimatic.
|
|
191
217
|
```
|
|
192
218
|
|
|
193
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/
|
|
219
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
|
|
194
220
|
|
|
195
221
|
## `apimatic portal:generate`
|
|
196
222
|
|
|
197
|
-
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://
|
|
223
|
+
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
|
|
198
224
|
|
|
199
225
|
```
|
|
200
226
|
USAGE
|
|
201
|
-
$ apimatic portal:generate
|
|
227
|
+
$ apimatic portal:generate [--folder <value>] [--destination <value>] [-f] [--zip] [--auth-key <value>]
|
|
202
228
|
|
|
203
|
-
|
|
229
|
+
FLAGS
|
|
204
230
|
-f, --force overwrite if a portal exists in the destination
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
231
|
+
--auth-key=<value> override current authentication state with an authentication key
|
|
232
|
+
--destination=<value> [default: ./generated_portal] path to the downloaded portal
|
|
233
|
+
--folder=<value> [default: ./] path to the input directory containing API specifications and config files
|
|
234
|
+
--zip download the generated portal as a .zip archive
|
|
235
|
+
|
|
236
|
+
DESCRIPTION
|
|
237
|
+
Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a
|
|
238
|
+
config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platfo
|
|
239
|
+
rm-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
|
|
209
240
|
|
|
210
|
-
|
|
241
|
+
EXAMPLES
|
|
211
242
|
$ apimatic portal:generate --folder="./portal/" --destination="D:/"
|
|
212
243
|
Your portal has been generated at D:/
|
|
213
244
|
```
|
|
214
245
|
|
|
215
|
-
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
246
|
+
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
|
|
216
247
|
|
|
217
|
-
## `apimatic
|
|
248
|
+
## `apimatic portal:quickstart`
|
|
218
249
|
|
|
219
|
-
|
|
250
|
+
Create your first API Portal using APIMatic's Docs as Code offering.
|
|
220
251
|
|
|
221
252
|
```
|
|
222
253
|
USAGE
|
|
223
|
-
$ apimatic
|
|
254
|
+
$ apimatic portal:quickstart
|
|
224
255
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
256
|
+
DESCRIPTION
|
|
257
|
+
Create your first API Portal using APIMatic's Docs as Code offering.
|
|
258
|
+
|
|
259
|
+
EXAMPLES
|
|
260
|
+
$ apimatic portal:quickstart
|
|
261
|
+
```
|
|
228
262
|
|
|
229
|
-
|
|
230
|
-
generated SDK to
|
|
263
|
+
_See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/quickstart.ts)_
|
|
231
264
|
|
|
232
|
-
|
|
265
|
+
## `apimatic portal:recipe:new`
|
|
233
266
|
|
|
234
|
-
|
|
235
|
-
Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT
|
|
236
|
-
Legacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LIB|
|
|
237
|
-
JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|
|
|
238
|
-
TS_GENERIC_LIB
|
|
267
|
+
Generate an API Recipe for a static API Documentation portal.
|
|
239
268
|
|
|
240
|
-
|
|
269
|
+
```
|
|
270
|
+
USAGE
|
|
271
|
+
$ apimatic portal:recipe:new [--name <value>] [--folder <value>] [--build-config <value>]
|
|
272
|
+
|
|
273
|
+
FLAGS
|
|
274
|
+
--build-config=<value> path to the APIMATIC-BUILD.json file. Defaults to the APIMATIC-BUILD.json file in the build
|
|
275
|
+
directory if not provided.
|
|
276
|
+
--folder=<value> [default: C:\Users\Ali\Desktop\apimatic-cli] path to the build directory containing specs,
|
|
277
|
+
content, and build config file. Defaults to the current working directory if not provided.
|
|
278
|
+
--name=<value> name for the recipe
|
|
279
|
+
|
|
280
|
+
DESCRIPTION
|
|
281
|
+
Generate an API Recipe for a static API Documentation portal.
|
|
282
|
+
|
|
283
|
+
To learn more about API Recipes, visit:
|
|
284
|
+
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
|
|
285
|
+
|
|
286
|
+
EXAMPLES
|
|
287
|
+
$ apimatic portal:recipe:new --name="My API Recipe" --folder="./build-folder" --build-config-file="./build-folder/APIMATIC-BUILD.json"
|
|
288
|
+
Generated recipe has been added to build directory at: C:/build-folder/
|
|
289
|
+
|
|
290
|
+
$ apimatic portal:recipe:new
|
|
291
|
+
Generated recipe has been added to build directory at: C:/
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
_See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
|
|
295
|
+
|
|
296
|
+
## `apimatic portal:serve`
|
|
297
|
+
|
|
298
|
+
Generate and deploy a Docs as Code portal with hot reload.
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
USAGE
|
|
302
|
+
$ apimatic portal:serve [-p <value>] [-d <value>] [-s <value>] [-o] [--no-reload] [-i <value>] [--auth-key
|
|
303
|
+
<value>]
|
|
304
|
+
|
|
305
|
+
FLAGS
|
|
306
|
+
-d, --destination=<value> [default: ./generated_portal] Directory to store and serve the generated portal.
|
|
307
|
+
-i, --ignore=<value> Comma-separated list of files/directories to ignore.
|
|
308
|
+
-o, --open Open the portal in the default browser.
|
|
309
|
+
-p, --port=<value> [default: 3000] Port to serve the portal.
|
|
310
|
+
-s, --source=<value> [default: ./] Source directory containing specs, content, and build file. By default, the
|
|
311
|
+
current directory is used.
|
|
312
|
+
--auth-key=<value> Override current authentication state with an authentication key.
|
|
313
|
+
--no-reload Disable hot reload.
|
|
314
|
+
|
|
315
|
+
DESCRIPTION
|
|
316
|
+
Generate and deploy a Docs as Code portal with hot reload.
|
|
317
|
+
|
|
318
|
+
EXAMPLES
|
|
319
|
+
$ apimatic portal:serve --source="./" --destination="./generated_portal" --port=3000 --open --no-reload
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
|
|
323
|
+
|
|
324
|
+
## `apimatic portal:toc:new`
|
|
325
|
+
|
|
326
|
+
Generates a TOC file based on the content directory and spec folder provided in your working directory
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
USAGE
|
|
330
|
+
$ apimatic portal:toc:new [--destination <value>] [--folder <value>] [--force] [--expand-endpoints]
|
|
331
|
+
[--expand-models]
|
|
332
|
+
|
|
333
|
+
FLAGS
|
|
334
|
+
--destination=<value> optional path where the generated TOC file will be saved. Defaults to the current working
|
|
335
|
+
directory if not provided.
|
|
336
|
+
--expand-endpoints include individual entries for each endpoint in the generated TOC. Requires a valid API
|
|
337
|
+
specification in the working directory.
|
|
338
|
+
--expand-models include individual entries for each model in the generated TOC. Requires a valid API
|
|
339
|
+
specification in the working directory.
|
|
340
|
+
--folder=<value> [default: C:\Users\Ali\Desktop\apimatic-cli] path to the working directory containing the API
|
|
341
|
+
project files. Defaults to the current working directory if not specified.
|
|
342
|
+
--force overwrite the TOC file if one already exists at the destination.
|
|
343
|
+
|
|
344
|
+
DESCRIPTION
|
|
345
|
+
Generates a TOC file based on the content directory and spec folder provided in your working directory
|
|
346
|
+
|
|
347
|
+
This command generates a new Table of Contents (TOC) file used in the
|
|
348
|
+
generation of your API documentation portal.
|
|
349
|
+
|
|
350
|
+
The output is a YAML file with the .yml extension.
|
|
351
|
+
|
|
352
|
+
To learn more about the TOC file and APIMatic build directory structure, visit:
|
|
353
|
+
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
|
|
354
|
+
|
|
355
|
+
EXAMPLES
|
|
356
|
+
$ apimatic portal:toc:new --destination="./portal/content/"
|
|
357
|
+
A new toc file has been created at ./portal/content/toc.yml
|
|
358
|
+
|
|
359
|
+
$ apimatic portal:toc:new --folder="./my-project"
|
|
360
|
+
A new toc file has been created at ./my-project/content/toc.yml
|
|
361
|
+
|
|
362
|
+
$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/"
|
|
363
|
+
A new toc file has been created at ./portal/content/toc.yml
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
_See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
|
|
367
|
+
|
|
368
|
+
## `apimatic sdk:generate`
|
|
369
|
+
|
|
370
|
+
Generate SDK for your APIs
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
USAGE
|
|
374
|
+
$ apimatic sdk:generate --platform <value> [--file <value>] [--url <value>] [--destination <value>] [-f] [--zip]
|
|
375
|
+
[--auth-key <value>]
|
|
376
|
+
|
|
377
|
+
FLAGS
|
|
378
|
+
-f, --force overwrite if an SDK already exists in the destination
|
|
379
|
+
--auth-key=<value> override current authentication state with an authentication key
|
|
380
|
+
--destination=<value> [default: ./] directory to download the generated SDK to
|
|
381
|
+
--file=<value> path to the API specification to generate SDKs for
|
|
382
|
+
--platform=<value> (required) language platform for sdk
|
|
383
|
+
Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT|GO
|
|
384
|
+
Legacy: CS_NET_STANDARD_LIB|JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB_V2|PYTHON_GENERIC_LIB|RUBY
|
|
385
|
+
_GENERIC_LIB|TS_GENERIC_LIB|GO_GENERIC_LIB
|
|
386
|
+
--url=<value> URL to the API specification to generate SDKs for. Can be used in place of the --file
|
|
241
387
|
option if the API specification is publicly available.
|
|
388
|
+
--zip download the generated SDK as a .zip archive
|
|
242
389
|
|
|
243
|
-
|
|
390
|
+
DESCRIPTION
|
|
391
|
+
Generate SDK for your APIs
|
|
244
392
|
|
|
245
393
|
EXAMPLES
|
|
246
394
|
$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
|
|
@@ -254,5 +402,5 @@ EXAMPLES
|
|
|
254
402
|
Success! Your SDK is located at swagger_sdk_csharp
|
|
255
403
|
```
|
|
256
404
|
|
|
257
|
-
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/
|
|
405
|
+
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
|
|
258
406
|
<!-- commandsstop -->
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PortalPaths, GenerateFlags } from "../../types/portal/generate.js";
|
|
2
|
+
export declare class PortalGenerateAction {
|
|
3
|
+
private readonly prompts;
|
|
4
|
+
constructor();
|
|
5
|
+
generatePortal(paths: PortalPaths, flags: GenerateFlags, configDir: string): Promise<void>;
|
|
6
|
+
private saveGeneratedPortalStreamToZipFile;
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import fsExtra from "fs-extra";
|
|
3
|
+
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
4
|
+
import { Result } from "../../types/common/result.js";
|
|
5
|
+
import { getGeneratedFilesPaths, validateAndZipPortalSource, deleteFile, extractZipFile, getMessageInRedColor } from "../../utils/utils.js";
|
|
6
|
+
import { PortalGeneratePrompts } from "../../prompts/portal/generate.js";
|
|
7
|
+
export class PortalGenerateAction {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.prompts = new PortalGeneratePrompts();
|
|
10
|
+
}
|
|
11
|
+
async generatePortal(paths, flags, configDir) {
|
|
12
|
+
var _a;
|
|
13
|
+
this.prompts.displayPortalGenerationMessage();
|
|
14
|
+
const pathsToIgnore = getGeneratedFilesPaths(paths.sourceFolderPath, paths.generatedPortalArtifactsFolderPath);
|
|
15
|
+
//TODO: Refactor this method, carries dual responsibility.
|
|
16
|
+
const sourceBuildInputZipFilePath = await validateAndZipPortalSource(paths.sourceFolderPath, path.join(paths.sourceFolderPath, ".portal_source.zip"), pathsToIgnore);
|
|
17
|
+
const generatePortalParams = {
|
|
18
|
+
sourceBuildInputZipFilePath: sourceBuildInputZipFilePath,
|
|
19
|
+
generatedPortalArtifactsFolderPath: paths.generatedPortalArtifactsFolderPath,
|
|
20
|
+
generatedPortalArtifactsZipFilePath: paths.generatedPortalArtifactsZipFilePath,
|
|
21
|
+
overrideAuthKey: (_a = flags["auth-key"]) !== null && _a !== void 0 ? _a : null,
|
|
22
|
+
generateZipFile: flags.zip
|
|
23
|
+
};
|
|
24
|
+
const docsPortalService = new PortalService();
|
|
25
|
+
const portalGenerationResult = await docsPortalService.generateOnPremPortal(generatePortalParams, configDir);
|
|
26
|
+
await deleteFile(sourceBuildInputZipFilePath);
|
|
27
|
+
if (portalGenerationResult.isSuccess()) {
|
|
28
|
+
await this.saveGeneratedPortalStreamToZipFile(portalGenerationResult.value, paths.generatedPortalArtifactsZipFilePath);
|
|
29
|
+
if (flags.zip) {
|
|
30
|
+
this.prompts.displayPortalGenerationSuccessMessage();
|
|
31
|
+
this.prompts.displayOutroMessage(paths.generatedPortalArtifactsZipFilePath);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await extractZipFile(paths.generatedPortalArtifactsZipFilePath, paths.generatedPortalArtifactsFolderPath);
|
|
35
|
+
await deleteFile(paths.generatedPortalArtifactsZipFilePath);
|
|
36
|
+
this.prompts.displayPortalGenerationSuccessMessage();
|
|
37
|
+
this.prompts.displayOutroMessage(paths.generatedPortalArtifactsFolderPath);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.prompts.displayPortalGenerationErrorMessage();
|
|
41
|
+
this.prompts.logError(getMessageInRedColor(`${portalGenerationResult.error}`));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async saveGeneratedPortalStreamToZipFile(data, generatedPortalArtifactsZipFilePath) {
|
|
45
|
+
const writeStream = fsExtra.createWriteStream(generatedPortalArtifactsZipFilePath);
|
|
46
|
+
await new Promise((resolve, reject) => {
|
|
47
|
+
data
|
|
48
|
+
.pipe(writeStream)
|
|
49
|
+
.on("finish", () => resolve())
|
|
50
|
+
.on("error", (error) => reject(Result.failure(`Failed to save downloaded portal to file: ${error.message}`)));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/portal/generate.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Result } from "../../../types/common/result.js";
|
|
2
|
+
export declare class PortalRecipeAction {
|
|
3
|
+
private readonly prompts;
|
|
4
|
+
private readonly sdlParser;
|
|
5
|
+
private readonly BUILD_FILE_NAME;
|
|
6
|
+
constructor();
|
|
7
|
+
createRecipe(buildDirectoryPath: string, configDir: string, buildConfigFilePath?: string, name?: string): Promise<Result<string, string>>;
|
|
8
|
+
private createRecipeFileName;
|
|
9
|
+
private toPascalCase;
|
|
10
|
+
private validateBuildDirectoryPath;
|
|
11
|
+
private validateBuildConfigFilePath;
|
|
12
|
+
private promptUserAndBuildNewRecipe;
|
|
13
|
+
private promptUserAndAddContentStepToRecipe;
|
|
14
|
+
private promptUserAndAddEndpointStepToRecipe;
|
|
15
|
+
private parseTocFile;
|
|
16
|
+
private createPermalink;
|
|
17
|
+
private getResolvedBuildConfigFilePath;
|
|
18
|
+
private parseBuildConfig;
|
|
19
|
+
private checkRecipeAlreadyExists;
|
|
20
|
+
private getBuildDirectoryStructure;
|
|
21
|
+
private extractEndpointGroupsFromSdl;
|
|
22
|
+
private getSpecFolderPath;
|
|
23
|
+
private getContentFolderPath;
|
|
24
|
+
}
|