@apimatic/cli 1.0.1-alpha.3 → 1.0.1-alpha.7

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 CHANGED
@@ -19,7 +19,7 @@ $ npm install -g @apimatic/cli
19
19
  $ apimatic COMMAND
20
20
  running command...
21
21
  $ apimatic (-v|--version|version)
22
- @apimatic/cli/1.0.1-alpha.3 linux-x64 node-v14.18.1
22
+ @apimatic/cli/1.0.1-alpha.7 linux-x64 node-v16.13.0
23
23
  $ apimatic --help [COMMAND]
24
24
  USAGE
25
25
  $ apimatic COMMAND
@@ -29,100 +29,78 @@ USAGE
29
29
 
30
30
  # Commands
31
31
  <!-- commands -->
32
- * [`apimatic api`](#apimatic-api)
33
32
  * [`apimatic api:transform`](#apimatic-apitransform)
34
33
  * [`apimatic api:validate`](#apimatic-apivalidate)
35
- * [`apimatic auth`](#apimatic-auth)
36
34
  * [`apimatic auth:login`](#apimatic-authlogin)
37
35
  * [`apimatic auth:logout`](#apimatic-authlogout)
38
36
  * [`apimatic auth:status`](#apimatic-authstatus)
39
37
  * [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
40
38
  * [`apimatic help [COMMAND]`](#apimatic-help-command)
41
- * [`apimatic portal`](#apimatic-portal)
42
39
  * [`apimatic portal:generate`](#apimatic-portalgenerate)
43
- * [`apimatic sdk`](#apimatic-sdk)
44
40
  * [`apimatic sdk:generate`](#apimatic-sdkgenerate)
45
41
 
46
- ## `apimatic api`
47
-
48
- lists all commands related to the APIMatic API.
49
-
50
- ```
51
- USAGE
52
- $ apimatic api
53
-
54
- EXAMPLE
55
- $ apimatic api --help
56
- ```
57
-
58
- _See code: [src/commands/api/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/api/index.ts)_
59
-
60
42
  ## `apimatic api:transform`
61
43
 
62
- Transforms your API specification to any supported format of your choice from amongst[10+ different formats](https://www.apimatic.io/transformer/#supported-formats).
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.
63
45
 
64
46
  ```
65
47
  USAGE
66
48
  $ apimatic api:transform
67
49
 
68
50
  OPTIONS
69
- --auth-key=auth-key override current auth-key
51
+ -f, --force overwrite if same file exist in the destination
52
+ --auth-key=auth-key override current authentication state with an authentication key
70
53
 
71
- --destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli/src/commands/api] path to
72
- transformed file
54
+ --destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download
55
+ transformed file to
73
56
 
74
57
  --file=file path to the API specification file to transform
75
58
 
76
59
  --format=format (required) specification format to transform API specification into
77
- (OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WADL2006|WSDL|
78
- Swagger10|Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)
60
+ (OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WSDL|Swagger10|
61
+ Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)
79
62
 
80
- --url=url URL to the API specification file to transform
63
+ --url=url URL to the API specification file to transform. Can be used in place of the --file option
64
+ if the API specification is publicly available.
81
65
 
82
- EXAMPLE
66
+ EXAMPLES
83
67
  $ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
84
68
  Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
69
+
70
+ $ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
71
+ Success! Your transformed file is located at D:/swagger_raml.yaml
85
72
  ```
86
73
 
87
- _See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/api/transform.ts)_
74
+ _See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/api/transform.ts)_
88
75
 
89
76
  ## `apimatic api:validate`
90
77
 
91
- Validates the provided API specification file for any syntactical and semantic errors
78
+ Validate the syntactic and semantic correctness of an API specification
92
79
 
93
80
  ```
94
81
  USAGE
95
82
  $ apimatic api:validate
96
83
 
97
84
  OPTIONS
98
- --auth-key=auth-key override current auth-key
99
- --file=file path to the API specification file to validate
100
- --url=url URL to the specification file to validate
85
+ --auth-key=auth-key override current authentication state with an authentication key
86
+ --file=file Path to the API specification file to validate
101
87
 
102
- EXAMPLE
88
+ --url=url URL to the specification file to validate. Can be used in place of the --file option if the API
89
+ specification is publicly available.
90
+
91
+ EXAMPLES
103
92
  $ apimatic api:validate --file="./specs/sample.json"
104
93
  Specification file provided is valid
105
- ```
106
-
107
- _See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/api/validate.ts)_
108
-
109
- ## `apimatic auth`
110
-
111
- invokes subcommands related to authentication.
112
94
 
113
- ```
114
- USAGE
115
- $ apimatic auth
116
-
117
- EXAMPLE
118
- $ apimatic auth --help
95
+ $ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json
96
+ Specification file provided is valid
119
97
  ```
120
98
 
121
- _See code: [src/commands/auth/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/auth/index.ts)_
99
+ _See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/api/validate.ts)_
122
100
 
123
101
  ## `apimatic auth:login`
124
102
 
125
- login to your APIMatic account
103
+ Login using your APIMatic credentials or an API Key
126
104
 
127
105
  ```
128
106
  USAGE
@@ -131,19 +109,22 @@ USAGE
131
109
  OPTIONS
132
110
  --auth-key=auth-key Set authentication key for all commands
133
111
 
134
- EXAMPLE
112
+ EXAMPLES
135
113
  $ apimatic auth:login
136
114
  Please enter your registered email: apimatic-user@gmail.com
137
115
  Please enter your password: *********
138
116
 
139
117
  You have successfully logged into APIMatic
118
+
119
+ $ apimatic auth:login --auth-key=xxxxxx
120
+ Authentication key successfully set
140
121
  ```
141
122
 
142
- _See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/auth/login.ts)_
123
+ _See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/auth/login.ts)_
143
124
 
144
125
  ## `apimatic auth:logout`
145
126
 
146
- logout of APIMatic
127
+ Clear local login credentials
147
128
 
148
129
  ```
149
130
  USAGE
@@ -154,11 +135,11 @@ EXAMPLE
154
135
  Logged out
155
136
  ```
156
137
 
157
- _See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/auth/logout.ts)_
138
+ _See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/auth/logout.ts)_
158
139
 
159
140
  ## `apimatic auth:status`
160
141
 
161
- checks current logged-in account
142
+ View current authentication state
162
143
 
163
144
  ```
164
145
  USAGE
@@ -169,7 +150,7 @@ EXAMPLE
169
150
  Currently logged in as apimatic-client@gmail.com
170
151
  ```
171
152
 
172
- _See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/auth/status.ts)_
153
+ _See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/auth/status.ts)_
173
154
 
174
155
  ## `apimatic autocomplete [SHELL]`
175
156
 
@@ -209,56 +190,29 @@ OPTIONS
209
190
  --all see all commands in CLI
210
191
  ```
211
192
 
212
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.9/src/commands/help.ts)_
213
-
214
- ## `apimatic portal`
215
-
216
- invokes subcommands related to the API Portal.
217
-
218
- ```
219
- USAGE
220
- $ apimatic portal
221
-
222
- EXAMPLE
223
- $apimatic portal --help
224
- ```
225
-
226
- _See code: [src/commands/portal/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/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)_
227
194
 
228
195
  ## `apimatic portal:generate`
229
196
 
230
- Generate static docs portal on premise
197
+ Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://portal-api-docs.apimatic.io/#/http/generating-api-portal/build-file)
231
198
 
232
199
  ```
233
200
  USAGE
234
201
  $ apimatic portal:generate
235
202
 
236
203
  OPTIONS
237
- --auth-key=auth-key override current auth-key
238
- --destination=destination [default: ./] path to the downloaded portal
239
- --folder=folder folder to generate the portal with
240
- --zip zip the portal
204
+ -f, --force overwrite if a portal exists in the destination
205
+ --auth-key=auth-key override current authentication state with an authentication key
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
208
+ --zip download the generated portal as a .zip archive
241
209
 
242
210
  EXAMPLE
243
211
  $ apimatic portal:generate --folder="./portal/" --destination="D:/"
244
212
  Your portal has been generated at D:/
245
213
  ```
246
214
 
247
- _See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/portal/generate.ts)_
248
-
249
- ## `apimatic sdk`
250
-
251
- invokes subcommands related to your SDKs.
252
-
253
- ```
254
- USAGE
255
- $ apimatic sdk
256
-
257
- EXAMPLE
258
- $apimatic sdk --help
259
- ```
260
-
261
- _See code: [src/commands/sdk/index.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/sdk/index.ts)_
215
+ _See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/portal/generate.ts)_
262
216
 
263
217
  ## `apimatic sdk:generate`
264
218
 
@@ -269,9 +223,13 @@ USAGE
269
223
  $ apimatic sdk:generate
270
224
 
271
225
  OPTIONS
272
- --auth-key=auth-key override current auth-key
273
- --destination=destination [default: ./] path to downloaded SDK (used with download flag)
274
- --file=file path to the API specification to generate SDK
226
+ -f, --force overwrite if an SDK already exists in the destination
227
+ --auth-key=auth-key override current authentication state with an authentication key
228
+
229
+ --destination=destination [default: /home/runner/work/apimatic-cli/apimatic-cli/cli] directory to download the
230
+ generated SDK to
231
+
232
+ --file=file path to the API specification to generate SDKs for
275
233
 
276
234
  --platform=platform (required) language platform for sdk
277
235
  Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT
@@ -279,14 +237,21 @@ OPTIONS
279
237
  JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|
280
238
  TS_GENERIC_LIB
281
239
 
282
- --url=url URL to the API specification to generate SDK
240
+ --url=url URL to the API specification to generate SDKs for. Can be used in place of the --file
241
+ option if the API specification is publicly available.
283
242
 
284
- --zip zip the SDK (used with download flag)
243
+ --zip download the generated SDK as a .zip archive
285
244
 
286
- EXAMPLE
245
+ EXAMPLES
287
246
  $ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
288
- SDK generated successfully
247
+ Generating SDK... done
248
+ Downloading SDK... done
249
+ Success! Your SDK is located at swagger_sdk_csharp
250
+ $ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
251
+ Generating SDK... done
252
+ Downloading SDK... done
253
+ Success! Your SDK is located at swagger_sdk_csharp
289
254
  ```
290
255
 
291
- _See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.3/src/commands/sdk/generate.ts)_
256
+ _See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.0.1-alpha.7/src/commands/sdk/generate.ts)_
292
257
  <!-- commandsstop -->
@@ -1,4 +1,4 @@
1
- import { Client } from "@apimatic/js-sdk";
1
+ import { Client } from "@apimatic/sdk";
2
2
  export declare class SDKClient {
3
3
  private static instance;
4
4
  private static authAPI;
@@ -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 js_sdk_1 = require("@apimatic/js-sdk");
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 js_sdk_1.Client({
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 js_sdk_1.Client({
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 js_sdk_1 = require("@apimatic/js-sdk");
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 (fs.existsSync(destinationFilePath)) {
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 js_sdk_1.TransformationController(client);
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({
@@ -69,10 +71,13 @@ class Transform extends command_1.Command {
69
71
  }
70
72
  }
71
73
  exports.default = Transform;
72
- Transform.description = `Transforms your API specification to any supported format of your choice from amongst[10+ different formats](https://www.apimatic.io/transformer/#supported-formats).`;
74
+ 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.`;
73
75
  Transform.examples = [
74
76
  `$ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
75
77
  Success! Your transformed file is located at D:/Transformed_OpenApi3Json.json
78
+ `,
79
+ `$ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
80
+ Success! Your transformed file is located at D:/swagger_raml.yaml
76
81
  `
77
82
  ];
78
83
  Transform.flags = {
@@ -80,11 +85,23 @@ Transform.flags = {
80
85
  parse: (format) => transform_2.getValidFormat(format.toUpperCase()),
81
86
  required: true,
82
87
  description: `specification format to transform API specification into
83
- (OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WADL2006|WSDL|
84
- Swagger10|Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)`
88
+ (OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WSDL|Swagger10|
89
+ Swagger20|SwaggerYaml|RAML|RAML10|Postman10|Postman20)`
85
90
  }),
86
- file: command_1.flags.string({ default: "", description: "path to the API specification file to transform" }),
87
- url: command_1.flags.string({ default: "", description: "URL to the API specification file to transform" }),
88
- destination: command_1.flags.string({ default: __dirname, description: "path to transformed file" }),
89
- "auth-key": command_1.flags.string({ description: "override current auth-key" })
91
+ file: command_1.flags.string({
92
+ parse: (input) => path.resolve(input),
93
+ default: "",
94
+ description: "path to the API specification file to transform"
95
+ }),
96
+ url: command_1.flags.string({
97
+ default: "",
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."
99
+ }),
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" }),
106
+ "auth-key": command_1.flags.string({ description: "override current authentication state with an authentication key" })
90
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 js_sdk_1 = require("@apimatic/js-sdk");
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 js_sdk_1.APIValidationExternalApisController(client);
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
@@ -44,15 +44,21 @@ class Validate extends command_1.Command {
44
44
  }
45
45
  }
46
46
  exports.default = Validate;
47
- Validate.description = "Validates the provided API specification file for any syntactical and semantic errors";
47
+ Validate.description = "Validate the syntactic and semantic correctness of an API specification";
48
48
  Validate.examples = [
49
49
  `$ apimatic api:validate --file="./specs/sample.json"
50
50
  Specification file provided is valid
51
+ `,
52
+ `$ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json
53
+ Specification file provided is valid
51
54
  `
52
55
  ];
53
56
  Validate.flags = {
54
- file: command_1.flags.string({ default: "", description: "path to the API specification file to validate" }),
55
- url: command_1.flags.string({ default: "", description: "URL to the specification file to validate" }),
57
+ file: command_1.flags.string({ default: "", description: "Path to the API specification file to validate" }),
58
+ url: command_1.flags.string({
59
+ default: "",
60
+ description: "URL to the specification file to validate. Can be used in place of the --file option if the API specification is publicly available."
61
+ }),
56
62
  // docs: flags.boolean({ default: false, description: "Validate specification for docs generation" }), // Next tier, not included in API spec
57
- "auth-key": command_1.flags.string({ description: "override current auth-key" })
63
+ "auth-key": command_1.flags.string({ description: "override current authentication state with an authentication key" })
58
64
  };
@@ -44,14 +44,16 @@ class Login extends command_1.Command {
44
44
  }
45
45
  }
46
46
  exports.default = Login;
47
- Login.description = "login to your APIMatic account";
47
+ Login.description = "Login using your APIMatic credentials or an API Key";
48
48
  Login.examples = [
49
49
  `$ apimatic auth:login
50
50
  Please enter your registered email: apimatic-user@gmail.com
51
51
  Please enter your password: *********
52
52
 
53
53
  You have successfully logged into APIMatic
54
- `
54
+ `,
55
+ `$ apimatic auth:login --auth-key=xxxxxx
56
+ Authentication key successfully set`
55
57
  ];
56
58
  Login.flags = {
57
59
  "auth-key": command_1.flags.string({ default: "", description: "Set authentication key for all commands" })
@@ -15,7 +15,7 @@ class Login extends command_1.Command {
15
15
  }
16
16
  }
17
17
  exports.default = Login;
18
- Login.description = "logout of APIMatic";
18
+ Login.description = "Clear local login credentials";
19
19
  Login.examples = [
20
20
  `$ apimatic auth:logout
21
21
  Logged out
@@ -15,7 +15,7 @@ class Status extends command_1.Command {
15
15
  }
16
16
  }
17
17
  exports.default = Status;
18
- Status.description = "checks current logged-in account";
18
+ Status.description = "View current authentication state";
19
19
  Status.examples = [
20
20
  `$ apimatic auth:status
21
21
  Currently logged in as apimatic-client@gmail.com
@@ -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 js_sdk_1 = require("@apimatic/js-sdk");
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 portalFolderPath = flags.folder;
16
- const generatedPortalFolderPath = flags.destination;
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 js_sdk_1.DocsPortalManagementController(client);
27
- const zippedBuildFilePath = await utils_1.zipDirectory(portalFolderPath, generatedPortalFolderPath);
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
- generatedPortalFolderPath,
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 && utils_1.isJSONParsable(responseData)) {
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) {
@@ -69,22 +76,23 @@ class PortalGenerate extends command_1.Command {
69
76
  }
70
77
  }
71
78
  exports.default = PortalGenerate;
72
- PortalGenerate.description = "Generate static docs portal on premise";
79
+ PortalGenerate.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)";
73
80
  PortalGenerate.flags = {
74
81
  folder: command_1.flags.string({
75
82
  parse: (input) => path.resolve(input),
76
- default: "",
77
- description: "folder to generate the portal with"
83
+ default: "./",
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
  }),
84
- zip: command_1.flags.boolean({ default: false, description: "zip the portal" }),
91
+ force: command_1.flags.boolean({ char: "f", default: false, description: "overwrite if a portal exists in the destination" }),
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: "",
87
- description: "override current auth-key"
95
+ description: "override current authentication state with an authentication key"
88
96
  })
89
97
  };
90
98
  PortalGenerate.examples = [
@@ -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 js_sdk_1 = require("@apimatic/js-sdk");
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 js_sdk_1.CodeGenerationExternalApisController(client);
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
@@ -94,22 +95,36 @@ Legacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LI
94
95
  file: command_1.flags.string({
95
96
  parse: (input) => path.resolve(input),
96
97
  default: "",
97
- description: "path to the API specification to generate SDK"
98
+ description: "path to the API specification to generate SDKs for"
99
+ }),
100
+ url: command_1.flags.string({
101
+ default: "",
102
+ 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."
98
103
  }),
99
- url: command_1.flags.string({ default: "", description: "URL to the API specification to generate SDK" }),
100
104
  destination: command_1.flags.string({
101
105
  parse: (input) => path.resolve(input),
102
- default: "./",
103
- description: "path to downloaded SDK (used with download flag)"
106
+ default: path.resolve("./"),
107
+ description: "directory to download the generated SDK to"
108
+ }),
109
+ force: command_1.flags.boolean({
110
+ char: "f",
111
+ default: false,
112
+ description: "overwrite if an SDK already exists in the destination"
104
113
  }),
105
- zip: command_1.flags.boolean({ default: false, description: "zip the SDK (used with download flag)" }),
114
+ zip: command_1.flags.boolean({ default: false, description: "download the generated SDK as a .zip archive" }),
106
115
  "auth-key": command_1.flags.string({
107
116
  default: "",
108
- description: "override current auth-key"
117
+ description: "override current authentication state with an authentication key"
109
118
  })
110
119
  };
111
120
  SdkGenerate.examples = [
112
121
  `$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
113
- SDK generated successfully
122
+ Generating SDK... done
123
+ Downloading SDK... done
124
+ Success! Your SDK is located at swagger_sdk_csharp`,
125
+ `$ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
126
+ Generating SDK... done
127
+ Downloading SDK... done
128
+ Success! Your SDK is located at swagger_sdk_csharp
114
129
  `
115
130
  ];
@@ -1,5 +1,5 @@
1
1
  import Command from "@oclif/command";
2
- import { ApiValidationSummary, ExportFormats, Transformation, TransformationController } from "@apimatic/js-sdk";
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 js_sdk_1 = require("@apimatic/js-sdk");
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 js_sdk_1.FileWrapper(fs.createReadStream(file));
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(js_sdk_1.ExportFormats).find((exportFormat) => exportFormat === format)) {
43
- return js_sdk_1.ExportFormats[format];
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(js_sdk_1.ExportFormats).join("|");
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/js-sdk";
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, generatedPortalFolderPath, overrideAuthKey, zip }: GeneratePortalParams, configDir: string) => Promise<string>;
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, generatedPortalFolderPath, overrideAuthKey, zip }, configDir) => {
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), portalPath);
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 : portalPath;
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/js-sdk";
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 js_sdk_1 = require("@apimatic/js-sdk");
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(js_sdk_1.Platforms).includes(platform)) {
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(js_sdk_1.Platforms)).join("|");
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,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { TransformationController } from "@apimatic/js-sdk";
2
+ import { TransformationController } from "@apimatic/sdk";
3
3
  export declare type AuthenticationError = {
4
4
  statusCode: number;
5
5
  body: string;
@@ -1,7 +1,8 @@
1
- import { DocsPortalManagementController } from "@apimatic/js-sdk";
1
+ import { DocsPortalManagementController } from "@apimatic/sdk";
2
2
  export declare type GeneratePortalParams = {
3
3
  zippedBuildFilePath: string;
4
- generatedPortalFolderPath: string;
4
+ portalFolderPath: string;
5
+ zippedPortalPath: string;
5
6
  docsPortalController: DocsPortalManagementController;
6
7
  overrideAuthKey: string | null;
7
8
  zip: boolean;
@@ -1 +1 @@
1
- {"version":"1.0.1-alpha.3","commands":{"api":{"id":"api","description":"lists all commands related to the APIMatic API.","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic api --help"],"flags":{},"args":[]},"api:transform":{"id":"api:transform","description":"Transforms your API specification to any supported format of your choice from amongst[10+ different formats](https://www.apimatic.io/transformer/#supported-formats).","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"],"flags":{"format":{"name":"format","type":"option","description":"specification format to transform API specification into\n(OpenApi3Json|OpenApi3Yaml|APIMATIC|WADL2009|WADL2006|WSDL|\nSwagger10|Swagger20|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","default":""},"destination":{"name":"destination","type":"option","description":"path to transformed file","default":"/home/runner/work/apimatic-cli/apimatic-cli/cli/src/commands/api"},"auth-key":{"name":"auth-key","type":"option","description":"override current auth-key"}},"args":[]},"api:validate":{"id":"api:validate","description":"Validates the provided API specification file for any syntactical and semantic errors","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic api:validate --file=\"./specs/sample.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","default":""},"auth-key":{"name":"auth-key","type":"option","description":"override current auth-key"}},"args":[]},"auth":{"id":"auth","description":"invokes subcommands related to authentication.","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic auth --help"],"flags":{},"args":[]},"auth:login":{"id":"auth:login","description":"login to your APIMatic account","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"],"flags":{"auth-key":{"name":"auth-key","type":"option","description":"Set authentication key for all commands","default":""}},"args":[]},"auth:logout":{"id":"auth:logout","description":"logout of APIMatic","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$ apimatic auth:logout\nLogged out\n"],"flags":{},"args":[]},"auth:status":{"id":"auth:status","description":"checks current logged-in account","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 static docs portal on premise","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":"folder to generate the portal with","default":""},"destination":{"name":"destination","type":"option","description":"path to the downloaded portal","default":"./"},"zip":{"name":"zip","type":"boolean","description":"zip the portal","allowNo":false},"auth-key":{"name":"auth-key","type":"option","description":"override current auth-key","default":""}},"args":[]},"portal":{"id":"portal","description":"invokes subcommands related to the API Portal.","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$apimatic portal --help"],"flags":{},"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\"\nSDK generated successfully\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 SDK","default":""},"url":{"name":"url","type":"option","description":"URL to the API specification to generate SDK","default":""},"destination":{"name":"destination","type":"option","description":"path to downloaded SDK (used with download flag)","default":"./"},"zip":{"name":"zip","type":"boolean","description":"zip the SDK (used with download flag)","allowNo":false},"auth-key":{"name":"auth-key","type":"option","description":"override current auth-key","default":""}},"args":[]},"sdk":{"id":"sdk","description":"invokes subcommands related to your SDKs.","pluginName":"@apimatic/cli","pluginType":"core","aliases":[],"examples":["$apimatic sdk --help"],"flags":{},"args":[]}}}
1
+ {"version":"1.0.1-alpha.7","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.3",
4
+ "version": "1.0.1-alpha.7",
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/js-sdk": "^0.0.3-alpha.1",
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,20 +0,0 @@
1
- ## [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)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **sdk package:** get sdk package from npm ([4c8e178](https://github.com/apimatic/apimatic-cli/commit/4c8e1787eb21f04d81cab95b5a58e3133a61f7af))
7
-
8
- ## [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)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * **refactor:** refactor code ([d7cb486](https://github.com/apimatic/apimatic-cli/commit/d7cb4863bcfd44f297f0525e0c7eae7ecef12695))
14
-
15
- ## [1.0.1-alpha.1](https://github.com/apimatic/apimatic-cli/compare/v1.0.0...v1.0.1-alpha.1) (2021-11-26)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * **release:** add lock file to gitignore restore check_build workflow ([2eb959a](https://github.com/apimatic/apimatic-cli/commit/2eb959afc2a7ee2317959fc8525930acde2989dc))
@@ -1,6 +0,0 @@
1
- import { Command } from "@oclif/command";
2
- export default class Api extends Command {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }
@@ -1,22 +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(`lists all commands related to the APIMatic API.
7
-
8
- USAGE
9
- $ apimatic api
10
-
11
- EXAMPLE
12
- $ apimatic api --help
13
-
14
- COMMANDS
15
- api:transform Transforms your API specification to any supported format of your choice from amongst[10+ different
16
- formats](https://www.apimatic.io/transformer/#supported-formats).
17
- api:validate Validates the provided API specification file for any syntactical and semantic errors`);
18
- }
19
- }
20
- exports.default = Api;
21
- Api.description = "lists all commands related to the APIMatic API.";
22
- Api.examples = ["$ apimatic api --help"];
@@ -1,6 +0,0 @@
1
- import { Command } from "@oclif/command";
2
- export default class Auth extends Command {
3
- static description: string;
4
- static examples: string[];
5
- run: () => Promise<void>;
6
- }
@@ -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(`invokes subcommands related to authentication.
9
-
10
- USAGE
11
- $ apimatic auth
12
-
13
- EXAMPLE
14
- $ apimatic auth --help
15
-
16
- COMMANDS
17
- auth:login login to your APIMatic account
18
- auth:logout logout of APIMatic
19
- auth:status checks current logged-in account`);
20
- };
21
- }
22
- }
23
- exports.default = Auth;
24
- Auth.description = "invokes subcommands related to authentication.";
25
- Auth.examples = ["$ apimatic auth --help"];
@@ -1,6 +0,0 @@
1
- import { Command } from "@oclif/command";
2
- export default class SDK extends Command {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }
@@ -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(`invokes subcommands related to the API Portal.
7
-
8
- USAGE
9
- $ apimatic portal
10
-
11
- EXAMPLE
12
- $apimatic portal --help
13
-
14
- COMMANDS
15
- portal:generate Generate static docs portal on premise`);
16
- }
17
- }
18
- exports.default = SDK;
19
- SDK.description = "invokes subcommands related to the API Portal.";
20
- SDK.examples = ["$apimatic portal --help"];
@@ -1,6 +0,0 @@
1
- import { Command } from "@oclif/command";
2
- export default class SDK extends Command {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }
@@ -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(`invokes subcommands related to your SDKs.
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 = "invokes subcommands related to your SDKs.";
21
- SDK.examples = ["$apimatic sdk --help"];