@apimatic/cli 1.0.1-alpha.4 → 1.0.1-alpha.8
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 +28 -75
- package/lib/client-utils/sdk-client.d.ts +1 -1
- package/lib/client-utils/sdk-client.js +3 -3
- package/lib/commands/api/transform.d.ts +1 -0
- package/lib/commands/api/transform.js +18 -7
- package/lib/commands/api/validate.js +2 -2
- package/lib/commands/portal/generate.d.ts +1 -0
- package/lib/commands/portal/generate.js +19 -11
- package/lib/commands/sdk/generate.d.ts +1 -0
- package/lib/commands/sdk/generate.js +18 -12
- package/lib/controllers/api/transform.d.ts +1 -1
- package/lib/controllers/api/transform.js +5 -5
- package/lib/controllers/api/validate.d.ts +1 -1
- package/lib/controllers/portal/generate.d.ts +1 -1
- package/lib/controllers/portal/generate.js +3 -6
- package/lib/controllers/sdk/generate.d.ts +1 -1
- package/lib/controllers/sdk/generate.js +3 -3
- package/lib/types/api/transform.d.ts +1 -1
- package/lib/types/portal/generate.d.ts +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -27
- package/lib/commands/api/index.d.ts +0 -6
- package/lib/commands/api/index.js +0 -21
- package/lib/commands/auth/index.d.ts +0 -6
- package/lib/commands/auth/index.js +0 -25
- package/lib/commands/portal/index.d.ts +0 -6
- package/lib/commands/portal/index.js +0 -20
- package/lib/commands/sdk/index.d.ts +0 -6
- package/lib/commands/sdk/index.js +0 -21
package/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
@apimatic/cli
|
|
2
2
|
=============
|
|
3
|
+
|
|
3
4
|
The official CLI for APIMatic.
|
|
5
|
+
|
|
4
6
|
[](https://oclif.io)
|
|
5
7
|
[](https://npmjs.org/package/@apimatic/cli)
|
|
6
8
|
[](https://npmjs.org/package/@apimatic/cli)
|
|
7
9
|
[](https://github.com/apimatic/apimatic-cli/blob/master/package.json)
|
|
10
|
+
|
|
8
11
|
<!-- toc -->
|
|
9
12
|
* [Usage](#usage)
|
|
10
13
|
* [Commands](#commands)
|
|
@@ -16,43 +19,26 @@ $ npm install -g @apimatic/cli
|
|
|
16
19
|
$ apimatic COMMAND
|
|
17
20
|
running command...
|
|
18
21
|
$ apimatic (-v|--version|version)
|
|
19
|
-
@apimatic/cli/1.0.1-alpha.
|
|
22
|
+
@apimatic/cli/1.0.1-alpha.8 linux-x64 node-v16.13.0
|
|
20
23
|
$ apimatic --help [COMMAND]
|
|
21
24
|
USAGE
|
|
22
25
|
$ apimatic COMMAND
|
|
23
26
|
...
|
|
24
27
|
```
|
|
25
28
|
<!-- usagestop -->
|
|
29
|
+
|
|
26
30
|
# Commands
|
|
27
31
|
<!-- commands -->
|
|
28
|
-
* [`apimatic api`](#apimatic-api)
|
|
29
32
|
* [`apimatic api:transform`](#apimatic-apitransform)
|
|
30
33
|
* [`apimatic api:validate`](#apimatic-apivalidate)
|
|
31
|
-
* [`apimatic auth`](#apimatic-auth)
|
|
32
34
|
* [`apimatic auth:login`](#apimatic-authlogin)
|
|
33
35
|
* [`apimatic auth:logout`](#apimatic-authlogout)
|
|
34
36
|
* [`apimatic auth:status`](#apimatic-authstatus)
|
|
35
37
|
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
|
|
36
38
|
* [`apimatic help [COMMAND]`](#apimatic-help-command)
|
|
37
|
-
* [`apimatic portal`](#apimatic-portal)
|
|
38
39
|
* [`apimatic portal:generate`](#apimatic-portalgenerate)
|
|
39
|
-
* [`apimatic sdk`](#apimatic-sdk)
|
|
40
40
|
* [`apimatic sdk:generate`](#apimatic-sdkgenerate)
|
|
41
41
|
|
|
42
|
-
## `apimatic api`
|
|
43
|
-
|
|
44
|
-
Manage APIs
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
USAGE
|
|
48
|
-
$ apimatic api
|
|
49
|
-
|
|
50
|
-
EXAMPLE
|
|
51
|
-
$ apimatic api --help
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
_See code: [src/commands/api/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.4/src/commands/api/index.ts)_
|
|
55
|
-
|
|
56
42
|
## `apimatic api:transform`
|
|
57
43
|
|
|
58
44
|
Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.
|
|
@@ -62,13 +48,17 @@ USAGE
|
|
|
62
48
|
$ apimatic api:transform
|
|
63
49
|
|
|
64
50
|
OPTIONS
|
|
51
|
+
-f, --force overwrite if same file exist in the destination
|
|
65
52
|
--auth-key=auth-key override current authentication state with an authentication key
|
|
66
|
-
|
|
53
|
+
|
|
54
|
+
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download
|
|
55
|
+
transformed file to
|
|
56
|
+
|
|
67
57
|
--file=file path to the API specification file to transform
|
|
68
58
|
|
|
69
59
|
--format=format (required) specification format to transform API specification into
|
|
70
|
-
(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|
|
|
71
|
-
|
|
60
|
+
(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WSDL|Swagger10|
|
|
61
|
+
Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)
|
|
72
62
|
|
|
73
63
|
--url=url URL to the API specification file to transform. Can be used in place of the --file option
|
|
74
64
|
if the API specification is publicly available.
|
|
@@ -81,7 +71,7 @@ EXAMPLES
|
|
|
81
71
|
Success! Your transformed file is located at D:/swagger_raml.yaml
|
|
82
72
|
```
|
|
83
73
|
|
|
84
|
-
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
74
|
+
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/api/transform.ts)_
|
|
85
75
|
|
|
86
76
|
## `apimatic api:validate`
|
|
87
77
|
|
|
@@ -106,21 +96,7 @@ EXAMPLES
|
|
|
106
96
|
Specification file provided is valid
|
|
107
97
|
```
|
|
108
98
|
|
|
109
|
-
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
110
|
-
|
|
111
|
-
## `apimatic auth`
|
|
112
|
-
|
|
113
|
-
Manage this CLI's authentication state.
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
USAGE
|
|
117
|
-
$ apimatic auth
|
|
118
|
-
|
|
119
|
-
EXAMPLE
|
|
120
|
-
$ apimatic auth --help
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
_See code: [src/commands/auth/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.4/src/commands/auth/index.ts)_
|
|
99
|
+
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/api/validate.ts)_
|
|
124
100
|
|
|
125
101
|
## `apimatic auth:login`
|
|
126
102
|
|
|
@@ -144,7 +120,7 @@ EXAMPLES
|
|
|
144
120
|
Authentication key successfully set
|
|
145
121
|
```
|
|
146
122
|
|
|
147
|
-
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
123
|
+
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/auth/login.ts)_
|
|
148
124
|
|
|
149
125
|
## `apimatic auth:logout`
|
|
150
126
|
|
|
@@ -159,7 +135,7 @@ EXAMPLE
|
|
|
159
135
|
Logged out
|
|
160
136
|
```
|
|
161
137
|
|
|
162
|
-
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
138
|
+
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/auth/logout.ts)_
|
|
163
139
|
|
|
164
140
|
## `apimatic auth:status`
|
|
165
141
|
|
|
@@ -174,7 +150,7 @@ EXAMPLE
|
|
|
174
150
|
Currently logged in as apimatic-client@gmail.com
|
|
175
151
|
```
|
|
176
152
|
|
|
177
|
-
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
153
|
+
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/auth/status.ts)_
|
|
178
154
|
|
|
179
155
|
## `apimatic autocomplete [SHELL]`
|
|
180
156
|
|
|
@@ -214,21 +190,7 @@ OPTIONS
|
|
|
214
190
|
--all see all commands in CLI
|
|
215
191
|
```
|
|
216
192
|
|
|
217
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.
|
|
218
|
-
|
|
219
|
-
## `apimatic portal`
|
|
220
|
-
|
|
221
|
-
Manage API documentation portals
|
|
222
|
-
|
|
223
|
-
```
|
|
224
|
-
USAGE
|
|
225
|
-
$ apimatic portal
|
|
226
|
-
|
|
227
|
-
EXAMPLE
|
|
228
|
-
$apimatic portal --help
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
_See code: [src/commands/portal/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.4/src/commands/portal/index.ts)_
|
|
193
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.10/src/commands/help.ts)_
|
|
232
194
|
|
|
233
195
|
## `apimatic portal:generate`
|
|
234
196
|
|
|
@@ -239,9 +201,10 @@ USAGE
|
|
|
239
201
|
$ apimatic portal:generate
|
|
240
202
|
|
|
241
203
|
OPTIONS
|
|
204
|
+
-f, --force overwrite if a portal exists in the destination
|
|
242
205
|
--auth-key=auth-key override current authentication state with an authentication key
|
|
243
|
-
--destination=destination [default:
|
|
244
|
-
--folder=folder path to the input directory containing API specifications and config files
|
|
206
|
+
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] path to the downloaded portal
|
|
207
|
+
--folder=folder [default: ./] path to the input directory containing API specifications and config files
|
|
245
208
|
--zip download the generated portal as a .zip archive
|
|
246
209
|
|
|
247
210
|
EXAMPLE
|
|
@@ -249,21 +212,7 @@ EXAMPLE
|
|
|
249
212
|
Your portal has been generated at D:/
|
|
250
213
|
```
|
|
251
214
|
|
|
252
|
-
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
253
|
-
|
|
254
|
-
## `apimatic sdk`
|
|
255
|
-
|
|
256
|
-
Generate and manage SDKs for APIs
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
USAGE
|
|
260
|
-
$ apimatic sdk
|
|
261
|
-
|
|
262
|
-
EXAMPLE
|
|
263
|
-
$apimatic sdk --help
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
_See code: [src/commands/sdk/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.4/src/commands/sdk/index.ts)_
|
|
215
|
+
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/portal/generate.ts)_
|
|
267
216
|
|
|
268
217
|
## `apimatic sdk:generate`
|
|
269
218
|
|
|
@@ -274,8 +223,12 @@ USAGE
|
|
|
274
223
|
$ apimatic sdk:generate
|
|
275
224
|
|
|
276
225
|
OPTIONS
|
|
226
|
+
-f, --force overwrite if an SDK already exists in the destination
|
|
277
227
|
--auth-key=auth-key override current authentication state with an authentication key
|
|
278
|
-
|
|
228
|
+
|
|
229
|
+
--destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download the
|
|
230
|
+
generated SDK to
|
|
231
|
+
|
|
279
232
|
--file=file path to the API specification to generate SDKs for
|
|
280
233
|
|
|
281
234
|
--platform=platform (required) language platform for sdk
|
|
@@ -300,5 +253,5 @@ EXAMPLES
|
|
|
300
253
|
Success! Your SDK is located at swagger_sdk_csharp
|
|
301
254
|
```
|
|
302
255
|
|
|
303
|
-
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.
|
|
256
|
+
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.8/src/commands/sdk/generate.ts)_
|
|
304
257
|
<!-- commandsstop -->
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SDKClient = void 0;
|
|
4
4
|
const base64 = require("base-64");
|
|
5
5
|
const axios_1 = require("axios");
|
|
6
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
7
7
|
const auth_manager_1 = require("./auth-manager");
|
|
8
8
|
const env_1 = require("../config/env");
|
|
9
9
|
class SDKClient {
|
|
@@ -84,7 +84,7 @@ class SDKClient {
|
|
|
84
84
|
}
|
|
85
85
|
async getClient(overrideAuthKey, configDir) {
|
|
86
86
|
if (overrideAuthKey) {
|
|
87
|
-
return new
|
|
87
|
+
return new sdk_1.Client({
|
|
88
88
|
timeout: 0,
|
|
89
89
|
authorization: `X-Auth-Key ${overrideAuthKey}`
|
|
90
90
|
});
|
|
@@ -95,7 +95,7 @@ class SDKClient {
|
|
|
95
95
|
storedAuthInfo = { email: "", authKey: "" };
|
|
96
96
|
}
|
|
97
97
|
if (storedAuthInfo.authKey !== "") {
|
|
98
|
-
return new
|
|
98
|
+
return new sdk_1.Client({
|
|
99
99
|
timeout: 0,
|
|
100
100
|
authorization: `X-Auth-Key ${storedAuthInfo.authKey}`
|
|
101
101
|
});
|
|
@@ -7,6 +7,7 @@ export default class Transform extends Command {
|
|
|
7
7
|
file: flags.IOptionFlag<string>;
|
|
8
8
|
url: flags.IOptionFlag<string>;
|
|
9
9
|
destination: flags.IOptionFlag<string>;
|
|
10
|
+
force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
11
|
"auth-key": flags.IOptionFlag<string | undefined>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const fs = require("fs-extra");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
8
|
const sdk_client_1 = require("../../client-utils/sdk-client");
|
|
9
9
|
const utils_1 = require("../../utils/utils");
|
|
@@ -15,10 +15,12 @@ class Transform extends command_1.Command {
|
|
|
15
15
|
const fileName = flags.file ? utils_1.getFileNameFromPath(flags.file) : utils_1.getFileNameFromPath(flags.url);
|
|
16
16
|
const destinationFormat = transform_1.DestinationFormats[flags.format];
|
|
17
17
|
const destinationFilePath = path.join(flags.destination, `${fileName}_${flags.format}.${destinationFormat}`.toLowerCase());
|
|
18
|
-
if
|
|
18
|
+
// Check if destination file already exist and throw error if force flag is not set
|
|
19
|
+
if (fs.existsSync(destinationFilePath) && !flags.force) {
|
|
19
20
|
throw new Error(`Can't download transformed file to path ${destinationFilePath}, because it already exists`);
|
|
20
21
|
}
|
|
21
22
|
try {
|
|
23
|
+
// Check if paths provided are valid
|
|
22
24
|
if (flags.file && !(await fs.pathExists(flags.file))) {
|
|
23
25
|
throw new Error(`Transformation file: ${flags.file} does not exist`);
|
|
24
26
|
}
|
|
@@ -27,7 +29,7 @@ class Transform extends command_1.Command {
|
|
|
27
29
|
}
|
|
28
30
|
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
29
31
|
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
30
|
-
const transformationController = new
|
|
32
|
+
const transformationController = new sdk_1.TransformationController(client);
|
|
31
33
|
const { id, apiValidationSummary } = await transform_2.getTransformationId(flags, transformationController);
|
|
32
34
|
transform_2.printValidationMessages(apiValidationSummary, this.warn, this.error);
|
|
33
35
|
const savedTransformationFile = await transform_2.downloadTransformationFile({
|
|
@@ -83,14 +85,23 @@ Transform.flags = {
|
|
|
83
85
|
parse: (format) => transform_2.getValidFormat(format.toUpperCase()),
|
|
84
86
|
required: true,
|
|
85
87
|
description: `specification format to transform API specification into
|
|
86
|
-
(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|
|
|
87
|
-
|
|
88
|
+
(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WSDL|Swagger10|
|
|
89
|
+
Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)`
|
|
90
|
+
}),
|
|
91
|
+
file: command_1.flags.string({
|
|
92
|
+
parse: (input) => path.resolve(input),
|
|
93
|
+
default: "",
|
|
94
|
+
description: "path to the API specification file to transform"
|
|
88
95
|
}),
|
|
89
|
-
file: command_1.flags.string({ default: "", description: "path to the API specification file to transform" }),
|
|
90
96
|
url: command_1.flags.string({
|
|
91
97
|
default: "",
|
|
92
98
|
description: "URL to the API specification file to transform. Can be used in place of the --file option if the API specification is publicly available."
|
|
93
99
|
}),
|
|
94
|
-
destination: command_1.flags.string({
|
|
100
|
+
destination: command_1.flags.string({
|
|
101
|
+
parse: (input) => path.resolve(input),
|
|
102
|
+
default: path.resolve("./"),
|
|
103
|
+
description: "directory to download transformed file to"
|
|
104
|
+
}),
|
|
105
|
+
force: command_1.flags.boolean({ char: "f", default: false, description: "overwrite if same file exist in the destination" }),
|
|
95
106
|
"auth-key": command_1.flags.string({ description: "override current authentication state with an authentication key" })
|
|
96
107
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs = require("fs-extra");
|
|
4
|
-
const
|
|
4
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
6
|
const sdk_client_1 = require("../../client-utils/sdk-client");
|
|
7
7
|
const utils_1 = require("../../utils/utils");
|
|
@@ -16,7 +16,7 @@ class Validate extends command_1.Command {
|
|
|
16
16
|
}
|
|
17
17
|
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
18
18
|
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
19
|
-
const apiValidationController = new
|
|
19
|
+
const apiValidationController = new sdk_1.APIValidationExternalApisController(client);
|
|
20
20
|
const validationSummary = await validate_1.getValidation(flags, apiValidationController);
|
|
21
21
|
transform_1.printValidationMessages(validationSummary, this.warn, this.error);
|
|
22
22
|
validationSummary.success
|
|
@@ -4,6 +4,7 @@ export default class PortalGenerate extends Command {
|
|
|
4
4
|
static flags: {
|
|
5
5
|
folder: flags.IOptionFlag<string>;
|
|
6
6
|
destination: flags.IOptionFlag<string>;
|
|
7
|
+
force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
7
8
|
zip: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
8
9
|
"auth-key": flags.IOptionFlag<string>;
|
|
9
10
|
};
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs = require("fs-extra");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
5
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
8
7
|
const sdk_client_1 = require("../../client-utils/sdk-client");
|
|
9
8
|
const generate_1 = require("../../controllers/portal/generate");
|
|
10
9
|
const utils_1 = require("../../utils/utils");
|
|
@@ -12,9 +11,17 @@ class PortalGenerate extends command_1.Command {
|
|
|
12
11
|
async run() {
|
|
13
12
|
const { flags } = this.parse(PortalGenerate);
|
|
14
13
|
const zip = flags.zip;
|
|
15
|
-
const
|
|
16
|
-
const
|
|
14
|
+
const sourceFolderPath = flags.folder;
|
|
15
|
+
const portalFolderPath = path.join(flags.destination, "generated_portal");
|
|
16
|
+
const zippedPortalPath = path.join(flags.destination, "generated_portal.zip");
|
|
17
17
|
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
18
|
+
// Check if at destination, portal already exists and throw error if force flag is not set for both zip and extracted
|
|
19
|
+
if (fs.existsSync(portalFolderPath) && !flags.force && !zip) {
|
|
20
|
+
throw new Error(`Can't download portal to path ${portalFolderPath}, because it already exists`);
|
|
21
|
+
}
|
|
22
|
+
else if (fs.existsSync(zippedPortalPath) && !flags.force && zip) {
|
|
23
|
+
throw new Error(`Can't download portal to path ${zippedPortalPath}, because it already exists`);
|
|
24
|
+
}
|
|
18
25
|
try {
|
|
19
26
|
if (!(await fs.pathExists(flags.destination))) {
|
|
20
27
|
throw new Error(`Destination path ${flags.destination} does not exist`);
|
|
@@ -23,11 +30,12 @@ class PortalGenerate extends command_1.Command {
|
|
|
23
30
|
throw new Error(`Portal build folder ${flags.folder} does not exist`);
|
|
24
31
|
}
|
|
25
32
|
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
26
|
-
const docsPortalController = new
|
|
27
|
-
const zippedBuildFilePath = await utils_1.zipDirectory(
|
|
33
|
+
const docsPortalController = new sdk_1.DocsPortalManagementController(client);
|
|
34
|
+
const zippedBuildFilePath = await utils_1.zipDirectory(sourceFolderPath, flags.destination);
|
|
28
35
|
const generatePortalParams = {
|
|
29
36
|
zippedBuildFilePath,
|
|
30
|
-
|
|
37
|
+
portalFolderPath,
|
|
38
|
+
zippedPortalPath,
|
|
31
39
|
docsPortalController,
|
|
32
40
|
overrideAuthKey,
|
|
33
41
|
zip
|
|
@@ -36,7 +44,6 @@ class PortalGenerate extends command_1.Command {
|
|
|
36
44
|
this.log(`Your portal has been generated at ${generatedPortalPath}`);
|
|
37
45
|
}
|
|
38
46
|
catch (error) {
|
|
39
|
-
cli_ux_1.default.action.stop();
|
|
40
47
|
if (error && error.response) {
|
|
41
48
|
const apiError = error;
|
|
42
49
|
const apiResponse = apiError.response;
|
|
@@ -51,7 +58,7 @@ class PortalGenerate extends command_1.Command {
|
|
|
51
58
|
return this.error(utils_1.replaceHTML(nestedErrors.message));
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
|
-
else if (apiResponse.status === 401 && responseData.length > 0
|
|
61
|
+
else if (apiResponse.status === 401 && responseData.length > 0) {
|
|
55
62
|
this.error(utils_1.replaceHTML(responseData));
|
|
56
63
|
}
|
|
57
64
|
else if (apiResponse.status === 403 && apiResponse.statusText) {
|
|
@@ -73,14 +80,15 @@ PortalGenerate.description = "Generate and download a static API Documentation p
|
|
|
73
80
|
PortalGenerate.flags = {
|
|
74
81
|
folder: command_1.flags.string({
|
|
75
82
|
parse: (input) => path.resolve(input),
|
|
76
|
-
default: "",
|
|
83
|
+
default: "./",
|
|
77
84
|
description: "path to the input directory containing API specifications and config files"
|
|
78
85
|
}),
|
|
79
86
|
destination: command_1.flags.string({
|
|
80
87
|
parse: (input) => path.resolve(input),
|
|
81
|
-
default: "./",
|
|
88
|
+
default: path.resolve("./"),
|
|
82
89
|
description: "path to the downloaded portal"
|
|
83
90
|
}),
|
|
91
|
+
force: command_1.flags.boolean({ char: "f", default: false, description: "overwrite if a portal exists in the destination" }),
|
|
84
92
|
zip: command_1.flags.boolean({ default: false, description: "download the generated portal as a .zip archive" }),
|
|
85
93
|
"auth-key": command_1.flags.string({
|
|
86
94
|
default: "",
|
|
@@ -6,6 +6,7 @@ export default class SdkGenerate extends Command {
|
|
|
6
6
|
file: flags.IOptionFlag<string>;
|
|
7
7
|
url: flags.IOptionFlag<string>;
|
|
8
8
|
destination: flags.IOptionFlag<string>;
|
|
9
|
+
force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
10
|
zip: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
11
|
"auth-key": flags.IOptionFlag<string>;
|
|
11
12
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const fs = require("fs-extra");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
8
|
const sdk_client_1 = require("../../client-utils/sdk-client");
|
|
9
9
|
const utils_1 = require("../../utils/utils");
|
|
@@ -12,6 +12,16 @@ class SdkGenerate extends command_1.Command {
|
|
|
12
12
|
async run() {
|
|
13
13
|
const { flags } = this.parse(SdkGenerate);
|
|
14
14
|
const zip = flags.zip;
|
|
15
|
+
const fileName = flags.file ? utils_1.getFileNameFromPath(flags.file) : utils_1.getFileNameFromPath(flags.url);
|
|
16
|
+
const sdkFolderPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}`.toLowerCase());
|
|
17
|
+
const zippedSDKPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}.zip`.toLowerCase());
|
|
18
|
+
// Check if at destination, SDK already exists and throw error if force flag is not set for both zip and extracted
|
|
19
|
+
if (fs.existsSync(sdkFolderPath) && !flags.force && !zip) {
|
|
20
|
+
throw new Error(`Can't download SDK to path ${sdkFolderPath}, because it already exists`);
|
|
21
|
+
}
|
|
22
|
+
else if (fs.existsSync(zippedSDKPath) && !flags.force && zip) {
|
|
23
|
+
throw new Error(`Can't download SDK to path ${zippedSDKPath}, because it already exists`);
|
|
24
|
+
}
|
|
15
25
|
try {
|
|
16
26
|
if (!(await fs.pathExists(path.resolve(flags.destination)))) {
|
|
17
27
|
throw new Error(`Destination path ${flags.destination} does not exist`);
|
|
@@ -19,18 +29,9 @@ class SdkGenerate extends command_1.Command {
|
|
|
19
29
|
else if (!(await fs.pathExists(path.resolve(flags.file)))) {
|
|
20
30
|
throw new Error(`Specification file ${flags.file} does not exist`);
|
|
21
31
|
}
|
|
22
|
-
const fileName = flags.file ? utils_1.getFileNameFromPath(flags.file) : utils_1.getFileNameFromPath(flags.url);
|
|
23
|
-
const sdkFolderPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}`.toLowerCase());
|
|
24
|
-
const zippedSDKPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}.zip`.toLowerCase());
|
|
25
|
-
if (fs.existsSync(zippedSDKPath) && zip) {
|
|
26
|
-
throw new Error(`Can't generate SDK to path ${zippedSDKPath}, because it already exists`);
|
|
27
|
-
}
|
|
28
|
-
else if (fs.existsSync(sdkFolderPath) && !zip) {
|
|
29
|
-
throw new Error(`Can't generate SDK to path ${sdkFolderPath}, because it already exists`);
|
|
30
|
-
}
|
|
31
32
|
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
32
33
|
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
33
|
-
const sdkGenerationController = new
|
|
34
|
+
const sdkGenerationController = new sdk_1.CodeGenerationExternalApisController(client);
|
|
34
35
|
// Get generation id for the specification and platform
|
|
35
36
|
const codeGenId = await generate_1.getSDKGenerationId(flags, sdkGenerationController);
|
|
36
37
|
// If user wanted to download the SDK as well
|
|
@@ -102,9 +103,14 @@ Legacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LI
|
|
|
102
103
|
}),
|
|
103
104
|
destination: command_1.flags.string({
|
|
104
105
|
parse: (input) => path.resolve(input),
|
|
105
|
-
default: "./",
|
|
106
|
+
default: path.resolve("./"),
|
|
106
107
|
description: "directory to download the generated SDK to"
|
|
107
108
|
}),
|
|
109
|
+
force: command_1.flags.boolean({
|
|
110
|
+
char: "f",
|
|
111
|
+
default: false,
|
|
112
|
+
description: "overwrite if an SDK already exists in the destination"
|
|
113
|
+
}),
|
|
108
114
|
zip: command_1.flags.boolean({ default: false, description: "download the generated SDK as a .zip archive" }),
|
|
109
115
|
"auth-key": command_1.flags.string({
|
|
110
116
|
default: "",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Command from "@oclif/command";
|
|
2
|
-
import { ApiValidationSummary, ExportFormats, Transformation, TransformationController } from "@apimatic/
|
|
2
|
+
import { ApiValidationSummary, ExportFormats, Transformation, TransformationController } from "@apimatic/sdk";
|
|
3
3
|
import { DownloadTransformationParams, TransformationIdParams } from "../../types/api/transform";
|
|
4
4
|
export declare const getTransformationId: ({ file, url, format }: TransformationIdParams, transformationController: TransformationController) => Promise<Transformation>;
|
|
5
5
|
export declare const downloadTransformationFile: ({ id, destinationFilePath, transformationController }: DownloadTransformationParams) => Promise<string>;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.printValidationMessages = exports.getValidFormat = exports.downloadTransformationFile = exports.getTransformationId = void 0;
|
|
4
4
|
const cli_ux_1 = require("cli-ux");
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
7
7
|
const utils_1 = require("../../utils/utils");
|
|
8
8
|
exports.getTransformationId = async ({ file, url, format }, transformationController) => {
|
|
9
9
|
cli_ux_1.default.action.start("Transforming API specification");
|
|
10
10
|
let generation;
|
|
11
11
|
if (file) {
|
|
12
|
-
const fileDescriptor = new
|
|
12
|
+
const fileDescriptor = new sdk_1.FileWrapper(fs.createReadStream(file));
|
|
13
13
|
generation = await transformationController.transformViaFile(fileDescriptor, format);
|
|
14
14
|
}
|
|
15
15
|
else if (url) {
|
|
@@ -39,11 +39,11 @@ exports.downloadTransformationFile = async ({ id, destinationFilePath, transform
|
|
|
39
39
|
};
|
|
40
40
|
// Get valid platform from user's input, convert simple platform to valid Platforms enum value
|
|
41
41
|
exports.getValidFormat = (format) => {
|
|
42
|
-
if (Object.keys(
|
|
43
|
-
return
|
|
42
|
+
if (Object.keys(sdk_1.ExportFormats).find((exportFormat) => exportFormat === format)) {
|
|
43
|
+
return sdk_1.ExportFormats[format];
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
const formats = Object.keys(
|
|
46
|
+
const formats = Object.keys(sdk_1.ExportFormats).join("|");
|
|
47
47
|
throw new Error(`Please provide a valid platform i.e. ${formats}`);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Command from "@oclif/command";
|
|
2
|
-
import { APIValidationExternalApisController, ApiValidationSummary } from "@apimatic/
|
|
2
|
+
import { APIValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
|
|
3
3
|
import { GetValidationParams } from "../../types/api/validate";
|
|
4
4
|
export declare const getValidation: ({ file, url }: GetValidationParams, apiValidationController: APIValidationExternalApisController) => Promise<ApiValidationSummary>;
|
|
5
5
|
export declare const printValidationMessages: ({ warnings, errors }: ApiValidationSummary, warn: Command["warn"], error: Command["error"]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GeneratePortalParams } from "../../types/portal/generate";
|
|
2
|
-
export declare const downloadDocsPortal: ({ zippedBuildFilePath,
|
|
2
|
+
export declare const downloadDocsPortal: ({ zippedBuildFilePath, portalFolderPath, zippedPortalPath, overrideAuthKey, zip }: GeneratePortalParams, configDir: string) => Promise<string>;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.downloadDocsPortal = void 0;
|
|
4
4
|
const fs = require("fs-extra");
|
|
5
5
|
const FormData = require("form-data");
|
|
6
|
-
const path = require("path");
|
|
7
6
|
const cli_ux_1 = require("cli-ux");
|
|
8
7
|
const auth_manager_1 = require("../../client-utils/auth-manager");
|
|
9
8
|
const env_1 = require("../../config/env");
|
|
@@ -22,9 +21,7 @@ const downloadPortalAxios = async (zippedBuildFilePath, overrideAuthKey, configD
|
|
|
22
21
|
return data;
|
|
23
22
|
};
|
|
24
23
|
// Download Docs Portal
|
|
25
|
-
exports.downloadDocsPortal = async ({ zippedBuildFilePath,
|
|
26
|
-
const zippedPortalPath = path.join(generatedPortalFolderPath, "generated_portal.zip");
|
|
27
|
-
const portalPath = path.join(generatedPortalFolderPath, "generated_portal");
|
|
24
|
+
exports.downloadDocsPortal = async ({ zippedBuildFilePath, portalFolderPath, zippedPortalPath, overrideAuthKey, zip }, configDir) => {
|
|
28
25
|
cli_ux_1.default.action.start("Downloading portal");
|
|
29
26
|
// Check if the build file exists for the user or not
|
|
30
27
|
if (!(await fs.pathExists(zippedBuildFilePath))) {
|
|
@@ -41,11 +38,11 @@ exports.downloadDocsPortal = async ({ zippedBuildFilePath, generatedPortalFolder
|
|
|
41
38
|
// if ((data as NodeJS.ReadableStream).readable) {
|
|
42
39
|
// await writeFileUsingReadableStream(data as NodeJS.ReadableStream, zippedPortalPath);
|
|
43
40
|
if (!zip) {
|
|
44
|
-
await utils_1.unzipFile(fs.createReadStream(zippedPortalPath),
|
|
41
|
+
await utils_1.unzipFile(fs.createReadStream(zippedPortalPath), portalFolderPath);
|
|
45
42
|
await utils_1.deleteFile(zippedPortalPath);
|
|
46
43
|
}
|
|
47
44
|
cli_ux_1.default.action.stop();
|
|
48
|
-
return zip ? zippedPortalPath :
|
|
45
|
+
return zip ? zippedPortalPath : portalFolderPath;
|
|
49
46
|
// } else {
|
|
50
47
|
// throw new Error("Couldn't download the portal");
|
|
51
48
|
// }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeGenerationExternalApisController } from "@apimatic/
|
|
1
|
+
import { CodeGenerationExternalApisController } from "@apimatic/sdk";
|
|
2
2
|
import { GenerationIdParams, DownloadSDKParams } from "../../types/sdk/generate";
|
|
3
3
|
export declare const getSDKGenerationId: ({ file, url, platform }: GenerationIdParams, sdkGenerationController: CodeGenerationExternalApisController) => Promise<string>;
|
|
4
4
|
export declare const downloadGeneratedSDK: ({ codeGenId, zippedSDKPath, sdkFolderPath, zip }: DownloadSDKParams, sdkGenerationController: CodeGenerationExternalApisController) => Promise<string>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.downloadGeneratedSDK = exports.getSDKGenerationId = void 0;
|
|
4
4
|
const fs = require("fs-extra");
|
|
5
5
|
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const
|
|
6
|
+
const sdk_1 = require("@apimatic/sdk");
|
|
7
7
|
const core_1 = require("@apimatic/core");
|
|
8
8
|
const generate_1 = require("../../types/sdk/generate");
|
|
9
9
|
const utils_1 = require("../../utils/utils");
|
|
@@ -34,11 +34,11 @@ const getSDKPlatform = (platform) => {
|
|
|
34
34
|
if (Object.keys(generate_1.SimplePlatforms).includes(platform)) {
|
|
35
35
|
return generate_1.SimplePlatforms[platform];
|
|
36
36
|
}
|
|
37
|
-
else if (Object.values(
|
|
37
|
+
else if (Object.values(sdk_1.Platforms).includes(platform)) {
|
|
38
38
|
return platform;
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
const platforms = Object.keys(generate_1.SimplePlatforms).concat(Object.values(
|
|
41
|
+
const platforms = Object.keys(generate_1.SimplePlatforms).concat(Object.values(sdk_1.Platforms)).join("|");
|
|
42
42
|
throw new Error(`Please provide a valid platform i.e. ${platforms}`);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DocsPortalManagementController } from "@apimatic/
|
|
1
|
+
import { DocsPortalManagementController } from "@apimatic/sdk";
|
|
2
2
|
export declare type GeneratePortalParams = {
|
|
3
3
|
zippedBuildFilePath: string;
|
|
4
|
-
|
|
4
|
+
portalFolderPath: string;
|
|
5
|
+
zippedPortalPath: string;
|
|
5
6
|
docsPortalController: DocsPortalManagementController;
|
|
6
7
|
overrideAuthKey: string | null;
|
|
7
8
|
zip: boolean;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.1-alpha.
|
|
1
|
+
{"version":"1.0.1-alpha.8","commands":{"api:transform":{"id":"api:transform","description":"Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic api:transform --format=\"OpenApi3Json\" --file=\"./specs/sample.json\" --destination=\"D:/\"\nSuccess! Your transformed file is located at D:/Transformed_OpenApi3Json.json\n","$ apimatic api:transform --format=RAML --url=\"https://petstore.swagger.io/v2/swagger.json\" --destination=\"D:/\"\nSuccess! Your transformed file is located at D:/swagger_raml.yaml\n"],"flags":{"format":{"name":"format","type":"option","description":"specification format to transform API specification into\n(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WSDL|Swagger10|\nSwagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)","required":true},"file":{"name":"file","type":"option","description":"path to the API specification file to transform","default":""},"url":{"name":"url","type":"option","description":"URL to the API specification file to transform. Can be used in place of the --file option if the API specification is publicly available.","default":""},"destination":{"name":"destination","type":"option","description":"directory to download transformed file to","default":"/home/runner/work/apimatic-cli/apimatic-cli/cli"},"force":{"name":"force","type":"boolean","char":"f","description":"overwrite if same file exist in the destination","allowNo":false},"auth-key":{"name":"auth-key","type":"option","description":"override current authentication state with an authentication key"}},"args":[]},"api:validate":{"id":"api:validate","description":"Validate the syntactic and semantic correctness of an API specification","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic api:validate --file=\"./specs/sample.json\"\nSpecification file provided is valid\n","$ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json\nSpecification file provided is valid\n"],"flags":{"file":{"name":"file","type":"option","description":"Path to the API specification file to validate","default":""},"url":{"name":"url","type":"option","description":"URL to the specification file to validate. Can be used in place of the --file option if the API specification is publicly available.","default":""},"auth-key":{"name":"auth-key","type":"option","description":"override current authentication state with an authentication key"}},"args":[]},"auth:login":{"id":"auth:login","description":"Login using your APIMatic credentials or an API Key","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic auth:login\nPlease enter your registered email: apimatic-user@gmail.com\nPlease enter your password: *********\n\nYou have successfully logged into APIMatic\n","$ apimatic auth:login --auth-key=xxxxxx\nAuthentication key successfully set"],"flags":{"auth-key":{"name":"auth-key","type":"option","description":"Set authentication key for all commands","default":""}},"args":[]},"auth:logout":{"id":"auth:logout","description":"Clear local login credentials","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic auth:logout\nLogged out\n"],"flags":{},"args":[]},"auth:status":{"id":"auth:status","description":"View current authentication state","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic auth:status\nCurrently logged in as apimatic-client@gmail.com\n"],"flags":{},"args":[]},"portal:generate":{"id":"portal:generate","description":"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://portal-api-docs.apimatic.io/#/http/generating-api-portal/build-file)","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic portal:generate --folder=\"./portal/\" --destination=\"D:/\"\nYour portal has been generated at D:/\n"],"flags":{"folder":{"name":"folder","type":"option","description":"path to the input directory containing API specifications and config files","default":"./"},"destination":{"name":"destination","type":"option","description":"path to the downloaded portal","default":"/home/runner/work/apimatic-cli/apimatic-cli/cli"},"force":{"name":"force","type":"boolean","char":"f","description":"overwrite if a portal exists in the destination","allowNo":false},"zip":{"name":"zip","type":"boolean","description":"download the generated portal as a .zip archive","allowNo":false},"auth-key":{"name":"auth-key","type":"option","description":"override current authentication state with an authentication key","default":""}},"args":[]},"sdk:generate":{"id":"sdk:generate","description":"Generate SDK for your APIs","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic sdk:generate --platform=\"CSHARP\" --file=\"./specs/sample.json\"\nGenerating SDK... done\nDownloading SDK... done\nSuccess! Your SDK is located at swagger_sdk_csharp","$ apimatic sdk:generate --platform=\"CSHARP\" --url=https://petstore.swagger.io/v2/swagger.json\nGenerating SDK... done\nDownloading SDK... done\nSuccess! Your SDK is located at swagger_sdk_csharp\n"],"flags":{"platform":{"name":"platform","type":"option","description":"language platform for sdk\nSimple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT\nLegacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LIB|\n JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|\n TS_GENERIC_LIB","required":true},"file":{"name":"file","type":"option","description":"path to the API specification to generate SDKs for","default":""},"url":{"name":"url","type":"option","description":"URL to the API specification to generate SDKs for. Can be used in place of the --file option if the API specification is publicly available.","default":""},"destination":{"name":"destination","type":"option","description":"directory to download the generated SDK to","default":"/home/runner/work/apimatic-cli/apimatic-cli/cli"},"force":{"name":"force","type":"boolean","char":"f","description":"overwrite if an SDK already exists in the destination","allowNo":false},"zip":{"name":"zip","type":"boolean","description":"download the generated SDK as a .zip archive","allowNo":false},"auth-key":{"name":"auth-key","type":"option","description":"override current authentication state with an authentication key","default":""}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apimatic/cli",
|
|
3
3
|
"description": "The official CLI for APIMatic.",
|
|
4
|
-
"version": "1.0.1-alpha.
|
|
4
|
+
"version": "1.0.1-alpha.8",
|
|
5
5
|
"author": "APIMatic",
|
|
6
6
|
"bin": {
|
|
7
7
|
"apimatic": "./bin/run"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"lint:fix": "eslint --fix \"src/**/*.{js,ts}\" --quiet"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@apimatic/
|
|
48
|
+
"@apimatic/sdk": "^0.0.1-alpha.1",
|
|
49
49
|
"@oclif/command": "^1.8.0",
|
|
50
50
|
"@oclif/config": "^1.17.0",
|
|
51
51
|
"@oclif/plugin-autocomplete": "^0.3.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
## [1.0.1-alpha.4](https://github.com/apimatic/apimatic-cli/compare/v1.0.1-alpha.3...v1.0.1-alpha.4) (2021-12-01)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* **documentation:** improve messages for each command ([a2c0bfb](https://github.com/apimatic/apimatic-cli/commit/a2c0bfbd5c1867302cf27170dc3b2d3ca5bd64ca))
|
|
7
|
-
|
|
8
|
-
## [1.0.1-alpha.3](https://github.com/apimatic/apimatic-cli/compare/v1.0.1-alpha.2...v1.0.1-alpha.3) (2021-12-01)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* **sdk package:** get sdk package from npm ([4c8e178](https://github.com/apimatic/apimatic-cli/commit/4c8e1787eb21f04d81cab95b5a58e3133a61f7af))
|
|
14
|
-
|
|
15
|
-
## [1.0.1-alpha.2](https://github.com/apimatic/apimatic-cli/compare/v1.0.1-alpha.1...v1.0.1-alpha.2) (2021-11-30)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Bug Fixes
|
|
19
|
-
|
|
20
|
-
* **refactor:** refactor code ([d7cb486](https://github.com/apimatic/apimatic-cli/commit/d7cb4863bcfd44f297f0525e0c7eae7ecef12695))
|
|
21
|
-
|
|
22
|
-
## [1.0.1-alpha.1](https://github.com/apimatic/apimatic-cli/compare/v1.0.0...v1.0.1-alpha.1) (2021-11-26)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
* **release:** add lock file to gitignore restore check_build workflow ([2eb959a](https://github.com/apimatic/apimatic-cli/commit/2eb959afc2a7ee2317959fc8525930acde2989dc))
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
class Api extends command_1.Command {
|
|
5
|
-
async run() {
|
|
6
|
-
this.log(`Manage APIs
|
|
7
|
-
|
|
8
|
-
USAGE
|
|
9
|
-
$ apimatic api
|
|
10
|
-
|
|
11
|
-
EXAMPLE
|
|
12
|
-
$ apimatic api --help
|
|
13
|
-
|
|
14
|
-
COMMANDS
|
|
15
|
-
api:transform Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.
|
|
16
|
-
api:validate Validate the syntactic and semantic correctness of an API specification`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = Api;
|
|
20
|
-
Api.description = "Manage APIs";
|
|
21
|
-
Api.examples = ["$ apimatic api --help"];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
class Auth extends command_1.Command {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.run = async () => {
|
|
8
|
-
this.log(`Manage this CLI's authentication state.
|
|
9
|
-
|
|
10
|
-
USAGE
|
|
11
|
-
$ apimatic auth
|
|
12
|
-
|
|
13
|
-
EXAMPLE
|
|
14
|
-
$ apimatic auth --help
|
|
15
|
-
|
|
16
|
-
COMMANDS
|
|
17
|
-
auth:login Login using your APIMatic credentials or an API Key
|
|
18
|
-
auth:logout Clear local login credentials
|
|
19
|
-
auth:status View current authentication state`);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.default = Auth;
|
|
24
|
-
Auth.description = "Manage this CLI's authentication state.";
|
|
25
|
-
Auth.examples = ["$ apimatic auth --help"];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
class SDK extends command_1.Command {
|
|
5
|
-
async run() {
|
|
6
|
-
this.log(`Manage API documentation portals
|
|
7
|
-
|
|
8
|
-
USAGE
|
|
9
|
-
$ apimatic portal
|
|
10
|
-
|
|
11
|
-
EXAMPLE
|
|
12
|
-
$apimatic portal --help
|
|
13
|
-
|
|
14
|
-
COMMANDS
|
|
15
|
-
portal:generate 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://portal-api-docs.apimatic.io/#/http/generating-api-portal/build-file)`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.default = SDK;
|
|
19
|
-
SDK.description = "Manage API documentation portals";
|
|
20
|
-
SDK.examples = ["$apimatic portal --help"];
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
class SDK extends command_1.Command {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
6
|
-
async run() {
|
|
7
|
-
this.log(`Generate and manage SDKs for APIs
|
|
8
|
-
|
|
9
|
-
USAGE
|
|
10
|
-
$ apimatic sdk
|
|
11
|
-
|
|
12
|
-
EXAMPLE
|
|
13
|
-
$apimatic sdk --help
|
|
14
|
-
|
|
15
|
-
COMMANDS
|
|
16
|
-
sdk:generate Generate SDK for your APIs`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = SDK;
|
|
20
|
-
SDK.description = "Generate and manage SDKs for APIs";
|
|
21
|
-
SDK.examples = ["$apimatic sdk --help"];
|