@apimatic/cli 1.0.1-alpha.1
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/CHANGELOG.md +6 -0
- package/README.md +292 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/lib/client-utils/auth-manager.d.ts +17 -0
- package/lib/client-utils/auth-manager.js +33 -0
- package/lib/client-utils/sdk-client.d.ts +23 -0
- package/lib/client-utils/sdk-client.js +119 -0
- package/lib/commands/api/index.d.ts +6 -0
- package/lib/commands/api/index.js +22 -0
- package/lib/commands/api/transform.d.ts +15 -0
- package/lib/commands/api/transform.js +157 -0
- package/lib/commands/api/validate.d.ts +13 -0
- package/lib/commands/api/validate.js +85 -0
- package/lib/commands/auth/index.d.ts +6 -0
- package/lib/commands/auth/index.js +25 -0
- package/lib/commands/auth/login.d.ts +9 -0
- package/lib/commands/auth/login.js +58 -0
- package/lib/commands/auth/logout.d.ts +6 -0
- package/lib/commands/auth/logout.js +23 -0
- package/lib/commands/auth/status.d.ts +6 -0
- package/lib/commands/auth/status.js +23 -0
- package/lib/commands/portal/generate.d.ts +23 -0
- package/lib/commands/portal/generate.js +141 -0
- package/lib/commands/portal/index.d.ts +6 -0
- package/lib/commands/portal/index.js +20 -0
- package/lib/commands/sdk/generate.d.ts +14 -0
- package/lib/commands/sdk/generate.js +178 -0
- package/lib/commands/sdk/index.d.ts +6 -0
- package/lib/commands/sdk/index.js +21 -0
- package/lib/config/env.d.ts +1 -0
- package/lib/config/env.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/utils/utils.d.ts +18 -0
- package/lib/utils/utils.js +107 -0
- package/oclif.manifest.json +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("fs-extra");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const cli_ux_1 = require("cli-ux");
|
|
6
|
+
const apimatic_sdk_for_js_1 = require("@apimatic/apimatic-sdk-for-js");
|
|
7
|
+
const command_1 = require("@oclif/command");
|
|
8
|
+
const sdk_client_1 = require("../../client-utils/sdk-client");
|
|
9
|
+
const utils_1 = require("../../utils/utils");
|
|
10
|
+
var SimplePlatforms;
|
|
11
|
+
(function (SimplePlatforms) {
|
|
12
|
+
SimplePlatforms["CSHARP"] = "CS_NET_STANDARD_LIB";
|
|
13
|
+
SimplePlatforms["JAVA"] = "JAVA_ECLIPSE_JRE_LIB";
|
|
14
|
+
SimplePlatforms["PHP"] = "PHP_GENERIC_LIB";
|
|
15
|
+
SimplePlatforms["PYTHON"] = "PYTHON_GENERIC_LIB";
|
|
16
|
+
SimplePlatforms["RUBY"] = "RUBY_GENERIC_LIB";
|
|
17
|
+
SimplePlatforms["TYPESCRIPT"] = "TS_GENERIC_LIB";
|
|
18
|
+
})(SimplePlatforms || (SimplePlatforms = {}));
|
|
19
|
+
async function getSDKGenerationId({ file, url, platform }, sdkGenerationController) {
|
|
20
|
+
cli_ux_1.default.action.start("Generating SDK");
|
|
21
|
+
let generation;
|
|
22
|
+
const sdkPlatform = getSDKPlatform(platform);
|
|
23
|
+
if (file) {
|
|
24
|
+
const fileDescriptor = new apimatic_sdk_for_js_1.FileWrapper(fs.createReadStream(file));
|
|
25
|
+
generation = await sdkGenerationController.generateSDKViaFile(fileDescriptor, sdkPlatform);
|
|
26
|
+
}
|
|
27
|
+
else if (url) {
|
|
28
|
+
// If url to spec file is provided
|
|
29
|
+
const body = {
|
|
30
|
+
url: url,
|
|
31
|
+
template: sdkPlatform
|
|
32
|
+
};
|
|
33
|
+
generation = await sdkGenerationController.generateSDKViaURL(body);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new Error("Please provide a specification file");
|
|
37
|
+
}
|
|
38
|
+
cli_ux_1.default.action.stop();
|
|
39
|
+
return generation.result.id;
|
|
40
|
+
}
|
|
41
|
+
// Get valid platform from user's input, convert simple platform to valid Platforms enum value
|
|
42
|
+
function getSDKPlatform(platform) {
|
|
43
|
+
if (Object.keys(SimplePlatforms).includes(platform)) {
|
|
44
|
+
return SimplePlatforms[platform];
|
|
45
|
+
}
|
|
46
|
+
else if (Object.values(apimatic_sdk_for_js_1.Platforms).includes(platform)) {
|
|
47
|
+
return platform;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const platforms = Object.keys(SimplePlatforms).concat(Object.values(apimatic_sdk_for_js_1.Platforms)).join("|");
|
|
51
|
+
throw new Error(`Please provide a valid platform i.e. ${platforms}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Download Platform
|
|
55
|
+
async function downloadGeneratedSDK({ codeGenId, zippedSDKPath, sdkFolderPath, zip }, sdkGenerationController) {
|
|
56
|
+
cli_ux_1.default.action.start("Downloading SDK");
|
|
57
|
+
const { result } = await sdkGenerationController.downloadSDK(codeGenId);
|
|
58
|
+
if (result.readable) {
|
|
59
|
+
if (!zip) {
|
|
60
|
+
await utils_1.unzipFile(result, sdkFolderPath);
|
|
61
|
+
cli_ux_1.default.action.stop();
|
|
62
|
+
return sdkFolderPath;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
await utils_1.writeFileUsingReadableStream(result, zippedSDKPath);
|
|
66
|
+
cli_ux_1.default.action.stop();
|
|
67
|
+
return zippedSDKPath;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
throw new Error("Couldn't download the SDK");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class SdkGenerate extends command_1.Command {
|
|
75
|
+
async run() {
|
|
76
|
+
const { flags } = this.parse(SdkGenerate);
|
|
77
|
+
const zip = flags.zip;
|
|
78
|
+
try {
|
|
79
|
+
if (!(await fs.pathExists(path.resolve(flags.destination)))) {
|
|
80
|
+
throw new Error(`Destination path ${flags.destination} does not exist`);
|
|
81
|
+
}
|
|
82
|
+
else if (!(await fs.pathExists(path.resolve(flags.file)))) {
|
|
83
|
+
throw new Error(`Specification file ${flags.file} does not exist`);
|
|
84
|
+
}
|
|
85
|
+
const fileName = flags.file ? utils_1.getFileNameFromPath(flags.file) : utils_1.getFileNameFromPath(flags.url);
|
|
86
|
+
const sdkFolderPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}`.toLowerCase());
|
|
87
|
+
const zippedSDKPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}.zip`.toLowerCase());
|
|
88
|
+
if (fs.existsSync(zippedSDKPath) && zip) {
|
|
89
|
+
throw new Error(`Can't generate SDK to path ${zippedSDKPath}, because it already exists`);
|
|
90
|
+
}
|
|
91
|
+
else if (fs.existsSync(sdkFolderPath) && !zip) {
|
|
92
|
+
throw new Error(`Can't generate SDK to path ${sdkFolderPath}, because it already exists`);
|
|
93
|
+
}
|
|
94
|
+
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
95
|
+
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
96
|
+
const sdkGenerationController = new apimatic_sdk_for_js_1.CodeGenerationExternalApisController(client);
|
|
97
|
+
// Get generation id for the specification and platform
|
|
98
|
+
const codeGenId = await getSDKGenerationId(flags, sdkGenerationController);
|
|
99
|
+
// If user wanted to download the SDK as well
|
|
100
|
+
const sdkDownloadParams = {
|
|
101
|
+
codeGenId,
|
|
102
|
+
zippedSDKPath,
|
|
103
|
+
sdkFolderPath,
|
|
104
|
+
zip
|
|
105
|
+
};
|
|
106
|
+
const sdkPath = await downloadGeneratedSDK(sdkDownloadParams, sdkGenerationController);
|
|
107
|
+
this.log(`Success! Your SDK is located at ${sdkPath}`);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
cli_ux_1.default.action.stop();
|
|
111
|
+
if (error.result) {
|
|
112
|
+
const apiError = error;
|
|
113
|
+
const result = apiError.result;
|
|
114
|
+
if (apiError.statusCode === 400 && utils_1.isJSONParsable(result.message)) {
|
|
115
|
+
const errors = JSON.parse(result.message);
|
|
116
|
+
if (Array.isArray(errors.Errors) && apiError.statusCode === 400) {
|
|
117
|
+
this.error(utils_1.replaceHTML(`${JSON.parse(result.message).Errors[0]}`));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (apiError.statusCode === 401 && apiError.body && typeof apiError.body === "string") {
|
|
121
|
+
this.error(apiError.body);
|
|
122
|
+
}
|
|
123
|
+
else if (apiError.statusCode === 500 &&
|
|
124
|
+
apiError.body &&
|
|
125
|
+
typeof apiError.body === "string" &&
|
|
126
|
+
utils_1.isJSONParsable(apiError.body)) {
|
|
127
|
+
this.error(JSON.parse(apiError.body).message);
|
|
128
|
+
}
|
|
129
|
+
else if (apiError.statusCode === 422 &&
|
|
130
|
+
apiError.body &&
|
|
131
|
+
typeof apiError.body === "string" &&
|
|
132
|
+
utils_1.isJSONParsable(apiError.body)) {
|
|
133
|
+
this.error(JSON.parse(apiError.body)["dto.Url"][0]);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.error(utils_1.replaceHTML(result.message));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.error(`${error.message}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.default = SdkGenerate;
|
|
146
|
+
SdkGenerate.description = "Generate SDK for your APIs";
|
|
147
|
+
SdkGenerate.flags = {
|
|
148
|
+
platform: command_1.flags.string({
|
|
149
|
+
parse: (input) => input.toUpperCase(),
|
|
150
|
+
required: true,
|
|
151
|
+
description: `language platform for sdk
|
|
152
|
+
Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT
|
|
153
|
+
Legacy: CS_NET_STANDARD_LIB|CS_PORTABLE_NET_LIB|CS_UNIVERSAL_WINDOWS_PLATFORM_LIB|
|
|
154
|
+
JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|
|
|
155
|
+
TS_GENERIC_LIB`
|
|
156
|
+
}),
|
|
157
|
+
file: command_1.flags.string({
|
|
158
|
+
parse: (input) => path.resolve(input),
|
|
159
|
+
default: "",
|
|
160
|
+
description: "path to the API specification to generate SDK"
|
|
161
|
+
}),
|
|
162
|
+
url: command_1.flags.string({ default: "", description: "URL to the API specification to generate SDK" }),
|
|
163
|
+
destination: command_1.flags.string({
|
|
164
|
+
parse: (input) => path.resolve(input),
|
|
165
|
+
default: "./",
|
|
166
|
+
description: "path to downloaded SDK (used with download flag)"
|
|
167
|
+
}),
|
|
168
|
+
zip: command_1.flags.boolean({ default: false, description: "zip the SDK (used with download flag)" }),
|
|
169
|
+
"auth-key": command_1.flags.string({
|
|
170
|
+
default: "",
|
|
171
|
+
description: "override current auth-key"
|
|
172
|
+
})
|
|
173
|
+
};
|
|
174
|
+
SdkGenerate.examples = [
|
|
175
|
+
`$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
|
|
176
|
+
SDK generated successfully
|
|
177
|
+
`
|
|
178
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
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"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const baseURL = "https://apimaticio-test.azurewebsites.net/api";
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from "@oclif/command";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="mocha" />
|
|
3
|
+
export declare const unzipFile: (stream: NodeJS.ReadableStream, destination: string) => Promise<unknown>;
|
|
4
|
+
export declare const deleteFile: (filePath: string) => Promise<void>;
|
|
5
|
+
export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStream, destinationPath: string) => Promise<unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Packages local files into a ZIP archive
|
|
8
|
+
*
|
|
9
|
+
* @param {docsPortalFolderPath} path to portal directory.
|
|
10
|
+
* @param {destinationZipPath} path to generated zip
|
|
11
|
+
* return {string}
|
|
12
|
+
*/
|
|
13
|
+
export declare const zipDirectory: (sourcePath: string, destinationPath: string) => Promise<string>;
|
|
14
|
+
export declare const startProgress: (title: string) => void;
|
|
15
|
+
export declare const stopProgress: (isError?: boolean) => void | null;
|
|
16
|
+
export declare const replaceHTML: (string: string) => string;
|
|
17
|
+
export declare const isJSONParsable: (json: string) => boolean;
|
|
18
|
+
export declare const getFileNameFromPath: (filePath: string) => string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFileNameFromPath = exports.isJSONParsable = exports.replaceHTML = exports.stopProgress = exports.startProgress = exports.zipDirectory = exports.writeFileUsingReadableStream = exports.deleteFile = exports.unzipFile = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const archiver = require("archiver");
|
|
7
|
+
const unzipper = require("unzipper");
|
|
8
|
+
const stripTags = require("striptags");
|
|
9
|
+
const cli_ux_1 = require("cli-ux");
|
|
10
|
+
exports.unzipFile = (stream, destination) => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
stream.pipe(unzipper.Extract({ path: destination }));
|
|
13
|
+
stream.on("close", (error) => {
|
|
14
|
+
if (error) {
|
|
15
|
+
reject(new Error("Couldn't extract the zip"));
|
|
16
|
+
}
|
|
17
|
+
resolve("Extracted");
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.deleteFile = async (filePath) => {
|
|
22
|
+
return await fs.remove(filePath);
|
|
23
|
+
};
|
|
24
|
+
exports.writeFileUsingReadableStream = (stream, destinationPath) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const writeStream = fs.createWriteStream(destinationPath);
|
|
27
|
+
stream.pipe(writeStream);
|
|
28
|
+
writeStream.on("close", (error) => {
|
|
29
|
+
if (error) {
|
|
30
|
+
return reject(new Error("Couldn't zip the stream"));
|
|
31
|
+
}
|
|
32
|
+
resolve("Zipped");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Packages local files into a ZIP archive
|
|
38
|
+
*
|
|
39
|
+
* @param {docsPortalFolderPath} path to portal directory.
|
|
40
|
+
* @param {destinationZipPath} path to generated zip
|
|
41
|
+
* return {string}
|
|
42
|
+
*/
|
|
43
|
+
exports.zipDirectory = async (sourcePath, destinationPath) => {
|
|
44
|
+
// Check if the directory exists for the user or not
|
|
45
|
+
await fs.ensureDir(sourcePath);
|
|
46
|
+
const zipPath = path.join(destinationPath, "target.zip");
|
|
47
|
+
const output = fs.createWriteStream(zipPath);
|
|
48
|
+
const archive = archiver("zip");
|
|
49
|
+
archive.on("error", (err) => {
|
|
50
|
+
throw err;
|
|
51
|
+
});
|
|
52
|
+
archive.pipe(output);
|
|
53
|
+
// append files from a sub-directory, putting its contents at the root of archive
|
|
54
|
+
archive.directory(sourcePath, false);
|
|
55
|
+
await archive.finalize();
|
|
56
|
+
return zipPath;
|
|
57
|
+
};
|
|
58
|
+
// TODO: Instead of making progressBar a static, you should have "startProgress"
|
|
59
|
+
// return the instance of the progress bar created, the same way "cli.progress"
|
|
60
|
+
// method does.
|
|
61
|
+
let progressBar;
|
|
62
|
+
// TODO: I didn't mean to say that we should create a fake progress bar when we
|
|
63
|
+
// set the requirements to include progress bar. You should get the download or
|
|
64
|
+
// upload progress by tracking how much of the steam has been read/written and
|
|
65
|
+
// compare that with the remaining size of the stream (in case of upload, you
|
|
66
|
+
// get size from the file size and in case of download, you get it from the
|
|
67
|
+
// content-type header). In case the progress can not be calculated, show a
|
|
68
|
+
// spinner.
|
|
69
|
+
exports.startProgress = (title) => {
|
|
70
|
+
progressBar = cli_ux_1.default.progress({
|
|
71
|
+
format: `${title} | {bar}`,
|
|
72
|
+
barCompleteChar: "\u2588",
|
|
73
|
+
barIncompleteChar: "\u2591"
|
|
74
|
+
});
|
|
75
|
+
progressBar.start();
|
|
76
|
+
const total = 100;
|
|
77
|
+
let count = 0;
|
|
78
|
+
const iv = setInterval(() => {
|
|
79
|
+
count++;
|
|
80
|
+
progressBar.update(count);
|
|
81
|
+
if (count === total - 1) {
|
|
82
|
+
clearInterval(iv);
|
|
83
|
+
}
|
|
84
|
+
}, 50);
|
|
85
|
+
};
|
|
86
|
+
exports.stopProgress = (isError = false) => {
|
|
87
|
+
if (isError) {
|
|
88
|
+
return progressBar ? progressBar.stop() : null;
|
|
89
|
+
}
|
|
90
|
+
progressBar.update(100);
|
|
91
|
+
return progressBar.stop();
|
|
92
|
+
};
|
|
93
|
+
exports.replaceHTML = (string) => {
|
|
94
|
+
return stripTags(string);
|
|
95
|
+
};
|
|
96
|
+
exports.isJSONParsable = (json) => {
|
|
97
|
+
try {
|
|
98
|
+
JSON.parse(json);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
exports.getFileNameFromPath = (filePath) => {
|
|
106
|
+
return path.basename(filePath).split(".")[0];
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"1.0.1-alpha.1","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":[]}}}
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apimatic/cli",
|
|
3
|
+
"description": "The official CLI for APIMatic.",
|
|
4
|
+
"version": "1.0.1-alpha.1",
|
|
5
|
+
"author": "APIMatic",
|
|
6
|
+
"bin": {
|
|
7
|
+
"apimatic": "./bin/run"
|
|
8
|
+
},
|
|
9
|
+
"bugs": "https://github.com/apimatic/apimatic-cli/issues",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=12.0.0"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"/bin",
|
|
18
|
+
"/lib",
|
|
19
|
+
"/npm-shrinkwrap.json",
|
|
20
|
+
"/oclif.manifest.json"
|
|
21
|
+
],
|
|
22
|
+
"repository": "git://github.com/apimatic/apimatic-cli.git",
|
|
23
|
+
"homepage": "https://github.com/apimatic/apimatic-cli",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"apimatic",
|
|
26
|
+
"cli",
|
|
27
|
+
"sdk generation",
|
|
28
|
+
"openapi",
|
|
29
|
+
"api",
|
|
30
|
+
"automation"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"main": "lib/index.js",
|
|
34
|
+
"types": "lib/index.d.ts",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -b",
|
|
37
|
+
"postpack": "rimraf oclif.manifest.json",
|
|
38
|
+
"posttest": "eslint . --ext .ts --config .eslintrc",
|
|
39
|
+
"prepack": "rimraf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
|
|
40
|
+
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
41
|
+
"version": "oclif-dev readme && git add README.md",
|
|
42
|
+
"prettier": "prettier \"src/**/*.{js,ts}\"",
|
|
43
|
+
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
|
44
|
+
"lint": "eslint \"src/**/*.{js,ts}\"",
|
|
45
|
+
"lint:fix": "eslint --fix \"src/**/*.{js,ts}\" --quiet"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@apimatic/apimatic-sdk-for-js": "git+https://github.com/apimatic/apimatic-sdk-for-js.git",
|
|
49
|
+
"@oclif/command": "^1.8.0",
|
|
50
|
+
"@oclif/config": "^1.17.0",
|
|
51
|
+
"@oclif/plugin-autocomplete": "^0.3.0",
|
|
52
|
+
"@oclif/plugin-help": "^3.2.3",
|
|
53
|
+
"@oclif/plugin-not-found": "^1.2.4",
|
|
54
|
+
"archiver": "^5.3.0",
|
|
55
|
+
"axios": "^0.24.0",
|
|
56
|
+
"base-64": "^1.0.0",
|
|
57
|
+
"form-data": "^4.0.0",
|
|
58
|
+
"fs-extra": "^10.0.0",
|
|
59
|
+
"striptags": "^3.2.0",
|
|
60
|
+
"tslib": "^1.14.1",
|
|
61
|
+
"unzipper": "^0.10.11"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@commitlint/cli": "^15.0.0",
|
|
65
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
66
|
+
"@oclif/dev-cli": "^1.26.0",
|
|
67
|
+
"@oclif/test": "^1.2.8",
|
|
68
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
69
|
+
"@semantic-release/git": "^10.0.1",
|
|
70
|
+
"@types/archiver": "^5.1.1",
|
|
71
|
+
"@types/axios": "^0.14.0",
|
|
72
|
+
"@types/base-64": "^1.0.0",
|
|
73
|
+
"@types/chai": "^4.2.22",
|
|
74
|
+
"@types/fs-extra": "^9.0.13",
|
|
75
|
+
"@types/mocha": "^5.2.7",
|
|
76
|
+
"@types/node": "^10.17.60",
|
|
77
|
+
"@types/unzipper": "^0.10.4",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
79
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
80
|
+
"chai": "^4.3.4",
|
|
81
|
+
"eslint": "^7.32.0",
|
|
82
|
+
"eslint-config-prettier": "^8.3.0",
|
|
83
|
+
"eslint-plugin-import": "^2.25.2",
|
|
84
|
+
"globby": "^10.0.2",
|
|
85
|
+
"husky": "^7.0.4",
|
|
86
|
+
"lint-staged": "^11.2.6",
|
|
87
|
+
"mocha": "^5.2.0",
|
|
88
|
+
"nyc": "^14.1.1",
|
|
89
|
+
"prettier": "^2.4.1",
|
|
90
|
+
"rimraf": "^3.0.2",
|
|
91
|
+
"ts-node": "^8.10.2",
|
|
92
|
+
"typescript": "^3.9.10"
|
|
93
|
+
},
|
|
94
|
+
"oclif": {
|
|
95
|
+
"commands": "./lib/commands",
|
|
96
|
+
"bin": "apimatic",
|
|
97
|
+
"plugins": [
|
|
98
|
+
"@oclif/plugin-autocomplete",
|
|
99
|
+
"@oclif/plugin-help",
|
|
100
|
+
"@oclif/plugin-not-found"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"lint-staged": {
|
|
104
|
+
"*.js": "eslint --cache --fix",
|
|
105
|
+
"*.{js,ts}": "prettier --write"
|
|
106
|
+
}
|
|
107
|
+
}
|