Skip to content

Commit e172aa8

Browse files
saeedjamshaidsohail2721aliasghar98Shield-Jaguar
authored
feat: update input directory structure for most commands and device login flow (#134)
* ehnancement(apimatic-cli): Internal Team CLI Testing Feedback (#111) Co-authored-by: saeedjamshaid <saeed.jamshaid@outlook.com> * fix: improves portal serve structure and resolves watcher issues on regeneration (#113) * feat: add folder structure for generate command (#116) * feat: add api error handling in new portal generation code (#117) * feat: adds build directory structure to recipe and toc commands (#119) Covers the following changes: Adds the build directory structure to the recipe and toc commands. Improves messaging across the portal commands. Removed --build-config flag from portal:recipe:new command. Minor bug fixes in portal generate, serve and quickstart commands * chore: update readme (#124) * feat: adds telemetry to cli (#125) * feat: enable copilot config (#126) * feat(sdk:generate): update flags and working directory behavior (#130) * fix(apimatic-cli): Resolved issue where paths with quotes caused error (#129) * fix(apimatic-cli): Resolved issue where paths with quotes caused error * Fixed recipe:new path issue * Removed nullable cleaned path * fix: add debounce delay to portal watcher for serve (#127) --------- Co-authored-by: saeedjamshaid <saeed.jamshaid@outlook.com> * feat: add device login flow (#131) * feat: updated folder and build flag names to input and src (#133) * fix(sdk): fix issue with sdk response handling (#132) --------- Co-authored-by: Muhammad Sohail <62895181+sohail2721@users.noreply.github.com> Co-authored-by: Ali Asghar <75574550+aliasghar98@users.noreply.github.com> Co-authored-by: Mujahid Daud Khan <37825767+Shield-Jaguar@users.noreply.github.com>
1 parent 6410d0c commit e172aa8

59 files changed

Lines changed: 1515 additions & 742 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 92 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ USAGE
4141
* [`apimatic auth:status`](#apimatic-authstatus)
4242
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
4343
* [`apimatic help [COMMAND]`](#apimatic-help-command)
44+
* [`apimatic portal:copilot`](#apimatic-portalcopilot)
4445
* [`apimatic portal:generate`](#apimatic-portalgenerate)
4546
* [`apimatic portal:quickstart`](#apimatic-portalquickstart)
4647
* [`apimatic portal:recipe:new`](#apimatic-portalrecipenew)
@@ -54,13 +55,12 @@ Transform API specifications from one format to another. Supports [10+ different
5455

5556
```
5657
USAGE
57-
$ apimatic api:transform --format <value> [--file <value>] [--url <value>] [--destination <value>] [-f]
58-
[--auth-key <value>]
58+
$ apimatic api:transform --format <value> [--file <value>] [--url <value>] [-d <value>] [-f] [-k <value>]
5959
6060
FLAGS
61-
-f, --force overwrite if same file exist in the destination
62-
--auth-key=<value> override current authentication state with an authentication key
63-
--destination=<value> [default: ./] directory to download transformed file to
61+
-d, --destination=<value> [default: ./] directory to download transformed file to
62+
-f, --force overwrite changes without asking for user consent.
63+
-k, --auth-key=<value> override current authentication state with an authentication key.
6464
--file=<value> path to the API specification file to transform
6565
--format=<value> (required) specification format to transform API specification into
6666
APIMATIC|WADL2009|WSDL|SWAGGER10|SWAGGER20|SWAGGERYAML|OAS3|OPENAPI3YAML|APIBLUEPRINT|RAML|
@@ -87,13 +87,13 @@ Validate the syntactic and semantic correctness of an API specification
8787

8888
```
8989
USAGE
90-
$ apimatic api:validate [--file <value>] [--url <value>] [--auth-key <value>]
90+
$ apimatic api:validate [--file <value>] [--url <value>] [-k <value>]
9191
9292
FLAGS
93-
--auth-key=<value> override current authentication state with an authentication key
94-
--file=<value> Path to the API specification file to validate
95-
--url=<value> URL to the specification file to validate. Can be used in place of the --file option if the API
96-
specification is publicly available.
93+
-k, --auth-key=<value> override current authentication state with an authentication key.
94+
--file=<value> Path to the API specification file to validate
95+
--url=<value> URL to the specification file to validate. Can be used in place of the --file option if the
96+
API specification is publicly available.
9797
9898
DESCRIPTION
9999
Validate the syntactic and semantic correctness of an API specification
@@ -112,32 +112,32 @@ Login using your APIMatic credentials or an API Key
112112

113113
```
114114
USAGE
115-
$ apimatic auth:login [--auth-key <value>]
115+
$ apimatic auth:login [-k <value>]
116116
117117
FLAGS
118-
--auth-key=<value> Set authentication key for all commands
118+
-k, --auth-key=<value> Sets authentication key for all commands.
119119
120120
DESCRIPTION
121121
Login using your APIMatic credentials or an API Key
122122
123123
EXAMPLES
124124
$ apimatic auth:login
125125
126-
$ apimatic auth:login --auth-key=xxxxxx
126+
$ apimatic auth:login --auth-key={api-key}
127127
```
128128

129129
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
130130

131131
## `apimatic auth:logout`
132132

133-
Clear local login credentials
133+
Clears the local login credentials.
134134

135135
```
136136
USAGE
137137
$ apimatic auth:logout
138138
139139
DESCRIPTION
140-
Clear local login credentials
140+
Clears the local login credentials.
141141
142142
EXAMPLES
143143
$ apimatic auth:logout
@@ -147,14 +147,14 @@ _See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cl
147147

148148
## `apimatic auth:status`
149149

150-
View current authentication state
150+
View the currently logged in user.
151151

152152
```
153153
USAGE
154154
$ apimatic auth:status
155155
156156
DESCRIPTION
157-
View current authentication state
157+
View the currently logged in user.
158158
159159
EXAMPLES
160160
$ apimatic auth:status
@@ -208,20 +208,46 @@ DESCRIPTION
208208

209209
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
210210

211+
## `apimatic portal:copilot`
212+
213+
Adds the API Copilot configuration in APIMATIC-BUILD.json
214+
215+
```
216+
USAGE
217+
$ apimatic portal:copilot [-i <value>] [-m <value>] [--disable] [-k <value>]
218+
219+
FLAGS
220+
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which
221+
includes API specifications and configuration files.
222+
-k, --auth-key=<value> override current authentication state with an authentication key.
223+
-m, --welcome-message=<value> welcome message for the API copilot
224+
--disable marks the API Copilot as disabled in the configuration
225+
226+
DESCRIPTION
227+
Adds the API Copilot configuration in APIMATIC-BUILD.json
228+
229+
EXAMPLES
230+
$ apimatic portal:copilot --input="./" --welcome-message="Welcome to our API!"
231+
232+
$ apimatic portal:copilot --input="./"
233+
```
234+
235+
_See code: [src/commands/portal/copilot.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/copilot.ts)_
236+
211237
## `apimatic portal:generate`
212238

213239
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)
214240

215241
```
216242
USAGE
217-
$ apimatic portal:generate [--folder <value>] [--destination <value>] [-f] [--zip] [--auth-key <value>]
243+
$ apimatic portal:generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
218244
219245
FLAGS
220-
-f, --force overwrite if a portal exists in the destination
221-
--auth-key=<value> override current authentication state with an authentication key
222-
--destination=<value> [default: <folder>/portal] path to the generated portal
223-
--folder=<value> [default: ./] path to the parent directory containing the 'build' folder,
224-
which includes API specifications and configuration files.
246+
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
247+
-f, --force overwrite changes without asking for user consent.
248+
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
249+
API specifications and configuration files.
250+
-k, --auth-key=<value> override current authentication state with an authentication key.
225251
--zip download the generated portal as a .zip archive
226252
227253
DESCRIPTION
@@ -230,7 +256,9 @@ DESCRIPTION
230256
rm-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
231257
232258
EXAMPLES
233-
$ apimatic portal:generate --folder="./portal/" --destination="D:/"
259+
$ apimatic portal:generate
260+
261+
$ apimatic portal:generate --input="./" --destination="./portal"
234262
```
235263

236264
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
@@ -258,12 +286,12 @@ Generate an API Recipe for a static API Documentation portal.
258286

259287
```
260288
USAGE
261-
$ apimatic portal:recipe:new [--name <value>] [--folder <value>]
289+
$ apimatic portal:recipe:new [--name <value>] [-i <value>]
262290
263291
FLAGS
264-
--folder=<value> [default: ./] path to the parent directory containing the
265-
'build' folder, which includes API specifications and configuration files.
266-
--name=<value> name for the recipe
292+
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
293+
specifications and configuration files.
294+
--name=<value> name for the recipe
267295
268296
DESCRIPTION
269297
Generate an API Recipe for a static API Documentation portal.
@@ -272,9 +300,9 @@ DESCRIPTION
272300
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
273301
274302
EXAMPLES
275-
$ apimatic portal:recipe:new --name="My API Recipe" --folder="./build-folder"
276-
277303
$ apimatic portal:recipe:new
304+
305+
$ apimatic portal:recipe:new --name="My API Recipe" --input="./"
278306
```
279307

280308
_See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
@@ -285,25 +313,26 @@ Generate and deploy a Docs as Code portal with hot reload.
285313

286314
```
287315
USAGE
288-
$ apimatic portal:serve [-p <value>] [-destination <value>] [--folder <value>] [-o] [--no-reload] [-i <value>] [--auth-key
289-
<value>]
316+
$ apimatic portal:serve [-p <value>] [-i <value>] [-d <value>] [-o] [--no-reload] [-i <value>] [-k <value>]
290317
291318
FLAGS
319+
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
292320
-i, --ignore=<value> Comma-separated list of file and directory paths to exclude from portal generation and hot
293321
reload.
322+
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
323+
API specifications and configuration files.
324+
-k, --auth-key=<value> override current authentication state with an authentication key.
294325
-o, --open Open the portal in the default browser.
295-
-p, --port=<value> Port to serve the portal.
296-
--auth-key=<value> Override current authentication state with an authentication key.
297-
--folder=<value> [default: ./] Path to the parent directory containing the 'build' folder,
298-
which includes API specifications and configuration files.
299-
--destination=<value> [default: <folder>/portal] Path to the generated portal.
326+
-p, --port=<value> [default: 3000] port to serve the portal.
300327
--no-reload Disable hot reload.
301328
302329
DESCRIPTION
303330
Generate and deploy a Docs as Code portal with hot reload.
304331
305332
EXAMPLES
306-
$ apimatic portal:serve --folder="./" --destination="./portal" --port=3000 --open --no-reload
333+
$ apimatic portal:serve
334+
335+
$ apimatic portal:serve --input="./" --destination="./portal" --port=3000 --open --no-reload
307336
```
308337

309338
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
@@ -314,18 +343,17 @@ Generates a TOC file based on the content directory and spec folder provided in
314343

315344
```
316345
USAGE
317-
$ apimatic portal:toc:new [--destination <value>] [--folder <value>] [--force] [--expand-endpoints]
318-
[--expand-models]
346+
$ apimatic portal:toc:new [-d <value>] [-i <value>] [-f] [--expand-endpoints] [--expand-models]
319347
320348
FLAGS
321-
--destination=<value> [default: <folder>/build/content] optional path where the generated toc.yml file will be saved.
322-
--expand-endpoints include individual entries for each endpoint in the generated toc.yml. Requires a valid API
323-
specification in the working directory.
324-
--expand-models include individual entries for each model in the generated toc.yml. Requires a valid API
325-
specification in the working directory.
326-
--folder=<value> [default: ./] Path to the parent directory containing the 'build' folder,
327-
which includes API specifications and configuration files.
328-
--force overwrite the toc.yml file if one already exists at the destination.
349+
-d, --destination=<value> [default: <input>/src/content] path where the 'toc.yml' will be generated.
350+
-f, --force overwrite changes without asking for user consent.
351+
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
352+
API specifications and configuration files.
353+
--expand-endpoints include individual entries for each endpoint in the generated 'toc.yml'. Requires a valid
354+
API specification in the working directory.
355+
--expand-models include individual entries for each model in the generated 'toc.yml'. Requires a valid API
356+
specification in the working directory.
329357
330358
DESCRIPTION
331359
Generates a TOC file based on the content directory and spec folder provided in your working directory
@@ -339,45 +367,41 @@ DESCRIPTION
339367
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
340368
341369
EXAMPLES
342-
$ apimatic portal:toc:new --destination="./portal/content/"
370+
$ apimatic portal:toc:new --destination="./src/content/"
343371
344-
$ apimatic portal:toc:new --folder="./my-project"
372+
$ apimatic portal:toc:new --input="./"
345373
346-
$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/"
374+
$ apimatic portal:toc:new --input="./" --destination="./src/content/"
347375
```
348376

349377
_See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
350378

351379
## `apimatic sdk:generate`
352380

353-
Generate SDK for your APIs
381+
Generates SDK for your API
354382

355383
```
356384
USAGE
357-
$ apimatic sdk:generate --platform <value> [--file <value>] [--url <value>] [--destination <value>] [-f] [--zip]
358-
[--auth-key <value>]
385+
$ apimatic sdk:generate --platform csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f]
386+
[--zip] [-k <value>]
359387
360388
FLAGS
361-
-f, --force overwrite if an SDK already exists in the destination
362-
--auth-key=<value> override current authentication state with an authentication key
363-
--destination=<value> [default: ./] directory to download the generated SDK to
364-
--file=<value> path to the API specification to generate SDKs for
365-
--platform=<value> (required) language platform for sdk
366-
Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT|GO
367-
Legacy: CS_NET_STANDARD_LIB|JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB_V2|PYTHON_GENERIC_LIB|RUBY
368-
_GENERIC_LIB|TS_GENERIC_LIB|GO_GENERIC_LIB
369-
--url=<value> URL to the API specification to generate SDKs for. Can be used in place of the --file
370-
option if the API specification is publicly available.
389+
-d, --destination=<value> [default: <input>/sdk] path where the sdk will be generated.
390+
-f, --force overwrite changes without asking for user consent.
391+
-k, --auth-key=<value> override current authentication state with an authentication key.
392+
--platform=<option> (required) language platform for sdk
393+
<options: csharp|java|php|python|ruby|typescript|go>
394+
--spec=<value> [default: ./src/spec] path to the folder containing the API specification file.
371395
--zip download the generated SDK as a .zip archive
372396
373397
DESCRIPTION
374-
Generate SDK for your APIs
398+
Generates SDK for your API
375399
376400
EXAMPLES
377-
$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
401+
$ apimatic sdk:generate --platform="java"
378402
379-
$ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
403+
$ apimatic sdk:generate --platform="csharp" --spec="./src/spec"
380404
```
381405

382406
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
383-
<!-- commandsstop -->
407+
<!-- commandsstop -->

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default [
1111
ecmaVersion: 2021,
1212
sourceType: "module",
1313
globals: {
14+
process: "readonly",
1415
NodeJS: true,
1516
},
1617
},
@@ -27,4 +28,4 @@ export default [
2728
"node_modules"
2829
]
2930
},
30-
];
31+
];

0 commit comments

Comments
 (0)