@apimatic/cli 1.1.0-alpha.20 → 1.1.0-alpha.22
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 +119 -91
- package/lib/actions/action-result.d.ts +8 -3
- package/lib/actions/action-result.js +34 -15
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.d.ts +15 -0
- package/lib/actions/api/transform.js +48 -0
- package/lib/actions/api/transform.js.map +1 -0
- package/lib/actions/api/validate.d.ts +12 -0
- package/lib/actions/api/validate.js +41 -0
- package/lib/actions/api/validate.js.map +1 -0
- package/lib/actions/auth/login.d.ts +6 -5
- package/lib/actions/auth/login.js +25 -33
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.d.ts +8 -0
- package/lib/actions/auth/logout.js +15 -0
- package/lib/actions/auth/logout.js.map +1 -0
- package/lib/actions/auth/status.d.ts +11 -0
- package/lib/actions/auth/status.js +26 -0
- package/lib/actions/auth/status.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +7 -2
- package/lib/actions/portal/copilot.js +72 -32
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +5 -5
- package/lib/actions/portal/generate.js +33 -35
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +145 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
- package/lib/actions/portal/recipe/new-recipe.js +147 -221
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +12 -10
- package/lib/actions/portal/serve.js +112 -17
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +16 -15
- package/lib/actions/portal/toc/new-toc.js +80 -116
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +5 -6
- package/lib/actions/sdk/generate.js +22 -47
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
- package/lib/application/portal/recipe/portal-recipe.js +9 -9
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
- package/lib/application/portal/recipe/recipe-generator.js +21 -22
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +3 -4
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +6 -3
- package/lib/commands/api/transform.js +43 -91
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +6 -3
- package/lib/commands/api/validate.js +27 -60
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +15 -9
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +12 -13
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +13 -11
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +3 -2
- package/lib/commands/portal/copilot.js +23 -21
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +18 -13
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +27 -95
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +3 -1
- package/lib/commands/portal/recipe/new.js +31 -23
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +5 -5
- package/lib/commands/portal/serve.js +31 -57
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +2 -2
- package/lib/commands/portal/toc/new.js +35 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -4
- package/lib/commands/sdk/generate.js +26 -17
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/hooks/not-found.d.ts +3 -0
- package/lib/hooks/not-found.js +52 -0
- package/lib/hooks/not-found.js.map +1 -0
- package/lib/hooks/utils.d.ts +5 -0
- package/lib/hooks/utils.js +51 -0
- package/lib/hooks/utils.js.map +1 -0
- package/lib/infrastructure/api-utils.js +3 -2
- package/lib/infrastructure/api-utils.js.map +1 -1
- package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
- package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +5 -1
- package/lib/infrastructure/env-info.js +23 -2
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +7 -2
- package/lib/infrastructure/file-service.js +49 -8
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +7 -0
- package/lib/infrastructure/launcher-service.js +51 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +2 -2
- package/lib/infrastructure/services/api-service.js +8 -7
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.d.ts +1 -1
- package/lib/infrastructure/services/auth-service.js +10 -6
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.d.ts +15 -0
- package/lib/infrastructure/services/file-download-service.js +104 -0
- package/lib/infrastructure/services/file-download-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +12 -11
- package/lib/infrastructure/services/portal-service.js +77 -83
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
- package/lib/infrastructure/services/telemetry-service.js +4 -6
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.d.ts +23 -0
- package/lib/infrastructure/services/transformation-service.js +56 -0
- package/lib/infrastructure/services/transformation-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.d.ts +17 -0
- package/lib/infrastructure/services/validation-service.js +49 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -0
- package/lib/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +30 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +41 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +6 -1
- package/lib/prompts/auth/login.js +12 -3
- package/lib/prompts/auth/login.js.map +1 -1
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +21 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +33 -0
- package/lib/prompts/format.js +99 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +15 -5
- package/lib/prompts/portal/copilot.js +49 -21
- package/lib/prompts/portal/copilot.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +9 -7
- package/lib/prompts/portal/generate.js +22 -23
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +30 -29
- package/lib/prompts/portal/quickstart.js +99 -193
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
- package/lib/prompts/portal/recipe/new-recipe.js +70 -108
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +10 -3
- package/lib/prompts/portal/serve.js +30 -11
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
- package/lib/prompts/portal/toc/new-toc.js +20 -22
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +7 -7
- package/lib/prompts/sdk/generate.js +17 -23
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/types/api/account.d.ts +1 -1
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +16 -16
- package/lib/types/api/transform.js.map +1 -1
- package/lib/types/build/build.d.ts +9 -1
- package/lib/types/build/build.js +5 -2
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +5 -1
- package/lib/types/build-context.js +21 -4
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/common/command-metadata.d.ts +4 -0
- package/lib/types/common/command-metadata.js +2 -0
- package/lib/types/common/command-metadata.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +1 -1
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.d.ts +7 -0
- package/lib/types/events/quickstart-completed.js +10 -0
- package/lib/types/events/quickstart-completed.js.map +1 -0
- package/lib/types/events/quickstart-initiated.d.ts +7 -0
- package/lib/types/events/quickstart-initiated.js +10 -0
- package/lib/types/events/quickstart-initiated.js.map +1 -0
- package/lib/types/events/recipe-creation-failed.d.ts +1 -1
- package/lib/types/events/recipe-creation-failed.js +1 -1
- package/lib/types/events/recipe-creation-failed.js.map +1 -1
- package/lib/types/events/toc-creation-failed.d.ts +1 -1
- package/lib/types/events/toc-creation-failed.js +1 -1
- package/lib/types/events/toc-creation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +86 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +3 -1
- package/lib/types/file/directoryPath.js +8 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +3 -1
- package/lib/types/file/fileName.js +14 -2
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +2 -0
- package/lib/types/file/filePath.js +21 -0
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.d.ts +5 -0
- package/lib/types/file/resource-input.js +42 -0
- package/lib/types/file/resource-input.js.map +1 -0
- package/lib/types/file/urlPath.d.ts +6 -0
- package/lib/types/file/urlPath.js +22 -0
- package/lib/types/file/urlPath.js.map +1 -0
- package/lib/types/portal-context.d.ts +3 -1
- package/lib/types/portal-context.js +10 -0
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/recipe/recipe.d.ts +2 -17
- package/lib/types/recipe-context.d.ts +8 -0
- package/lib/types/recipe-context.js +21 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +2 -15
- package/lib/types/sdk/generate.js +24 -10
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +6 -5
- package/lib/types/sdk-context.js +12 -8
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +9 -0
- package/lib/types/sdl/sdl.js +46 -1
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.d.ts +3 -0
- package/lib/types/spec-context.js +7 -2
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +11 -0
- package/lib/types/temp-context.js +27 -0
- package/lib/types/temp-context.js.map +1 -0
- package/lib/types/toc-context.d.ts +12 -0
- package/lib/types/toc-context.js +26 -0
- package/lib/types/toc-context.js.map +1 -0
- package/lib/types/transform-context.d.ts +13 -0
- package/lib/types/transform-context.js +30 -0
- package/lib/types/transform-context.js.map +1 -0
- package/lib/types/utils.d.ts +0 -9
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +10 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -27
- package/lib/utils/utils.js +6 -145
- package/lib/utils/utils.js.map +1 -1
- package/package.json +11 -10
- package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
- package/lib/application/portal/serve/portal-watcher.js +0 -64
- package/lib/application/portal/serve/portal-watcher.js.map +0 -1
- package/lib/application/portal/serve/serve-handler.d.ts +0 -16
- package/lib/application/portal/serve/serve-handler.js +0 -91
- package/lib/application/portal/serve/serve-handler.js.map +0 -1
- package/lib/application/portal/serve/watcher-handler.js.map +0 -1
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
- package/lib/application/portal/toc/sdl-parser.js +0 -90
- package/lib/application/portal/toc/sdl-parser.js.map +0 -1
- package/lib/client-utils/sdk-client.d.ts +0 -22
- package/lib/client-utils/sdk-client.js +0 -89
- package/lib/client-utils/sdk-client.js.map +0 -1
- package/lib/config/env.d.ts +0 -26
- package/lib/config/env.js +0 -27
- package/lib/config/env.js.map +0 -1
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -50
- package/lib/controllers/api/transform.js.map +0 -1
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -29
- package/lib/controllers/api/validate.js.map +0 -1
- package/lib/controllers/portal/quickstart.d.ts +0 -15
- package/lib/controllers/portal/quickstart.js +0 -217
- package/lib/controllers/portal/quickstart.js.map +0 -1
- package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
- package/lib/prompts/portal/common/base-prompts.js +0 -19
- package/lib/prompts/portal/common/base-prompts.js.map +0 -1
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/api/validate.js.map +0 -1
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -32
- package/lib/types/common/result.js.map +0 -1
- package/lib/types/portal/generate.d.ts +0 -13
- package/lib/types/portal/generate.js +0 -3
- package/lib/types/portal/generate.js.map +0 -1
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -2
- package/lib/types/portal/quickstart.js.map +0 -1
- package/lib/types/portal/serve.d.ts +0 -12
- package/lib/types/portal/serve.js +0 -2
- package/lib/types/portal/serve.js.map +0 -1
- package/lib/validators/common/directoryValidator.d.ts +0 -5
- package/lib/validators/common/directoryValidator.js +0 -22
- package/lib/validators/common/directoryValidator.js.map +0 -1
- package/lib/validators/portal/serve-validator.d.ts +0 -6
- package/lib/validators/portal/serve-validator.js +0 -15
- package/lib/validators/portal/serve-validator.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ $ npm install -g @apimatic/cli
|
|
|
24
24
|
$ apimatic COMMAND
|
|
25
25
|
running command...
|
|
26
26
|
$ apimatic (--version)
|
|
27
|
-
@apimatic/cli/1.1.0-alpha.
|
|
27
|
+
@apimatic/cli/1.1.0-alpha.22 win32-x64 node-v23.4.0
|
|
28
28
|
$ apimatic --help [COMMAND]
|
|
29
29
|
USAGE
|
|
30
30
|
$ apimatic COMMAND
|
|
@@ -34,130 +34,137 @@ USAGE
|
|
|
34
34
|
|
|
35
35
|
# Commands
|
|
36
36
|
<!-- commands -->
|
|
37
|
-
* [`apimatic api
|
|
38
|
-
* [`apimatic api
|
|
39
|
-
* [`apimatic auth
|
|
40
|
-
* [`apimatic auth
|
|
41
|
-
* [`apimatic auth
|
|
37
|
+
* [`apimatic api transform`](#apimatic-api-transform)
|
|
38
|
+
* [`apimatic api validate`](#apimatic-api-validate)
|
|
39
|
+
* [`apimatic auth login`](#apimatic-auth-login)
|
|
40
|
+
* [`apimatic auth logout`](#apimatic-auth-logout)
|
|
41
|
+
* [`apimatic auth status`](#apimatic-auth-status)
|
|
42
42
|
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
|
|
43
43
|
* [`apimatic help [COMMAND]`](#apimatic-help-command)
|
|
44
|
-
* [`apimatic portal
|
|
45
|
-
* [`apimatic portal
|
|
46
|
-
* [`apimatic portal
|
|
47
|
-
* [`apimatic portal
|
|
48
|
-
* [`apimatic portal
|
|
49
|
-
* [`apimatic portal
|
|
50
|
-
* [`apimatic sdk
|
|
44
|
+
* [`apimatic portal copilot`](#apimatic-portal-copilot)
|
|
45
|
+
* [`apimatic portal generate`](#apimatic-portal-generate)
|
|
46
|
+
* [`apimatic portal quickstart`](#apimatic-portal-quickstart)
|
|
47
|
+
* [`apimatic portal recipe new`](#apimatic-portal-recipe-new)
|
|
48
|
+
* [`apimatic portal serve`](#apimatic-portal-serve)
|
|
49
|
+
* [`apimatic portal toc new`](#apimatic-portal-toc-new)
|
|
50
|
+
* [`apimatic sdk generate`](#apimatic-sdk-generate)
|
|
51
51
|
|
|
52
|
-
## `apimatic api
|
|
52
|
+
## `apimatic api transform`
|
|
53
53
|
|
|
54
|
-
Transform API specifications
|
|
54
|
+
Transform API specifications between different formats.
|
|
55
55
|
|
|
56
56
|
```
|
|
57
57
|
USAGE
|
|
58
|
-
$ apimatic api
|
|
58
|
+
$ apimatic api transform --format
|
|
59
|
+
apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apiblueprint|raml|raml10|postman10|postman2
|
|
60
|
+
0|graphqlschema [--file <value>] [--url <value>] [-d <value>] [-f] [-k <value>]
|
|
59
61
|
|
|
60
62
|
FLAGS
|
|
61
|
-
-d, --destination=<value> [default: ./] directory to
|
|
63
|
+
-d, --destination=<value> [default: ./] directory to save the transformed file to
|
|
62
64
|
-f, --force overwrite changes without asking for user consent.
|
|
63
65
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
64
66
|
--file=<value> path to the API specification file to transform
|
|
65
|
-
--format=<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
--url=<value> URL to the API specification file to transform
|
|
69
|
-
if the API specification is publicly available.
|
|
67
|
+
--format=<option> (required) specification format to transform API specification into
|
|
68
|
+
<options: apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apibluep
|
|
69
|
+
rint|raml|raml10|postman10|postman20|graphqlschema>
|
|
70
|
+
--url=<value> URL to the API specification file to transform (publicly accessible)
|
|
70
71
|
|
|
71
72
|
DESCRIPTION
|
|
72
|
-
Transform API specifications
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
Transform API specifications between different formats.
|
|
74
|
+
|
|
75
|
+
Transform API specifications from one format to another.
|
|
76
|
+
Supports multiple formats including OpenAPI/Swagger, RAML, WSDL, and Postman Collections.
|
|
75
77
|
|
|
76
78
|
EXAMPLES
|
|
77
|
-
|
|
79
|
+
apimatic api transform --format=OPENAPI3YAML --file=./specs/sample.json --destination=./
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
apimatic api transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination=./
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
|
|
83
85
|
|
|
84
|
-
## `apimatic api
|
|
86
|
+
## `apimatic api validate`
|
|
85
87
|
|
|
86
|
-
Validate
|
|
88
|
+
Validate API specification for syntactic and semantic correctness.
|
|
87
89
|
|
|
88
90
|
```
|
|
89
91
|
USAGE
|
|
90
|
-
$ apimatic api
|
|
92
|
+
$ apimatic api validate [--file <value>] [--url <value>] [-k <value>]
|
|
91
93
|
|
|
92
94
|
FLAGS
|
|
93
95
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
94
96
|
--file=<value> Path to the API specification file to validate
|
|
95
|
-
--url=<value> URL to the specification file to validate
|
|
96
|
-
API specification is publicly available.
|
|
97
|
+
--url=<value> URL to the API specification file to validate (publicly accessible)
|
|
97
98
|
|
|
98
99
|
DESCRIPTION
|
|
99
|
-
Validate
|
|
100
|
+
Validate API specification for syntactic and semantic correctness.
|
|
101
|
+
|
|
102
|
+
Validate your API specification to ensure it adheres to syntactic and semantic standards.
|
|
100
103
|
|
|
101
104
|
EXAMPLES
|
|
102
|
-
|
|
105
|
+
apimatic api validate --file=./specs/sample.json
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
apimatic api validate --url="https://petstore.swagger.io/v2/swagger.json"
|
|
105
108
|
```
|
|
106
109
|
|
|
107
110
|
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
|
|
108
111
|
|
|
109
|
-
## `apimatic auth
|
|
112
|
+
## `apimatic auth login`
|
|
110
113
|
|
|
111
|
-
Login
|
|
114
|
+
Login to your APIMatic account.
|
|
112
115
|
|
|
113
116
|
```
|
|
114
117
|
USAGE
|
|
115
|
-
$ apimatic auth
|
|
118
|
+
$ apimatic auth login [-k <value>]
|
|
116
119
|
|
|
117
120
|
FLAGS
|
|
118
121
|
-k, --auth-key=<value> Sets authentication key for all commands.
|
|
119
122
|
|
|
120
123
|
DESCRIPTION
|
|
124
|
+
Login to your APIMatic account.
|
|
125
|
+
|
|
121
126
|
Login using your APIMatic credentials or an API Key
|
|
122
127
|
|
|
123
128
|
EXAMPLES
|
|
124
|
-
|
|
129
|
+
apimatic auth login
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
apimatic auth login --auth-key={api-key}
|
|
127
132
|
```
|
|
128
133
|
|
|
129
134
|
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
|
|
130
135
|
|
|
131
|
-
## `apimatic auth
|
|
136
|
+
## `apimatic auth logout`
|
|
132
137
|
|
|
133
138
|
Clears the local login credentials.
|
|
134
139
|
|
|
135
140
|
```
|
|
136
141
|
USAGE
|
|
137
|
-
$ apimatic auth
|
|
142
|
+
$ apimatic auth logout
|
|
138
143
|
|
|
139
144
|
DESCRIPTION
|
|
140
145
|
Clears the local login credentials.
|
|
141
146
|
|
|
147
|
+
Clears the local login credentials. This will also clear any cached credentials from the CLI.
|
|
148
|
+
|
|
142
149
|
EXAMPLES
|
|
143
|
-
|
|
150
|
+
apimatic auth logout
|
|
144
151
|
```
|
|
145
152
|
|
|
146
153
|
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
|
|
147
154
|
|
|
148
|
-
## `apimatic auth
|
|
155
|
+
## `apimatic auth status`
|
|
149
156
|
|
|
150
157
|
View the currently logged in user.
|
|
151
158
|
|
|
152
159
|
```
|
|
153
160
|
USAGE
|
|
154
|
-
$ apimatic auth
|
|
161
|
+
$ apimatic auth status
|
|
155
162
|
|
|
156
163
|
DESCRIPTION
|
|
157
164
|
View the currently logged in user.
|
|
158
165
|
|
|
159
166
|
EXAMPLES
|
|
160
|
-
|
|
167
|
+
apimatic auth status
|
|
161
168
|
```
|
|
162
169
|
|
|
163
170
|
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
|
|
@@ -171,7 +178,7 @@ USAGE
|
|
|
171
178
|
$ apimatic autocomplete [SHELL] [-r]
|
|
172
179
|
|
|
173
180
|
ARGUMENTS
|
|
174
|
-
SHELL
|
|
181
|
+
SHELL (zsh|bash|powershell) Shell type
|
|
175
182
|
|
|
176
183
|
FLAGS
|
|
177
184
|
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
@@ -181,8 +188,13 @@ DESCRIPTION
|
|
|
181
188
|
|
|
182
189
|
EXAMPLES
|
|
183
190
|
$ apimatic autocomplete
|
|
191
|
+
|
|
184
192
|
$ apimatic autocomplete bash
|
|
193
|
+
|
|
185
194
|
$ apimatic autocomplete zsh
|
|
195
|
+
|
|
196
|
+
$ apimatic autocomplete powershell
|
|
197
|
+
|
|
186
198
|
$ apimatic autocomplete --refresh-cache
|
|
187
199
|
```
|
|
188
200
|
|
|
@@ -208,15 +220,16 @@ DESCRIPTION
|
|
|
208
220
|
|
|
209
221
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
|
|
210
222
|
|
|
211
|
-
## `apimatic portal
|
|
223
|
+
## `apimatic portal copilot`
|
|
212
224
|
|
|
213
225
|
Configure API Copilot for your API Documentation portal
|
|
214
226
|
|
|
215
227
|
```
|
|
216
228
|
USAGE
|
|
217
|
-
$ apimatic portal
|
|
229
|
+
$ apimatic portal copilot [-i <value>] [--disable] [-f] [-k <value>]
|
|
218
230
|
|
|
219
231
|
FLAGS
|
|
232
|
+
-f, --force overwrite changes without asking for user consent.
|
|
220
233
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
|
|
221
234
|
specifications and configuration files.
|
|
222
235
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
@@ -227,23 +240,23 @@ DESCRIPTION
|
|
|
227
240
|
|
|
228
241
|
Displays available API Copilots associated with your account and allows you to select which one to integrate with your
|
|
229
242
|
portal. Each APIMatic account includes one Copilot by default. The selected Copilot will be added to your
|
|
230
|
-
APIMATIC-BUILD.json file
|
|
243
|
+
'APIMATIC-BUILD.json' file
|
|
231
244
|
|
|
232
245
|
EXAMPLES
|
|
233
|
-
|
|
246
|
+
apimatic portal copilot --input=./
|
|
234
247
|
|
|
235
|
-
|
|
248
|
+
apimatic portal copilot --input=./ --disable
|
|
236
249
|
```
|
|
237
250
|
|
|
238
251
|
_See code: [src/commands/portal/copilot.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/copilot.ts)_
|
|
239
252
|
|
|
240
|
-
## `apimatic portal
|
|
253
|
+
## `apimatic portal generate`
|
|
241
254
|
|
|
242
|
-
Generate an API Documentation portal.
|
|
255
|
+
Generate an API Documentation portal.
|
|
243
256
|
|
|
244
257
|
```
|
|
245
258
|
USAGE
|
|
246
|
-
$ apimatic portal
|
|
259
|
+
$ apimatic portal generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
|
|
247
260
|
|
|
248
261
|
FLAGS
|
|
249
262
|
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
|
|
@@ -254,100 +267,110 @@ FLAGS
|
|
|
254
267
|
--zip download the generated portal as a .zip archive
|
|
255
268
|
|
|
256
269
|
DESCRIPTION
|
|
270
|
+
Generate an API Documentation portal.
|
|
271
|
+
|
|
257
272
|
Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and
|
|
258
273
|
optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/gu
|
|
259
274
|
ides/generating-on-prem-api-portal/build-file-reference)
|
|
260
275
|
|
|
261
276
|
EXAMPLES
|
|
262
|
-
|
|
277
|
+
apimatic portal generate
|
|
263
278
|
|
|
264
|
-
|
|
279
|
+
apimatic portal generate --input="./" --destination="./portal"
|
|
265
280
|
```
|
|
266
281
|
|
|
267
282
|
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
|
|
268
283
|
|
|
269
|
-
## `apimatic portal
|
|
284
|
+
## `apimatic portal quickstart`
|
|
270
285
|
|
|
271
|
-
|
|
286
|
+
Get started with your first API Portal in four easy steps.
|
|
272
287
|
|
|
273
288
|
```
|
|
274
289
|
USAGE
|
|
275
|
-
$ apimatic portal
|
|
290
|
+
$ apimatic portal quickstart
|
|
276
291
|
|
|
277
292
|
DESCRIPTION
|
|
293
|
+
Get started with your first API Portal in four easy steps.
|
|
294
|
+
|
|
278
295
|
Create your first API Portal using APIMatic's Docs as Code offering.
|
|
279
296
|
|
|
280
297
|
EXAMPLES
|
|
281
|
-
|
|
298
|
+
apimatic portal quickstart
|
|
282
299
|
```
|
|
283
300
|
|
|
284
301
|
_See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/quickstart.ts)_
|
|
285
302
|
|
|
286
|
-
## `apimatic portal
|
|
303
|
+
## `apimatic portal recipe new`
|
|
287
304
|
|
|
288
|
-
Add an API Recipe to your API
|
|
305
|
+
Add an API Recipe to your API documentation portal.
|
|
289
306
|
|
|
290
307
|
```
|
|
291
308
|
USAGE
|
|
292
|
-
$ apimatic portal
|
|
309
|
+
$ apimatic portal recipe new [--name <value>] [-i <value>] [-f]
|
|
293
310
|
|
|
294
311
|
FLAGS
|
|
312
|
+
-f, --force overwrite changes without asking for user consent.
|
|
295
313
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
|
|
296
314
|
specifications and configuration files.
|
|
297
315
|
--name=<value> name for the recipe
|
|
298
316
|
|
|
299
317
|
DESCRIPTION
|
|
300
|
-
Add an API Recipe to your API
|
|
318
|
+
Add an API Recipe to your API documentation portal.
|
|
319
|
+
|
|
320
|
+
This command adds a new API Recipe file to your documentation portal.
|
|
301
321
|
|
|
302
322
|
To learn more about API Recipes, visit:
|
|
303
323
|
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
|
|
304
324
|
|
|
305
325
|
EXAMPLES
|
|
306
|
-
|
|
326
|
+
apimatic portal recipe new
|
|
307
327
|
|
|
308
|
-
|
|
328
|
+
apimatic portal recipe new --name="My API Recipe" --input="./"
|
|
309
329
|
```
|
|
310
330
|
|
|
311
331
|
_See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
|
|
312
332
|
|
|
313
|
-
## `apimatic portal
|
|
333
|
+
## `apimatic portal serve`
|
|
314
334
|
|
|
315
|
-
Generate and
|
|
335
|
+
Generate and serve an API Documentation Portal with hot reload.
|
|
316
336
|
|
|
317
337
|
```
|
|
318
338
|
USAGE
|
|
319
|
-
$ apimatic portal
|
|
339
|
+
$ apimatic portal serve [-p 3000] [-i <value>] [-d <value>] [-o] [--no-reload] [-k <value>]
|
|
320
340
|
|
|
321
341
|
FLAGS
|
|
322
342
|
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
|
|
323
343
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
|
|
324
344
|
API specifications and configuration files.
|
|
325
345
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
326
|
-
-o, --open
|
|
327
|
-
-p, --port
|
|
328
|
-
--no-reload
|
|
346
|
+
-o, --open open the portal in the default browser.
|
|
347
|
+
-p, --port=3000 [default: 3000] port to serve the portal.
|
|
348
|
+
--no-reload disable hot reload.
|
|
329
349
|
|
|
330
350
|
DESCRIPTION
|
|
331
|
-
Generate and
|
|
351
|
+
Generate and serve an API Documentation Portal with hot reload.
|
|
352
|
+
|
|
353
|
+
Requires an input directory with API specifications, a config file, and optionally markdown guides. Supports disabling
|
|
354
|
+
hot reload and opening the portal in the default browser.
|
|
332
355
|
|
|
333
356
|
EXAMPLES
|
|
334
|
-
|
|
357
|
+
apimatic portal serve
|
|
335
358
|
|
|
336
|
-
|
|
359
|
+
apimatic portal serve --input=./ --destination=./portal --port=3000 --open --no-reload
|
|
337
360
|
```
|
|
338
361
|
|
|
339
362
|
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
|
|
340
363
|
|
|
341
|
-
## `apimatic portal
|
|
364
|
+
## `apimatic portal toc new`
|
|
342
365
|
|
|
343
366
|
Generate a Table of Contents (TOC) file for your API documentation portal
|
|
344
367
|
|
|
345
368
|
```
|
|
346
369
|
USAGE
|
|
347
|
-
$ apimatic portal
|
|
370
|
+
$ apimatic portal toc new [-d <value>] [-i <value>] [-f] [--expand-endpoints] [--expand-models]
|
|
348
371
|
|
|
349
372
|
FLAGS
|
|
350
|
-
-d, --destination=<value> [default: <input>/src/content] path where the
|
|
373
|
+
-d, --destination=<value> [default: <input>/src/content] path where the toc.yml will be generated.
|
|
351
374
|
-f, --force overwrite changes without asking for user consent.
|
|
352
375
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
|
|
353
376
|
API specifications and configuration files.
|
|
@@ -368,41 +391,46 @@ DESCRIPTION
|
|
|
368
391
|
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
|
|
369
392
|
|
|
370
393
|
EXAMPLES
|
|
371
|
-
|
|
394
|
+
apimatic portal toc new --destination=./src/content/
|
|
372
395
|
|
|
373
|
-
|
|
396
|
+
apimatic portal toc new --input=./
|
|
374
397
|
|
|
375
|
-
|
|
398
|
+
apimatic portal toc new --input=./ --destination=./src/content/
|
|
376
399
|
```
|
|
377
400
|
|
|
378
401
|
_See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
|
|
379
402
|
|
|
380
|
-
## `apimatic sdk
|
|
403
|
+
## `apimatic sdk generate`
|
|
381
404
|
|
|
382
405
|
Generate an SDK for your API
|
|
383
406
|
|
|
384
407
|
```
|
|
385
408
|
USAGE
|
|
386
|
-
$ apimatic sdk
|
|
387
|
-
[
|
|
409
|
+
$ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f] [--zip]
|
|
410
|
+
[-k <value>]
|
|
388
411
|
|
|
389
412
|
FLAGS
|
|
390
|
-
-d, --destination=<value>
|
|
413
|
+
-d, --destination=<value> directory where the SDK will be generated
|
|
391
414
|
-f, --force overwrite changes without asking for user consent.
|
|
392
415
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
393
|
-
|
|
416
|
+
-l, --language=<option> (required) programming language for SDK generation
|
|
394
417
|
<options: csharp|java|php|python|ruby|typescript|go>
|
|
395
|
-
--spec=<value> [default: ./src/spec] path to the folder containing the API specification file
|
|
418
|
+
--spec=<value> [default: ./src/spec] path to the folder containing the API specification file
|
|
396
419
|
--zip download the generated SDK as a .zip archive
|
|
397
420
|
|
|
398
421
|
DESCRIPTION
|
|
399
422
|
Generate an SDK for your API
|
|
400
423
|
|
|
424
|
+
Generate Software Development Kits (SDKs) from API specifications.
|
|
425
|
+
Supports multiple programming languages including Java, C#, Python, JavaScript, and more.
|
|
426
|
+
|
|
401
427
|
EXAMPLES
|
|
402
|
-
|
|
428
|
+
apimatic sdk generate --language=java
|
|
429
|
+
|
|
430
|
+
apimatic sdk generate --language=csharp --spec=./src/spec
|
|
403
431
|
|
|
404
|
-
|
|
432
|
+
apimatic sdk generate --language=python --destination=./sdk --zip
|
|
405
433
|
```
|
|
406
434
|
|
|
407
|
-
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
|
|
435
|
+
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.1.0-alpha.21/src/commands/sdk/generate.ts)_
|
|
408
436
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export declare class ActionResult {
|
|
2
2
|
private readonly message;
|
|
3
|
+
private readonly resultType;
|
|
3
4
|
private constructor();
|
|
4
|
-
static error(message: string): ActionResult;
|
|
5
5
|
static success(): ActionResult;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
static failed(): ActionResult;
|
|
7
|
+
static cancelled(): ActionResult;
|
|
8
|
+
static stopped(): ActionResult;
|
|
9
|
+
getMessage(): string;
|
|
10
|
+
getExitCode(): number;
|
|
11
|
+
isFailed(): boolean;
|
|
12
|
+
mapAll<T>(onSuccess: () => T, onFailure: () => T, onCancel: () => T): T;
|
|
8
13
|
}
|
|
@@ -1,24 +1,43 @@
|
|
|
1
|
+
var ResultType;
|
|
2
|
+
(function (ResultType) {
|
|
3
|
+
ResultType[ResultType["Success"] = 0] = "Success";
|
|
4
|
+
ResultType[ResultType["Cancel"] = 130] = "Cancel";
|
|
5
|
+
ResultType[ResultType["Failure"] = 1] = "Failure";
|
|
6
|
+
})(ResultType || (ResultType = {}));
|
|
1
7
|
export class ActionResult {
|
|
2
|
-
constructor(message) {
|
|
8
|
+
constructor(resultType, message) {
|
|
9
|
+
this.resultType = resultType;
|
|
3
10
|
this.message = message;
|
|
4
11
|
}
|
|
5
|
-
static error(message) {
|
|
6
|
-
return new ActionResult(message);
|
|
7
|
-
}
|
|
8
12
|
static success() {
|
|
9
|
-
return new ActionResult();
|
|
13
|
+
return new ActionResult(ResultType.Success, " Succeeded ");
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
onError(this.message);
|
|
14
|
-
}
|
|
15
|
+
static failed() {
|
|
16
|
+
return new ActionResult(ResultType.Failure, " Failed ");
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
static cancelled() {
|
|
19
|
+
return new ActionResult(ResultType.Cancel, " Cancelled ");
|
|
20
|
+
}
|
|
21
|
+
static stopped() {
|
|
22
|
+
return new ActionResult(ResultType.Cancel, " Stopped ");
|
|
23
|
+
}
|
|
24
|
+
getMessage() {
|
|
25
|
+
return this.message;
|
|
26
|
+
}
|
|
27
|
+
getExitCode() {
|
|
28
|
+
return this.resultType.valueOf();
|
|
29
|
+
}
|
|
30
|
+
isFailed() {
|
|
31
|
+
return this.resultType === ResultType.Failure;
|
|
32
|
+
}
|
|
33
|
+
mapAll(onSuccess, onFailure, onCancel) {
|
|
34
|
+
switch (this.resultType) {
|
|
35
|
+
case ResultType.Success:
|
|
36
|
+
return onSuccess();
|
|
37
|
+
case ResultType.Failure:
|
|
38
|
+
return onFailure();
|
|
39
|
+
case ResultType.Cancel:
|
|
40
|
+
return onCancel();
|
|
22
41
|
}
|
|
23
42
|
}
|
|
24
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,iDAAU,CAAA;IACV,iDAAY,CAAA;IACZ,iDAAU,CAAA;AACZ,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,OAAO,YAAY;IAIvB,YAAoB,UAAsB,EAAE,OAAe;QACzD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,OAAO,CAAC;IAChD,CAAC;IAEM,MAAM,CAAI,SAAkB,EAAE,SAAkB,EAAE,QAAiB;QACxE,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,MAAM;gBACpB,OAAO,QAAQ,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { ExportFormats } from "@apimatic/sdk";
|
|
4
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
5
|
+
import { ResourceInput } from "../../types/file/resource-input.js";
|
|
6
|
+
export declare class TransformAction {
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly validatePrompts;
|
|
9
|
+
private readonly transformationService;
|
|
10
|
+
private readonly configDir;
|
|
11
|
+
private readonly commandMetadata;
|
|
12
|
+
private readonly authKey;
|
|
13
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
14
|
+
readonly execute: (resourcePath: ResourceInput, format: ExportFormats, destination: DirectoryPath, force: boolean) => Promise<ActionResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { ApiTransformPrompts } from "../../prompts/api/transform.js";
|
|
3
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
4
|
+
import { TransformationService } from "../../infrastructure/services/transformation-service.js";
|
|
5
|
+
import { ApiValidatePrompts } from "../../prompts/api/validate.js";
|
|
6
|
+
import { TransformContext } from "../../types/transform-context.js";
|
|
7
|
+
import { ResourceContext } from "../../types/resource-context.js";
|
|
8
|
+
export class TransformAction {
|
|
9
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
10
|
+
this.prompts = new ApiTransformPrompts();
|
|
11
|
+
this.validatePrompts = new ApiValidatePrompts();
|
|
12
|
+
this.transformationService = new TransformationService();
|
|
13
|
+
this.execute = async (resourcePath, format, destination, force) => {
|
|
14
|
+
return await withDirPath(async (tempDirectory) => {
|
|
15
|
+
const resourceContext = new ResourceContext(tempDirectory);
|
|
16
|
+
const specFileDirResult = await resourceContext.resolveTo(resourcePath);
|
|
17
|
+
if (specFileDirResult.isErr()) {
|
|
18
|
+
this.prompts.networkError(specFileDirResult.error);
|
|
19
|
+
return ActionResult.failed();
|
|
20
|
+
}
|
|
21
|
+
const transformContext = new TransformContext(specFileDirResult.value, format, destination);
|
|
22
|
+
if (!force && (await transformContext.exists()) && !(await this.prompts.overwriteApi(destination))) {
|
|
23
|
+
this.prompts.transformedApiAlreadyExists();
|
|
24
|
+
return ActionResult.cancelled();
|
|
25
|
+
}
|
|
26
|
+
const result = await this.prompts.transformApi(this.transformationService.transformViaFile({
|
|
27
|
+
file: specFileDirResult.value,
|
|
28
|
+
format: format,
|
|
29
|
+
configDir: this.configDir,
|
|
30
|
+
commandMetadata: this.commandMetadata,
|
|
31
|
+
authKey: this.authKey
|
|
32
|
+
}));
|
|
33
|
+
if (result.isErr()) {
|
|
34
|
+
this.prompts.logTransformationError(result.error);
|
|
35
|
+
return ActionResult.failed();
|
|
36
|
+
}
|
|
37
|
+
const transformedFilePath = await transformContext.save(result.value.stream);
|
|
38
|
+
this.validatePrompts.displayValidationMessages(result.value.apiValidationSummary);
|
|
39
|
+
this.validatePrompts.transformedApiSaved(transformedFilePath);
|
|
40
|
+
return ActionResult.success();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.configDir = configDir;
|
|
44
|
+
this.commandMetadata = commandMetadata;
|
|
45
|
+
this.authKey = authKey;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/actions/api/transform.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
import { ResourceInput } from "../../types/file/resource-input.js";
|
|
5
|
+
export declare class ValidateAction {
|
|
6
|
+
private readonly prompts;
|
|
7
|
+
private readonly validationService;
|
|
8
|
+
private readonly authKey;
|
|
9
|
+
private readonly commandMetadata;
|
|
10
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
11
|
+
readonly execute: (resourcePath: ResourceInput, displayValidationSummary?: boolean) => Promise<ActionResult>;
|
|
12
|
+
}
|