airborne-core-cli 0.9.0
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 +11 -0
- package/action.js +624 -0
- package/bin.js +3 -0
- package/index.js +1642 -0
- package/package.json +26 -0
package/index.js
ADDED
|
@@ -0,0 +1,1642 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { CreateApplicationAction, CreateDimensionAction, CreateFileAction, CreateOrganisationAction, CreatePackageAction, CreateReleaseAction, DeleteDimensionAction, GetReleaseAction, GetUserAction, ListDimensionsAction, ListFilesAction, ListOrganisationsAction, ListPackagesAction, ListReleasesAction, PostLoginAction, RequestOrganisationAction, ServeReleaseAction, ServeReleaseV2Action, UpdateDimensionAction, UploadFileAction } from "./action.js";
|
|
4
|
+
import { promises as fsPromises } from "fs";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import { dirname } from 'path';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import stringify from 'json-stringify-safe';
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
|
|
14
|
+
const configFilePath = path.join(__dirname, ".config");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Reads the config file and parses it as JSON.
|
|
18
|
+
* Returns an Error if file not found.
|
|
19
|
+
*/
|
|
20
|
+
async function readConfigFile() {
|
|
21
|
+
try {
|
|
22
|
+
const data = await fsPromises.readFile(configFilePath, "utf-8");
|
|
23
|
+
return JSON.parse(data);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
if (err.code === "ENOENT") {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`❌ No config file found. Please run configure --base-url <url>\` first.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Reads the config file and parses it as JSON.
|
|
36
|
+
* Returns an object (empty if file doesn't exist).
|
|
37
|
+
*/
|
|
38
|
+
async function readConfigFileOrEmpty() {
|
|
39
|
+
try {
|
|
40
|
+
const data = await fsPromises.readFile(configFilePath, "utf-8");
|
|
41
|
+
return JSON.parse(data);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
if (err.code === "ENOENT") {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Writes the given config object to the config file as JSON.
|
|
53
|
+
*/
|
|
54
|
+
async function writeConfigFile(config) {
|
|
55
|
+
try {
|
|
56
|
+
await fsPromises.writeFile(configFilePath, JSON.stringify(config, null, 2), "utf-8");
|
|
57
|
+
} catch (err) {
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get the endpoint from the config file
|
|
64
|
+
*/
|
|
65
|
+
export async function getBaseUrl() {
|
|
66
|
+
try {
|
|
67
|
+
const config = await readConfigFile();
|
|
68
|
+
return config.baseUrl || null; // return null if not set
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.error("Error reading endpoint:", err);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Set the endpoint in the config file
|
|
77
|
+
*/
|
|
78
|
+
export async function setBaseUrl(url) {
|
|
79
|
+
try {
|
|
80
|
+
const config = await readConfigFileOrEmpty();
|
|
81
|
+
config.baseUrl = url;
|
|
82
|
+
await writeConfigFile(config);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.error("Error writing endpoint:", err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function readJsonFile(filePath) {
|
|
90
|
+
if (path.extname(filePath).toLowerCase() !== ".json") {
|
|
91
|
+
throw new Error("File must be a JSON file (.json)");
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const data = fs.readFileSync(filePath, "utf8");
|
|
95
|
+
return JSON.parse(data);
|
|
96
|
+
} catch (err) {
|
|
97
|
+
throw new Error(`Failed to read or parse JSON file: ${err.message}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function printColoredJSON(obj, indent = 2) {
|
|
102
|
+
const jsonString = stringify(obj, null, indent);
|
|
103
|
+
|
|
104
|
+
// Apply colors while keeping valid JSON structure
|
|
105
|
+
const colored = jsonString
|
|
106
|
+
.replace(/"([^"]+)":/g, (match) => chalk.cyan(match)) // keys with quotes and colon
|
|
107
|
+
.replace(/: "([^"]*)"/g, (match) => ': ' + chalk.green(match.slice(2))) // string values
|
|
108
|
+
.replace(/: (-?\d+\.?\d*)(,?)/g, (match, num, comma) => ': ' + chalk.yellow(num) + comma) // numbers
|
|
109
|
+
.replace(/: (true|false)/g, (match, bool) => ': ' + chalk.magenta(bool)) // booleans
|
|
110
|
+
.replace(/: null/g, ': ' + chalk.gray('null')) // null
|
|
111
|
+
.replace(/\[Circular\]/g, chalk.red('[Circular]')); // circular refs
|
|
112
|
+
|
|
113
|
+
return colored;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
const program = new Command()
|
|
118
|
+
.name("airborne-core-cli")
|
|
119
|
+
.description("Command-line interface for Airborne OTA operations")
|
|
120
|
+
.version("0.0.1");
|
|
121
|
+
|
|
122
|
+
program
|
|
123
|
+
.command("CreateApplication")
|
|
124
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
125
|
+
.option("--application <application>", "application parameter")
|
|
126
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
127
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
128
|
+
.description(`
|
|
129
|
+
Create application request operation:
|
|
130
|
+
|
|
131
|
+
Usage 1 - Individual options:
|
|
132
|
+
$ airborne-core-cli CreateApplication \\
|
|
133
|
+
--application <application> \\
|
|
134
|
+
--organisation <organisation> \\
|
|
135
|
+
--token <string>
|
|
136
|
+
|
|
137
|
+
Usage 2 - JSON file:
|
|
138
|
+
airborne-core-cli CreateApplication @file.json
|
|
139
|
+
|
|
140
|
+
Usage 3 - Mixed Usage:
|
|
141
|
+
$ airborne-core-cli CreateApplication @params.json --application <value> --organisation <value> --token <value>
|
|
142
|
+
|
|
143
|
+
Parameters:
|
|
144
|
+
--application <string> (required) : Name of the application
|
|
145
|
+
--organisation <string> (required) : Name of the organisation
|
|
146
|
+
--token <string> (required) : Bearer token for authentication
|
|
147
|
+
|
|
148
|
+
`)
|
|
149
|
+
.usage('<action> [options]')
|
|
150
|
+
.addHelpText('after', `
|
|
151
|
+
Examples:
|
|
152
|
+
|
|
153
|
+
1. Using individual options:
|
|
154
|
+
$ airborne-core-cli CreateApplication \\
|
|
155
|
+
--application <application> \\
|
|
156
|
+
--organisation <organisation> \\
|
|
157
|
+
--token <string>
|
|
158
|
+
|
|
159
|
+
2. Using JSON file:
|
|
160
|
+
$ airborne-core-cli CreateApplication @params.json
|
|
161
|
+
|
|
162
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
163
|
+
$ airborne-core-cli CreateApplication @params.json --application <value> --organisation <value> --token <value>
|
|
164
|
+
|
|
165
|
+
JSON file format (params.json):
|
|
166
|
+
{
|
|
167
|
+
"application": "example_application",
|
|
168
|
+
"organisation": "example_organisation",
|
|
169
|
+
"token": "your_bearer_token_here"
|
|
170
|
+
}`)
|
|
171
|
+
.action(async (paramsFile, options) => {
|
|
172
|
+
try {
|
|
173
|
+
|
|
174
|
+
const output = await CreateApplicationAction(paramsFile, options);
|
|
175
|
+
console.log(printColoredJSON(output));
|
|
176
|
+
process.exit(0);
|
|
177
|
+
} catch (err) {
|
|
178
|
+
console.error("Error message:", err.message);
|
|
179
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
program
|
|
186
|
+
.command("CreateDimension")
|
|
187
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
188
|
+
.option("--dimension <dimension>", "dimension parameter")
|
|
189
|
+
.option("--description <description>", "description parameter")
|
|
190
|
+
.option("--dimension_type <dimension_type>", "dimension_type parameter (allowed values: standard, cohort)", (value) => {
|
|
191
|
+
const allowedValues = ["standard", "cohort"];
|
|
192
|
+
if (!allowedValues.includes(value)) {
|
|
193
|
+
throw new Error("--dimension_type must be one of: standard, cohort");
|
|
194
|
+
}
|
|
195
|
+
return value;
|
|
196
|
+
})
|
|
197
|
+
.option("--depends_on <depends_on>", "depends_on parameter")
|
|
198
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
199
|
+
.option("--application <application>", "application parameter")
|
|
200
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
201
|
+
.description(`
|
|
202
|
+
Create dimension request operation:
|
|
203
|
+
|
|
204
|
+
Usage 1 - Individual options:
|
|
205
|
+
$ airborne-core-cli CreateDimension \\
|
|
206
|
+
--dimension <dimension> \\
|
|
207
|
+
--description <description> \\
|
|
208
|
+
--dimension_type <dimension_type> \\
|
|
209
|
+
--organisation <organisation> \\
|
|
210
|
+
--application <application> \\
|
|
211
|
+
--token <string> \\
|
|
212
|
+
[--depends_on <depends_on>]
|
|
213
|
+
|
|
214
|
+
Usage 2 - JSON file:
|
|
215
|
+
airborne-core-cli CreateDimension @file.json
|
|
216
|
+
|
|
217
|
+
Usage 3 - Mixed Usage:
|
|
218
|
+
$ airborne-core-cli CreateDimension @params.json --dimension <value> --description <value> --token <value>
|
|
219
|
+
|
|
220
|
+
Parameters:
|
|
221
|
+
--dimension <string> (required) : Name of the dimension
|
|
222
|
+
--description <string> (required) : Description of the dimension
|
|
223
|
+
--dimension_type <standard | cohort> (required) : Type of the dimension
|
|
224
|
+
--depends_on <string> (optional) : Identifier of the dimension this depends on (required for cohort dimensions, ignored for standard dimensions)
|
|
225
|
+
--organisation <string> (required) : Name of the organisation
|
|
226
|
+
--application <string> (required) : Name of the application
|
|
227
|
+
--token <string> (required) : Bearer token for authentication
|
|
228
|
+
|
|
229
|
+
`)
|
|
230
|
+
.usage('<action> [options]')
|
|
231
|
+
.addHelpText('after', `
|
|
232
|
+
Examples:
|
|
233
|
+
|
|
234
|
+
1. Using individual options:
|
|
235
|
+
$ airborne-core-cli CreateDimension \\
|
|
236
|
+
--dimension <dimension> \\
|
|
237
|
+
--description <description> \\
|
|
238
|
+
--dimension_type <dimension_type> \\
|
|
239
|
+
--organisation <organisation> \\
|
|
240
|
+
--application <application> \\
|
|
241
|
+
--token <string> \\
|
|
242
|
+
[--depends_on <depends_on>]
|
|
243
|
+
|
|
244
|
+
2. Using JSON file:
|
|
245
|
+
$ airborne-core-cli CreateDimension @params.json
|
|
246
|
+
|
|
247
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
248
|
+
$ airborne-core-cli CreateDimension @params.json --dimension <value> --description <value> --token <value>
|
|
249
|
+
|
|
250
|
+
JSON file format (params.json):
|
|
251
|
+
{
|
|
252
|
+
"dimension": "example_dimension",
|
|
253
|
+
"description": "example_description",
|
|
254
|
+
"dimension_type": "example_dimension_type",
|
|
255
|
+
"depends_on": "example_depends_on",
|
|
256
|
+
"organisation": "example_organisation",
|
|
257
|
+
"application": "example_application",
|
|
258
|
+
"token": "your_bearer_token_here"
|
|
259
|
+
}`)
|
|
260
|
+
.action(async (paramsFile, options) => {
|
|
261
|
+
try {
|
|
262
|
+
|
|
263
|
+
const output = await CreateDimensionAction(paramsFile, options);
|
|
264
|
+
console.log(printColoredJSON(output));
|
|
265
|
+
process.exit(0);
|
|
266
|
+
} catch (err) {
|
|
267
|
+
console.error("Error message:", err.message);
|
|
268
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
program
|
|
275
|
+
.command("CreateFile")
|
|
276
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
277
|
+
.option("--file_path <file_path>", "file_path parameter")
|
|
278
|
+
.option("--url <url>", "url parameter")
|
|
279
|
+
.option("--tag <tag>", "tag parameter")
|
|
280
|
+
.option("--metadata <metadata>", "metadata parameter", (value) => {
|
|
281
|
+
try {
|
|
282
|
+
if (value.startsWith("@")) {
|
|
283
|
+
return readJsonFile(value.slice(1));
|
|
284
|
+
}
|
|
285
|
+
return JSON.parse(value);
|
|
286
|
+
} catch (err) {
|
|
287
|
+
throw new Error("--metadata must be valid JSON or a @file.json path");
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
291
|
+
.option("--application <application>", "application parameter")
|
|
292
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
293
|
+
.description(`
|
|
294
|
+
Create file request operation:
|
|
295
|
+
|
|
296
|
+
Usage 1 - Individual options:
|
|
297
|
+
$ airborne-core-cli CreateFile \\
|
|
298
|
+
--file_path <file_path> \\
|
|
299
|
+
--url <url> \\
|
|
300
|
+
--organisation <organisation> \\
|
|
301
|
+
--application <application> \\
|
|
302
|
+
--token <string> \\
|
|
303
|
+
[--tag <tag>]
|
|
304
|
+
|
|
305
|
+
Usage 2 - JSON file:
|
|
306
|
+
airborne-core-cli CreateFile @file.json
|
|
307
|
+
|
|
308
|
+
Usage 3 - Mixed Usage:
|
|
309
|
+
$ airborne-core-cli CreateFile @params.json --file_path <value> --url <value> --token <value>
|
|
310
|
+
|
|
311
|
+
Parameters:
|
|
312
|
+
--file_path <string> (required) : Path where the file will be stored on sdk
|
|
313
|
+
--url <string> (required) : URL from where the file can be downloaded
|
|
314
|
+
--tag <string> (optional) : Tag to identify the file
|
|
315
|
+
--metadata <document> (optional) : Metadata associated with the file in Stringified JSON format or a file attachment
|
|
316
|
+
--organisation <string> (required) : Name of the organisation
|
|
317
|
+
--application <string> (required) : Name of the application
|
|
318
|
+
--token <string> (required) : Bearer token for authentication
|
|
319
|
+
|
|
320
|
+
`)
|
|
321
|
+
.usage('<action> [options]')
|
|
322
|
+
.addHelpText('after', `
|
|
323
|
+
Examples:
|
|
324
|
+
|
|
325
|
+
1. Using individual options:
|
|
326
|
+
$ airborne-core-cli CreateFile \\
|
|
327
|
+
--file_path <file_path> \\
|
|
328
|
+
--url <url> \\
|
|
329
|
+
--organisation <organisation> \\
|
|
330
|
+
--application <application> \\
|
|
331
|
+
--token <string> \\
|
|
332
|
+
[--tag <tag>]
|
|
333
|
+
|
|
334
|
+
2. Using JSON file:
|
|
335
|
+
$ airborne-core-cli CreateFile @params.json
|
|
336
|
+
|
|
337
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
338
|
+
$ airborne-core-cli CreateFile @params.json --file_path <value> --url <value> --token <value>
|
|
339
|
+
|
|
340
|
+
JSON file format (params.json):
|
|
341
|
+
{
|
|
342
|
+
"file_path": "example_file_path",
|
|
343
|
+
"url": "example_url",
|
|
344
|
+
"tag": "example_tag",
|
|
345
|
+
"metadata": {
|
|
346
|
+
"example_key": "example_value",
|
|
347
|
+
"version": "1.0.0"
|
|
348
|
+
},
|
|
349
|
+
"organisation": "example_organisation",
|
|
350
|
+
"application": "example_application",
|
|
351
|
+
"token": "your_bearer_token_here"
|
|
352
|
+
}`)
|
|
353
|
+
.action(async (paramsFile, options) => {
|
|
354
|
+
try {
|
|
355
|
+
|
|
356
|
+
const output = await CreateFileAction(paramsFile, options);
|
|
357
|
+
console.log(printColoredJSON(output));
|
|
358
|
+
process.exit(0);
|
|
359
|
+
} catch (err) {
|
|
360
|
+
console.error("Error message:", err.message);
|
|
361
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
362
|
+
process.exit(1);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
program
|
|
368
|
+
.command("CreateOrganisation")
|
|
369
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
370
|
+
.option("--name <name>", "name parameter")
|
|
371
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
372
|
+
.description(`
|
|
373
|
+
Create organisation request operation:
|
|
374
|
+
|
|
375
|
+
Usage 1 - Individual options:
|
|
376
|
+
$ airborne-core-cli CreateOrganisation \\
|
|
377
|
+
--name <name> \\
|
|
378
|
+
--token <string>
|
|
379
|
+
|
|
380
|
+
Usage 2 - JSON file:
|
|
381
|
+
airborne-core-cli CreateOrganisation @file.json
|
|
382
|
+
|
|
383
|
+
Usage 3 - Mixed Usage:
|
|
384
|
+
$ airborne-core-cli CreateOrganisation @params.json --name <value> --token <value>
|
|
385
|
+
|
|
386
|
+
Parameters:
|
|
387
|
+
--name <string> (required)
|
|
388
|
+
--token <string> (required) : Bearer token for authentication
|
|
389
|
+
|
|
390
|
+
`)
|
|
391
|
+
.usage('<action> [options]')
|
|
392
|
+
.addHelpText('after', `
|
|
393
|
+
Examples:
|
|
394
|
+
|
|
395
|
+
1. Using individual options:
|
|
396
|
+
$ airborne-core-cli CreateOrganisation \\
|
|
397
|
+
--name <name> \\
|
|
398
|
+
--token <string>
|
|
399
|
+
|
|
400
|
+
2. Using JSON file:
|
|
401
|
+
$ airborne-core-cli CreateOrganisation @params.json
|
|
402
|
+
|
|
403
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
404
|
+
$ airborne-core-cli CreateOrganisation @params.json --name <value> --token <value>
|
|
405
|
+
|
|
406
|
+
JSON file format (params.json):
|
|
407
|
+
{
|
|
408
|
+
"name": "example_name",
|
|
409
|
+
"token": "your_bearer_token_here"
|
|
410
|
+
}`)
|
|
411
|
+
.action(async (paramsFile, options) => {
|
|
412
|
+
try {
|
|
413
|
+
|
|
414
|
+
const output = await CreateOrganisationAction(paramsFile, options);
|
|
415
|
+
console.log(printColoredJSON(output));
|
|
416
|
+
process.exit(0);
|
|
417
|
+
} catch (err) {
|
|
418
|
+
console.error("Error message:", err.message);
|
|
419
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
420
|
+
process.exit(1);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
program
|
|
426
|
+
.command("CreatePackage")
|
|
427
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
428
|
+
.option("--index <index>", "index parameter")
|
|
429
|
+
.option("--tag <tag>", "tag parameter")
|
|
430
|
+
.option("--files <files...>", "files parameter")
|
|
431
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
432
|
+
.option("--application <application>", "application parameter")
|
|
433
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
434
|
+
.description(`
|
|
435
|
+
Create package request operation:
|
|
436
|
+
|
|
437
|
+
Usage 1 - Individual options:
|
|
438
|
+
$ airborne-core-cli CreatePackage \\
|
|
439
|
+
--index <index> \\
|
|
440
|
+
--files <files> \\
|
|
441
|
+
--organisation <organisation> \\
|
|
442
|
+
--application <application> \\
|
|
443
|
+
--token <string> \\
|
|
444
|
+
[--tag <tag>]
|
|
445
|
+
|
|
446
|
+
Usage 2 - JSON file:
|
|
447
|
+
airborne-core-cli CreatePackage @file.json
|
|
448
|
+
|
|
449
|
+
Usage 3 - Mixed Usage:
|
|
450
|
+
$ airborne-core-cli CreatePackage @params.json --index <value> --tag <value> --token <value>
|
|
451
|
+
|
|
452
|
+
Parameters:
|
|
453
|
+
--index <string> (required) : Index file id
|
|
454
|
+
--tag <string> (optional)
|
|
455
|
+
--files [<string>] (required) : Space Separated file ids to be included in the package
|
|
456
|
+
--organisation <string> (required) : Name of the organisation
|
|
457
|
+
--application <string> (required) : Name of the application
|
|
458
|
+
--token <string> (required) : Bearer token for authentication
|
|
459
|
+
|
|
460
|
+
`)
|
|
461
|
+
.usage('<action> [options]')
|
|
462
|
+
.addHelpText('after', `
|
|
463
|
+
Examples:
|
|
464
|
+
|
|
465
|
+
1. Using individual options:
|
|
466
|
+
$ airborne-core-cli CreatePackage \\
|
|
467
|
+
--index <index> \\
|
|
468
|
+
--files <files> \\
|
|
469
|
+
--organisation <organisation> \\
|
|
470
|
+
--application <application> \\
|
|
471
|
+
--token <string> \\
|
|
472
|
+
[--tag <tag>]
|
|
473
|
+
|
|
474
|
+
2. Using JSON file:
|
|
475
|
+
$ airborne-core-cli CreatePackage @params.json
|
|
476
|
+
|
|
477
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
478
|
+
$ airborne-core-cli CreatePackage @params.json --index <value> --tag <value> --token <value>
|
|
479
|
+
|
|
480
|
+
JSON file format (params.json):
|
|
481
|
+
{
|
|
482
|
+
"index": "example_index",
|
|
483
|
+
"tag": "example_tag",
|
|
484
|
+
"files": "example_files",
|
|
485
|
+
"organisation": "example_organisation",
|
|
486
|
+
"application": "example_application",
|
|
487
|
+
"token": "your_bearer_token_here"
|
|
488
|
+
}`)
|
|
489
|
+
.action(async (paramsFile, options) => {
|
|
490
|
+
try {
|
|
491
|
+
|
|
492
|
+
const output = await CreatePackageAction(paramsFile, options);
|
|
493
|
+
console.log(printColoredJSON(output));
|
|
494
|
+
process.exit(0);
|
|
495
|
+
} catch (err) {
|
|
496
|
+
console.error("Error message:", err.message);
|
|
497
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
498
|
+
process.exit(1);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
program
|
|
504
|
+
.command("CreateRelease")
|
|
505
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
506
|
+
.option("--config <config>", "config parameter")
|
|
507
|
+
.option("--package_id <package_id>", "package_id parameter")
|
|
508
|
+
.option("--package <package>", "package parameter")
|
|
509
|
+
.option("--dimensions <dimensions>", "dimensions parameter")
|
|
510
|
+
.option("--resources <resources...>", "resources parameter")
|
|
511
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
512
|
+
.option("--application <application>", "application parameter")
|
|
513
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
514
|
+
.description(`
|
|
515
|
+
Create release request operation:
|
|
516
|
+
|
|
517
|
+
Usage 1 - Individual options:
|
|
518
|
+
$ airborne-core-cli CreateRelease \\
|
|
519
|
+
--config <config> \\
|
|
520
|
+
--organisation <organisation> \\
|
|
521
|
+
--application <application> \\
|
|
522
|
+
--token <string> \\
|
|
523
|
+
[--package_id <package_id>]
|
|
524
|
+
|
|
525
|
+
Usage 2 - JSON file:
|
|
526
|
+
airborne-core-cli CreateRelease @file.json
|
|
527
|
+
|
|
528
|
+
Usage 3 - Mixed Usage:
|
|
529
|
+
$ airborne-core-cli CreateRelease @params.json --config <value> --package_id <value> --token <value>
|
|
530
|
+
|
|
531
|
+
Parameters:
|
|
532
|
+
--config (required) : config for the release
|
|
533
|
+
release_config_timeout <integer> (required) : Timeout for the release config in seconds
|
|
534
|
+
boot_timeout <integer> (required) : Timeout for the package in seconds
|
|
535
|
+
properties <document> (required) : Properties of the config in Stringified JSON format
|
|
536
|
+
--package_id <string> (optional) : Package ID for the release
|
|
537
|
+
--package (optional) : Package details for the release
|
|
538
|
+
properties <document> (optional) : Properties of the package in Stringified JSON format or a file attachment
|
|
539
|
+
important [<string>] (optional) : Important files in the package
|
|
540
|
+
lazy [<string>] (optional) : Lazy files in the package
|
|
541
|
+
--dimensions (optional) : Dimensions for the release in key-value format
|
|
542
|
+
key <string> : Dimension name
|
|
543
|
+
value <document> : Dimension value
|
|
544
|
+
--resources [<string>] (optional) : Resources for the release
|
|
545
|
+
--organisation <string> (required) : Name of the organisation
|
|
546
|
+
--application <string> (required) : Name of the application
|
|
547
|
+
--token <string> (required) : Bearer token for authentication
|
|
548
|
+
|
|
549
|
+
`)
|
|
550
|
+
.usage('<action> [options]')
|
|
551
|
+
.addHelpText('after', `
|
|
552
|
+
Examples:
|
|
553
|
+
|
|
554
|
+
1. Using individual options:
|
|
555
|
+
$ airborne-core-cli CreateRelease \\
|
|
556
|
+
--config <config> \\
|
|
557
|
+
--organisation <organisation> \\
|
|
558
|
+
--application <application> \\
|
|
559
|
+
--token <string> \\
|
|
560
|
+
[--package_id <package_id>]
|
|
561
|
+
|
|
562
|
+
2. Using JSON file:
|
|
563
|
+
$ airborne-core-cli CreateRelease @params.json
|
|
564
|
+
|
|
565
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
566
|
+
$ airborne-core-cli CreateRelease @params.json --config <value> --package_id <value> --token <value>
|
|
567
|
+
|
|
568
|
+
JSON file format (params.json):
|
|
569
|
+
{
|
|
570
|
+
"config": "example_config",
|
|
571
|
+
"package_id": "example_package_id",
|
|
572
|
+
"package": "example_package",
|
|
573
|
+
"dimensions": "example_dimensions",
|
|
574
|
+
"resources": "example_resources",
|
|
575
|
+
"organisation": "example_organisation",
|
|
576
|
+
"application": "example_application",
|
|
577
|
+
"token": "your_bearer_token_here"
|
|
578
|
+
}`)
|
|
579
|
+
.action(async (paramsFile, options) => {
|
|
580
|
+
try {
|
|
581
|
+
|
|
582
|
+
const output = await CreateReleaseAction(paramsFile, options);
|
|
583
|
+
console.log(printColoredJSON(output));
|
|
584
|
+
process.exit(0);
|
|
585
|
+
} catch (err) {
|
|
586
|
+
console.error("Error message:", err.message);
|
|
587
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
588
|
+
process.exit(1);
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
program
|
|
594
|
+
.command("DeleteDimension")
|
|
595
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
596
|
+
.option("--dimension <dimension>", "dimension parameter")
|
|
597
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
598
|
+
.option("--application <application>", "application parameter")
|
|
599
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
600
|
+
.description(`
|
|
601
|
+
Delete dimension request operation:
|
|
602
|
+
|
|
603
|
+
Usage 1 - Individual options:
|
|
604
|
+
$ airborne-core-cli DeleteDimension \\
|
|
605
|
+
--dimension <dimension> \\
|
|
606
|
+
--organisation <organisation> \\
|
|
607
|
+
--application <application> \\
|
|
608
|
+
--token <string>
|
|
609
|
+
|
|
610
|
+
Usage 2 - JSON file:
|
|
611
|
+
airborne-core-cli DeleteDimension @file.json
|
|
612
|
+
|
|
613
|
+
Usage 3 - Mixed Usage:
|
|
614
|
+
$ airborne-core-cli DeleteDimension @params.json --dimension <value> --organisation <value> --token <value>
|
|
615
|
+
|
|
616
|
+
Parameters:
|
|
617
|
+
--dimension <string> (required) : Name of the dimension
|
|
618
|
+
--organisation <string> (required) : Name of the organisation
|
|
619
|
+
--application <string> (required) : Name of the application
|
|
620
|
+
--token <string> (required) : Bearer token for authentication
|
|
621
|
+
|
|
622
|
+
`)
|
|
623
|
+
.usage('<action> [options]')
|
|
624
|
+
.addHelpText('after', `
|
|
625
|
+
Examples:
|
|
626
|
+
|
|
627
|
+
1. Using individual options:
|
|
628
|
+
$ airborne-core-cli DeleteDimension \\
|
|
629
|
+
--dimension <dimension> \\
|
|
630
|
+
--organisation <organisation> \\
|
|
631
|
+
--application <application> \\
|
|
632
|
+
--token <string>
|
|
633
|
+
|
|
634
|
+
2. Using JSON file:
|
|
635
|
+
$ airborne-core-cli DeleteDimension @params.json
|
|
636
|
+
|
|
637
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
638
|
+
$ airborne-core-cli DeleteDimension @params.json --dimension <value> --organisation <value> --token <value>
|
|
639
|
+
|
|
640
|
+
JSON file format (params.json):
|
|
641
|
+
{
|
|
642
|
+
"dimension": "example_dimension",
|
|
643
|
+
"organisation": "example_organisation",
|
|
644
|
+
"application": "example_application",
|
|
645
|
+
"token": "your_bearer_token_here"
|
|
646
|
+
}`)
|
|
647
|
+
.action(async (paramsFile, options) => {
|
|
648
|
+
try {
|
|
649
|
+
|
|
650
|
+
const output = await DeleteDimensionAction(paramsFile, options);
|
|
651
|
+
console.log(printColoredJSON(output));
|
|
652
|
+
process.exit(0);
|
|
653
|
+
} catch (err) {
|
|
654
|
+
console.error("Error message:", err.message);
|
|
655
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
656
|
+
process.exit(1);
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
program
|
|
662
|
+
.command("GetRelease")
|
|
663
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
664
|
+
.option("--releaseId <releaseId>", "releaseId parameter")
|
|
665
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
666
|
+
.option("--application <application>", "application parameter")
|
|
667
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
668
|
+
.description(`
|
|
669
|
+
Release request operation:
|
|
670
|
+
|
|
671
|
+
Usage 1 - Individual options:
|
|
672
|
+
$ airborne-core-cli GetRelease \\
|
|
673
|
+
--releaseId <releaseId> \\
|
|
674
|
+
--organisation <organisation> \\
|
|
675
|
+
--application <application> \\
|
|
676
|
+
--token <string>
|
|
677
|
+
|
|
678
|
+
Usage 2 - JSON file:
|
|
679
|
+
airborne-core-cli GetRelease @file.json
|
|
680
|
+
|
|
681
|
+
Usage 3 - Mixed Usage:
|
|
682
|
+
$ airborne-core-cli GetRelease @params.json --releaseId <value> --organisation <value> --token <value>
|
|
683
|
+
|
|
684
|
+
Parameters:
|
|
685
|
+
--releaseId <string> (required) : ID of the release
|
|
686
|
+
--organisation <string> (required) : Name of the organisation
|
|
687
|
+
--application <string> (required) : Name of the application
|
|
688
|
+
--token <string> (required) : Bearer token for authentication
|
|
689
|
+
|
|
690
|
+
`)
|
|
691
|
+
.usage('<action> [options]')
|
|
692
|
+
.addHelpText('after', `
|
|
693
|
+
Examples:
|
|
694
|
+
|
|
695
|
+
1. Using individual options:
|
|
696
|
+
$ airborne-core-cli GetRelease \\
|
|
697
|
+
--releaseId <releaseId> \\
|
|
698
|
+
--organisation <organisation> \\
|
|
699
|
+
--application <application> \\
|
|
700
|
+
--token <string>
|
|
701
|
+
|
|
702
|
+
2. Using JSON file:
|
|
703
|
+
$ airborne-core-cli GetRelease @params.json
|
|
704
|
+
|
|
705
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
706
|
+
$ airborne-core-cli GetRelease @params.json --releaseId <value> --organisation <value> --token <value>
|
|
707
|
+
|
|
708
|
+
JSON file format (params.json):
|
|
709
|
+
{
|
|
710
|
+
"releaseId": "example_releaseId",
|
|
711
|
+
"organisation": "example_organisation",
|
|
712
|
+
"application": "example_application",
|
|
713
|
+
"token": "your_bearer_token_here"
|
|
714
|
+
}`)
|
|
715
|
+
.action(async (paramsFile, options) => {
|
|
716
|
+
try {
|
|
717
|
+
|
|
718
|
+
const output = await GetReleaseAction(paramsFile, options);
|
|
719
|
+
console.log(printColoredJSON(output));
|
|
720
|
+
process.exit(0);
|
|
721
|
+
} catch (err) {
|
|
722
|
+
console.error("Error message:", err.message);
|
|
723
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
724
|
+
process.exit(1);
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
program
|
|
730
|
+
.command("GetUser")
|
|
731
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
732
|
+
|
|
733
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
734
|
+
.description(`
|
|
735
|
+
Get user request operation:
|
|
736
|
+
|
|
737
|
+
Usage 1 - Individual options:
|
|
738
|
+
$ airborne-core-cli GetUser \\
|
|
739
|
+
--token <string>
|
|
740
|
+
|
|
741
|
+
Usage 2 - JSON file:
|
|
742
|
+
airborne-core-cli GetUser @file.json
|
|
743
|
+
|
|
744
|
+
Usage 3 - Mixed Usage:
|
|
745
|
+
$ airborne-core-cli GetUser @params.json --token <value>
|
|
746
|
+
|
|
747
|
+
Parameters:
|
|
748
|
+
--token <string> (required) : Bearer token for authentication
|
|
749
|
+
|
|
750
|
+
`)
|
|
751
|
+
.usage('<action> [options]')
|
|
752
|
+
.addHelpText('after', `
|
|
753
|
+
Examples:
|
|
754
|
+
|
|
755
|
+
1. Using individual options:
|
|
756
|
+
$ airborne-core-cli GetUser \\
|
|
757
|
+
--token <string>
|
|
758
|
+
|
|
759
|
+
2. Using JSON file:
|
|
760
|
+
$ airborne-core-cli GetUser @params.json
|
|
761
|
+
|
|
762
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
763
|
+
$ airborne-core-cli GetUser @params.json --token <value>
|
|
764
|
+
|
|
765
|
+
JSON file format (params.json):
|
|
766
|
+
{
|
|
767
|
+
"token": "your_bearer_token_here"
|
|
768
|
+
}`)
|
|
769
|
+
.action(async (paramsFile, options) => {
|
|
770
|
+
try {
|
|
771
|
+
|
|
772
|
+
const output = await GetUserAction(paramsFile, options);
|
|
773
|
+
console.log(printColoredJSON(output));
|
|
774
|
+
process.exit(0);
|
|
775
|
+
} catch (err) {
|
|
776
|
+
console.error("Error message:", err.message);
|
|
777
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
778
|
+
process.exit(1);
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
program
|
|
784
|
+
.command("ListDimensions")
|
|
785
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
786
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
787
|
+
.option("--application <application>", "application parameter")
|
|
788
|
+
.option("--page <page>", "page parameter", (value) => {
|
|
789
|
+
const parsed = parseInt(value, 10);
|
|
790
|
+
if (isNaN(parsed)) {
|
|
791
|
+
throw new Error("--page must be a valid integer");
|
|
792
|
+
}
|
|
793
|
+
return parsed;
|
|
794
|
+
})
|
|
795
|
+
.option("--count <count>", "count parameter", (value) => {
|
|
796
|
+
const parsed = parseInt(value, 10);
|
|
797
|
+
if (isNaN(parsed)) {
|
|
798
|
+
throw new Error("--count must be a valid integer");
|
|
799
|
+
}
|
|
800
|
+
return parsed;
|
|
801
|
+
})
|
|
802
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
803
|
+
.description(`
|
|
804
|
+
List dimensions request operation:
|
|
805
|
+
|
|
806
|
+
Usage 1 - Individual options:
|
|
807
|
+
$ airborne-core-cli ListDimensions \\
|
|
808
|
+
--organisation <organisation> \\
|
|
809
|
+
--application <application> \\
|
|
810
|
+
--token <string> \\
|
|
811
|
+
[--page <page>]
|
|
812
|
+
|
|
813
|
+
Usage 2 - JSON file:
|
|
814
|
+
airborne-core-cli ListDimensions @file.json
|
|
815
|
+
|
|
816
|
+
Usage 3 - Mixed Usage:
|
|
817
|
+
$ airborne-core-cli ListDimensions @params.json --organisation <value> --application <value> --token <value>
|
|
818
|
+
|
|
819
|
+
Parameters:
|
|
820
|
+
--organisation <string> (required) : Name of the organisation
|
|
821
|
+
--application <string> (required) : Name of the application
|
|
822
|
+
--page <integer> (optional)
|
|
823
|
+
--count <integer> (optional)
|
|
824
|
+
--token <string> (required) : Bearer token for authentication
|
|
825
|
+
|
|
826
|
+
`)
|
|
827
|
+
.usage('<action> [options]')
|
|
828
|
+
.addHelpText('after', `
|
|
829
|
+
Examples:
|
|
830
|
+
|
|
831
|
+
1. Using individual options:
|
|
832
|
+
$ airborne-core-cli ListDimensions \\
|
|
833
|
+
--organisation <organisation> \\
|
|
834
|
+
--application <application> \\
|
|
835
|
+
--token <string> \\
|
|
836
|
+
[--page <page>]
|
|
837
|
+
|
|
838
|
+
2. Using JSON file:
|
|
839
|
+
$ airborne-core-cli ListDimensions @params.json
|
|
840
|
+
|
|
841
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
842
|
+
$ airborne-core-cli ListDimensions @params.json --organisation <value> --application <value> --token <value>
|
|
843
|
+
|
|
844
|
+
JSON file format (params.json):
|
|
845
|
+
{
|
|
846
|
+
"organisation": "example_organisation",
|
|
847
|
+
"application": "example_application",
|
|
848
|
+
"page": 123,
|
|
849
|
+
"count": 123,
|
|
850
|
+
"token": "your_bearer_token_here"
|
|
851
|
+
}`)
|
|
852
|
+
.action(async (paramsFile, options) => {
|
|
853
|
+
try {
|
|
854
|
+
|
|
855
|
+
const output = await ListDimensionsAction(paramsFile, options);
|
|
856
|
+
console.log(printColoredJSON(output));
|
|
857
|
+
process.exit(0);
|
|
858
|
+
} catch (err) {
|
|
859
|
+
console.error("Error message:", err.message);
|
|
860
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
861
|
+
process.exit(1);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
program
|
|
867
|
+
.command("ListFiles")
|
|
868
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
869
|
+
.option("--page <page>", "page parameter", (value) => {
|
|
870
|
+
const parsed = parseInt(value, 10);
|
|
871
|
+
if (isNaN(parsed)) {
|
|
872
|
+
throw new Error("--page must be a valid integer");
|
|
873
|
+
}
|
|
874
|
+
return parsed;
|
|
875
|
+
})
|
|
876
|
+
.option("--per_page <per_page>", "per_page parameter", (value) => {
|
|
877
|
+
const parsed = parseInt(value, 10);
|
|
878
|
+
if (isNaN(parsed)) {
|
|
879
|
+
throw new Error("--per_page must be a valid integer");
|
|
880
|
+
}
|
|
881
|
+
return parsed;
|
|
882
|
+
})
|
|
883
|
+
.option("--search <search>", "search parameter")
|
|
884
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
885
|
+
.option("--application <application>", "application parameter")
|
|
886
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
887
|
+
.description(`
|
|
888
|
+
List files request operation:
|
|
889
|
+
|
|
890
|
+
Usage 1 - Individual options:
|
|
891
|
+
$ airborne-core-cli ListFiles \\
|
|
892
|
+
--organisation <organisation> \\
|
|
893
|
+
--application <application> \\
|
|
894
|
+
--token <string> \\
|
|
895
|
+
[--page <page>]
|
|
896
|
+
|
|
897
|
+
Usage 2 - JSON file:
|
|
898
|
+
airborne-core-cli ListFiles @file.json
|
|
899
|
+
|
|
900
|
+
Usage 3 - Mixed Usage:
|
|
901
|
+
$ airborne-core-cli ListFiles @params.json --page <value> --per_page <value> --token <value>
|
|
902
|
+
|
|
903
|
+
Parameters:
|
|
904
|
+
--page <integer> (optional) : Page number for pagination
|
|
905
|
+
--per_page <integer> (optional) : Number of files per page
|
|
906
|
+
--search <string> (optional) : Search query to filter files
|
|
907
|
+
--organisation <string> (required) : Name of the organisation
|
|
908
|
+
--application <string> (required) : Name of the application
|
|
909
|
+
--token <string> (required) : Bearer token for authentication
|
|
910
|
+
|
|
911
|
+
`)
|
|
912
|
+
.usage('<action> [options]')
|
|
913
|
+
.addHelpText('after', `
|
|
914
|
+
Examples:
|
|
915
|
+
|
|
916
|
+
1. Using individual options:
|
|
917
|
+
$ airborne-core-cli ListFiles \\
|
|
918
|
+
--organisation <organisation> \\
|
|
919
|
+
--application <application> \\
|
|
920
|
+
--token <string> \\
|
|
921
|
+
[--page <page>]
|
|
922
|
+
|
|
923
|
+
2. Using JSON file:
|
|
924
|
+
$ airborne-core-cli ListFiles @params.json
|
|
925
|
+
|
|
926
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
927
|
+
$ airborne-core-cli ListFiles @params.json --page <value> --per_page <value> --token <value>
|
|
928
|
+
|
|
929
|
+
JSON file format (params.json):
|
|
930
|
+
{
|
|
931
|
+
"page": 123,
|
|
932
|
+
"per_page": 123,
|
|
933
|
+
"search": "example_search",
|
|
934
|
+
"organisation": "example_organisation",
|
|
935
|
+
"application": "example_application",
|
|
936
|
+
"token": "your_bearer_token_here"
|
|
937
|
+
}`)
|
|
938
|
+
.action(async (paramsFile, options) => {
|
|
939
|
+
try {
|
|
940
|
+
|
|
941
|
+
const output = await ListFilesAction(paramsFile, options);
|
|
942
|
+
console.log(printColoredJSON(output));
|
|
943
|
+
process.exit(0);
|
|
944
|
+
} catch (err) {
|
|
945
|
+
console.error("Error message:", err.message);
|
|
946
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
947
|
+
process.exit(1);
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
program
|
|
953
|
+
.command("ListOrganisations")
|
|
954
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
955
|
+
|
|
956
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
957
|
+
.description(`
|
|
958
|
+
List organisations request operation:
|
|
959
|
+
|
|
960
|
+
Usage 1 - Individual options:
|
|
961
|
+
$ airborne-core-cli ListOrganisations \\
|
|
962
|
+
--token <string>
|
|
963
|
+
|
|
964
|
+
Usage 2 - JSON file:
|
|
965
|
+
airborne-core-cli ListOrganisations @file.json
|
|
966
|
+
|
|
967
|
+
Usage 3 - Mixed Usage:
|
|
968
|
+
$ airborne-core-cli ListOrganisations @params.json --token <value>
|
|
969
|
+
|
|
970
|
+
Parameters:
|
|
971
|
+
--token <string> (required) : Bearer token for authentication
|
|
972
|
+
|
|
973
|
+
`)
|
|
974
|
+
.usage('<action> [options]')
|
|
975
|
+
.addHelpText('after', `
|
|
976
|
+
Examples:
|
|
977
|
+
|
|
978
|
+
1. Using individual options:
|
|
979
|
+
$ airborne-core-cli ListOrganisations \\
|
|
980
|
+
--token <string>
|
|
981
|
+
|
|
982
|
+
2. Using JSON file:
|
|
983
|
+
$ airborne-core-cli ListOrganisations @params.json
|
|
984
|
+
|
|
985
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
986
|
+
$ airborne-core-cli ListOrganisations @params.json --token <value>
|
|
987
|
+
|
|
988
|
+
JSON file format (params.json):
|
|
989
|
+
{
|
|
990
|
+
"token": "your_bearer_token_here"
|
|
991
|
+
}`)
|
|
992
|
+
.action(async (paramsFile, options) => {
|
|
993
|
+
try {
|
|
994
|
+
|
|
995
|
+
const output = await ListOrganisationsAction(paramsFile, options);
|
|
996
|
+
console.log(printColoredJSON(output));
|
|
997
|
+
process.exit(0);
|
|
998
|
+
} catch (err) {
|
|
999
|
+
console.error("Error message:", err.message);
|
|
1000
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1001
|
+
process.exit(1);
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
program
|
|
1007
|
+
.command("ListPackages")
|
|
1008
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1009
|
+
.option("--offset <offset>", "offset parameter", (value) => {
|
|
1010
|
+
const parsed = parseInt(value, 10);
|
|
1011
|
+
if (isNaN(parsed)) {
|
|
1012
|
+
throw new Error("--offset must be a valid integer");
|
|
1013
|
+
}
|
|
1014
|
+
return parsed;
|
|
1015
|
+
})
|
|
1016
|
+
.option("--limit <limit>", "limit parameter", (value) => {
|
|
1017
|
+
const parsed = parseInt(value, 10);
|
|
1018
|
+
if (isNaN(parsed)) {
|
|
1019
|
+
throw new Error("--limit must be a valid integer");
|
|
1020
|
+
}
|
|
1021
|
+
return parsed;
|
|
1022
|
+
})
|
|
1023
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1024
|
+
.option("--application <application>", "application parameter")
|
|
1025
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1026
|
+
.description(`
|
|
1027
|
+
List packages request operation:
|
|
1028
|
+
|
|
1029
|
+
Usage 1 - Individual options:
|
|
1030
|
+
$ airborne-core-cli ListPackages \\
|
|
1031
|
+
--organisation <organisation> \\
|
|
1032
|
+
--application <application> \\
|
|
1033
|
+
--token <string> \\
|
|
1034
|
+
[--offset <offset>]
|
|
1035
|
+
|
|
1036
|
+
Usage 2 - JSON file:
|
|
1037
|
+
airborne-core-cli ListPackages @file.json
|
|
1038
|
+
|
|
1039
|
+
Usage 3 - Mixed Usage:
|
|
1040
|
+
$ airborne-core-cli ListPackages @params.json --offset <value> --limit <value> --token <value>
|
|
1041
|
+
|
|
1042
|
+
Parameters:
|
|
1043
|
+
--offset <integer> (optional) : Offset for pagination
|
|
1044
|
+
--limit <integer> (optional) : Limit for pagination
|
|
1045
|
+
--organisation <string> (required) : Name of the organisation
|
|
1046
|
+
--application <string> (required) : Name of the application
|
|
1047
|
+
--token <string> (required) : Bearer token for authentication
|
|
1048
|
+
|
|
1049
|
+
`)
|
|
1050
|
+
.usage('<action> [options]')
|
|
1051
|
+
.addHelpText('after', `
|
|
1052
|
+
Examples:
|
|
1053
|
+
|
|
1054
|
+
1. Using individual options:
|
|
1055
|
+
$ airborne-core-cli ListPackages \\
|
|
1056
|
+
--organisation <organisation> \\
|
|
1057
|
+
--application <application> \\
|
|
1058
|
+
--token <string> \\
|
|
1059
|
+
[--offset <offset>]
|
|
1060
|
+
|
|
1061
|
+
2. Using JSON file:
|
|
1062
|
+
$ airborne-core-cli ListPackages @params.json
|
|
1063
|
+
|
|
1064
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1065
|
+
$ airborne-core-cli ListPackages @params.json --offset <value> --limit <value> --token <value>
|
|
1066
|
+
|
|
1067
|
+
JSON file format (params.json):
|
|
1068
|
+
{
|
|
1069
|
+
"offset": 123,
|
|
1070
|
+
"limit": 123,
|
|
1071
|
+
"organisation": "example_organisation",
|
|
1072
|
+
"application": "example_application",
|
|
1073
|
+
"token": "your_bearer_token_here"
|
|
1074
|
+
}`)
|
|
1075
|
+
.action(async (paramsFile, options) => {
|
|
1076
|
+
try {
|
|
1077
|
+
|
|
1078
|
+
const output = await ListPackagesAction(paramsFile, options);
|
|
1079
|
+
console.log(printColoredJSON(output));
|
|
1080
|
+
process.exit(0);
|
|
1081
|
+
} catch (err) {
|
|
1082
|
+
console.error("Error message:", err.message);
|
|
1083
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1084
|
+
process.exit(1);
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
program
|
|
1090
|
+
.command("ListReleases")
|
|
1091
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1092
|
+
.option("--dimension <dimension>", "dimension parameter")
|
|
1093
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1094
|
+
.option("--application <application>", "application parameter")
|
|
1095
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1096
|
+
.description(`
|
|
1097
|
+
List Releases request operation:
|
|
1098
|
+
|
|
1099
|
+
Usage 1 - Individual options:
|
|
1100
|
+
$ airborne-core-cli ListReleases \\
|
|
1101
|
+
--organisation <organisation> \\
|
|
1102
|
+
--application <application> \\
|
|
1103
|
+
--token <string> \\
|
|
1104
|
+
[--dimension <dimension>]
|
|
1105
|
+
|
|
1106
|
+
Usage 2 - JSON file:
|
|
1107
|
+
airborne-core-cli ListReleases @file.json
|
|
1108
|
+
|
|
1109
|
+
Usage 3 - Mixed Usage:
|
|
1110
|
+
$ airborne-core-cli ListReleases @params.json --dimension <value> --organisation <value> --token <value>
|
|
1111
|
+
|
|
1112
|
+
Parameters:
|
|
1113
|
+
--dimension <string> (optional) : dimension to filter releases in format key1=value1;key2=value2
|
|
1114
|
+
--organisation <string> (required) : Name of the organisation
|
|
1115
|
+
--application <string> (required) : Name of the application
|
|
1116
|
+
--token <string> (required) : Bearer token for authentication
|
|
1117
|
+
|
|
1118
|
+
`)
|
|
1119
|
+
.usage('<action> [options]')
|
|
1120
|
+
.addHelpText('after', `
|
|
1121
|
+
Examples:
|
|
1122
|
+
|
|
1123
|
+
1. Using individual options:
|
|
1124
|
+
$ airborne-core-cli ListReleases \\
|
|
1125
|
+
--organisation <organisation> \\
|
|
1126
|
+
--application <application> \\
|
|
1127
|
+
--token <string> \\
|
|
1128
|
+
[--dimension <dimension>]
|
|
1129
|
+
|
|
1130
|
+
2. Using JSON file:
|
|
1131
|
+
$ airborne-core-cli ListReleases @params.json
|
|
1132
|
+
|
|
1133
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1134
|
+
$ airborne-core-cli ListReleases @params.json --dimension <value> --organisation <value> --token <value>
|
|
1135
|
+
|
|
1136
|
+
JSON file format (params.json):
|
|
1137
|
+
{
|
|
1138
|
+
"dimension": "example_dimension",
|
|
1139
|
+
"organisation": "example_organisation",
|
|
1140
|
+
"application": "example_application",
|
|
1141
|
+
"token": "your_bearer_token_here"
|
|
1142
|
+
}`)
|
|
1143
|
+
.action(async (paramsFile, options) => {
|
|
1144
|
+
try {
|
|
1145
|
+
|
|
1146
|
+
const output = await ListReleasesAction(paramsFile, options);
|
|
1147
|
+
console.log(printColoredJSON(output));
|
|
1148
|
+
process.exit(0);
|
|
1149
|
+
} catch (err) {
|
|
1150
|
+
console.error("Error message:", err.message);
|
|
1151
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1152
|
+
process.exit(1);
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
program
|
|
1158
|
+
.command("PostLogin")
|
|
1159
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1160
|
+
.option("--client_id <client_id>", "client_id parameter")
|
|
1161
|
+
.option("--client_secret <client_secret>", "client_secret parameter")
|
|
1162
|
+
.description(`
|
|
1163
|
+
Login request operation:
|
|
1164
|
+
|
|
1165
|
+
Usage 1 - Individual options:
|
|
1166
|
+
$ airborne-core-cli PostLogin \\
|
|
1167
|
+
--client_id <client_id> \\
|
|
1168
|
+
--client_secret <client_secret>
|
|
1169
|
+
|
|
1170
|
+
Usage 2 - JSON file:
|
|
1171
|
+
airborne-core-cli PostLogin @file.json
|
|
1172
|
+
|
|
1173
|
+
Usage 3 - Mixed Usage:
|
|
1174
|
+
$ airborne-core-cli PostLogin @params.json --client_id <value> --client_secret <value>
|
|
1175
|
+
|
|
1176
|
+
Parameters:
|
|
1177
|
+
--client_id <string> (required) : Gmail of the user
|
|
1178
|
+
--client_secret <string> (required) : Password of the user
|
|
1179
|
+
|
|
1180
|
+
`)
|
|
1181
|
+
.usage('<action> [options]')
|
|
1182
|
+
.addHelpText('after', `
|
|
1183
|
+
Examples:
|
|
1184
|
+
|
|
1185
|
+
1. Using individual options:
|
|
1186
|
+
$ airborne-core-cli PostLogin \\
|
|
1187
|
+
--client_id <client_id> \\
|
|
1188
|
+
--client_secret <client_secret>
|
|
1189
|
+
|
|
1190
|
+
2. Using JSON file:
|
|
1191
|
+
$ airborne-core-cli PostLogin @params.json
|
|
1192
|
+
|
|
1193
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1194
|
+
$ airborne-core-cli PostLogin @params.json --client_id <value> --client_secret <value>
|
|
1195
|
+
|
|
1196
|
+
JSON file format (params.json):
|
|
1197
|
+
{
|
|
1198
|
+
"client_id": "example_client_id",
|
|
1199
|
+
"client_secret": "example_client_secret"
|
|
1200
|
+
}`)
|
|
1201
|
+
.action(async (paramsFile, options) => {
|
|
1202
|
+
try {
|
|
1203
|
+
|
|
1204
|
+
const output = await PostLoginAction(paramsFile, options);
|
|
1205
|
+
console.log(printColoredJSON(output));
|
|
1206
|
+
process.exit(0);
|
|
1207
|
+
} catch (err) {
|
|
1208
|
+
console.error("Error message:", err.message);
|
|
1209
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1210
|
+
process.exit(1);
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
program
|
|
1216
|
+
.command("RequestOrganisation")
|
|
1217
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1218
|
+
.option("--organisation_name <organisation_name>", "organisation_name parameter")
|
|
1219
|
+
.option("--name <name>", "name parameter")
|
|
1220
|
+
.option("--email <email>", "email parameter")
|
|
1221
|
+
.option("--phone <phone>", "phone parameter")
|
|
1222
|
+
.option("--app_store_link <app_store_link>", "app_store_link parameter")
|
|
1223
|
+
.option("--play_store_link <play_store_link>", "play_store_link parameter")
|
|
1224
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1225
|
+
.description(`
|
|
1226
|
+
Request organisation request operation:
|
|
1227
|
+
|
|
1228
|
+
Usage 1 - Individual options:
|
|
1229
|
+
$ airborne-core-cli RequestOrganisation \\
|
|
1230
|
+
--organisation_name <organisation_name> \\
|
|
1231
|
+
--name <name> \\
|
|
1232
|
+
--email <email> \\
|
|
1233
|
+
--phone <phone> \\
|
|
1234
|
+
--app_store_link <app_store_link> \\
|
|
1235
|
+
--play_store_link <play_store_link> \\
|
|
1236
|
+
--token <string>
|
|
1237
|
+
|
|
1238
|
+
Usage 2 - JSON file:
|
|
1239
|
+
airborne-core-cli RequestOrganisation @file.json
|
|
1240
|
+
|
|
1241
|
+
Usage 3 - Mixed Usage:
|
|
1242
|
+
$ airborne-core-cli RequestOrganisation @params.json --organisation_name <value> --name <value> --token <value>
|
|
1243
|
+
|
|
1244
|
+
Parameters:
|
|
1245
|
+
--organisation_name <string> (required) : Name of the organisation
|
|
1246
|
+
--name <string> (required) : Name of the requester
|
|
1247
|
+
--email <string> (required) : Email of the requester
|
|
1248
|
+
--phone <string> (required) : Phone number of the requester
|
|
1249
|
+
--app_store_link <string> (required) : App store link
|
|
1250
|
+
--play_store_link <string> (required) : Play store link
|
|
1251
|
+
--token <string> (required) : Bearer token for authentication
|
|
1252
|
+
|
|
1253
|
+
`)
|
|
1254
|
+
.usage('<action> [options]')
|
|
1255
|
+
.addHelpText('after', `
|
|
1256
|
+
Examples:
|
|
1257
|
+
|
|
1258
|
+
1. Using individual options:
|
|
1259
|
+
$ airborne-core-cli RequestOrganisation \\
|
|
1260
|
+
--organisation_name <organisation_name> \\
|
|
1261
|
+
--name <name> \\
|
|
1262
|
+
--email <email> \\
|
|
1263
|
+
--phone <phone> \\
|
|
1264
|
+
--app_store_link <app_store_link> \\
|
|
1265
|
+
--play_store_link <play_store_link> \\
|
|
1266
|
+
--token <string>
|
|
1267
|
+
|
|
1268
|
+
2. Using JSON file:
|
|
1269
|
+
$ airborne-core-cli RequestOrganisation @params.json
|
|
1270
|
+
|
|
1271
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1272
|
+
$ airborne-core-cli RequestOrganisation @params.json --organisation_name <value> --name <value> --token <value>
|
|
1273
|
+
|
|
1274
|
+
JSON file format (params.json):
|
|
1275
|
+
{
|
|
1276
|
+
"organisation_name": "example_organisation_name",
|
|
1277
|
+
"name": "example_name",
|
|
1278
|
+
"email": "example_email",
|
|
1279
|
+
"phone": "example_phone",
|
|
1280
|
+
"app_store_link": "example_app_store_link",
|
|
1281
|
+
"play_store_link": "example_play_store_link",
|
|
1282
|
+
"token": "your_bearer_token_here"
|
|
1283
|
+
}`)
|
|
1284
|
+
.action(async (paramsFile, options) => {
|
|
1285
|
+
try {
|
|
1286
|
+
|
|
1287
|
+
const output = await RequestOrganisationAction(paramsFile, options);
|
|
1288
|
+
console.log(printColoredJSON(output));
|
|
1289
|
+
process.exit(0);
|
|
1290
|
+
} catch (err) {
|
|
1291
|
+
console.error("Error message:", err.message);
|
|
1292
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1293
|
+
process.exit(1);
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
program
|
|
1299
|
+
.command("ServeRelease")
|
|
1300
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1301
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1302
|
+
.option("--application <application>", "application parameter")
|
|
1303
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1304
|
+
.description(`
|
|
1305
|
+
Get release request operation:
|
|
1306
|
+
|
|
1307
|
+
Usage 1 - Individual options:
|
|
1308
|
+
$ airborne-core-cli ServeRelease \\
|
|
1309
|
+
--organisation <organisation> \\
|
|
1310
|
+
--application <application> \\
|
|
1311
|
+
--token <string>
|
|
1312
|
+
|
|
1313
|
+
Usage 2 - JSON file:
|
|
1314
|
+
airborne-core-cli ServeRelease @file.json
|
|
1315
|
+
|
|
1316
|
+
Usage 3 - Mixed Usage:
|
|
1317
|
+
$ airborne-core-cli ServeRelease @params.json --organisation <value> --application <value> --token <value>
|
|
1318
|
+
|
|
1319
|
+
Parameters:
|
|
1320
|
+
--organisation <string> (required)
|
|
1321
|
+
--application <string> (required)
|
|
1322
|
+
--token <string> (required) : Bearer token for authentication
|
|
1323
|
+
|
|
1324
|
+
`)
|
|
1325
|
+
.usage('<action> [options]')
|
|
1326
|
+
.addHelpText('after', `
|
|
1327
|
+
Examples:
|
|
1328
|
+
|
|
1329
|
+
1. Using individual options:
|
|
1330
|
+
$ airborne-core-cli ServeRelease \\
|
|
1331
|
+
--organisation <organisation> \\
|
|
1332
|
+
--application <application> \\
|
|
1333
|
+
--token <string>
|
|
1334
|
+
|
|
1335
|
+
2. Using JSON file:
|
|
1336
|
+
$ airborne-core-cli ServeRelease @params.json
|
|
1337
|
+
|
|
1338
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1339
|
+
$ airborne-core-cli ServeRelease @params.json --organisation <value> --application <value> --token <value>
|
|
1340
|
+
|
|
1341
|
+
JSON file format (params.json):
|
|
1342
|
+
{
|
|
1343
|
+
"organisation": "example_organisation",
|
|
1344
|
+
"application": "example_application",
|
|
1345
|
+
"token": "your_bearer_token_here"
|
|
1346
|
+
}`)
|
|
1347
|
+
.action(async (paramsFile, options) => {
|
|
1348
|
+
try {
|
|
1349
|
+
|
|
1350
|
+
const output = await ServeReleaseAction(paramsFile, options);
|
|
1351
|
+
console.log(printColoredJSON(output));
|
|
1352
|
+
process.exit(0);
|
|
1353
|
+
} catch (err) {
|
|
1354
|
+
console.error("Error message:", err.message);
|
|
1355
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1356
|
+
process.exit(1);
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
program
|
|
1362
|
+
.command("ServeReleaseV2")
|
|
1363
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1364
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1365
|
+
.option("--application <application>", "application parameter")
|
|
1366
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1367
|
+
.description(`
|
|
1368
|
+
Get release v2 request operation:
|
|
1369
|
+
|
|
1370
|
+
Usage 1 - Individual options:
|
|
1371
|
+
$ airborne-core-cli ServeReleaseV2 \\
|
|
1372
|
+
--organisation <organisation> \\
|
|
1373
|
+
--application <application> \\
|
|
1374
|
+
--token <string>
|
|
1375
|
+
|
|
1376
|
+
Usage 2 - JSON file:
|
|
1377
|
+
airborne-core-cli ServeReleaseV2 @file.json
|
|
1378
|
+
|
|
1379
|
+
Usage 3 - Mixed Usage:
|
|
1380
|
+
$ airborne-core-cli ServeReleaseV2 @params.json --organisation <value> --application <value> --token <value>
|
|
1381
|
+
|
|
1382
|
+
Parameters:
|
|
1383
|
+
--organisation <string> (required)
|
|
1384
|
+
--application <string> (required)
|
|
1385
|
+
--token <string> (required) : Bearer token for authentication
|
|
1386
|
+
|
|
1387
|
+
`)
|
|
1388
|
+
.usage('<action> [options]')
|
|
1389
|
+
.addHelpText('after', `
|
|
1390
|
+
Examples:
|
|
1391
|
+
|
|
1392
|
+
1. Using individual options:
|
|
1393
|
+
$ airborne-core-cli ServeReleaseV2 \\
|
|
1394
|
+
--organisation <organisation> \\
|
|
1395
|
+
--application <application> \\
|
|
1396
|
+
--token <string>
|
|
1397
|
+
|
|
1398
|
+
2. Using JSON file:
|
|
1399
|
+
$ airborne-core-cli ServeReleaseV2 @params.json
|
|
1400
|
+
|
|
1401
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1402
|
+
$ airborne-core-cli ServeReleaseV2 @params.json --organisation <value> --application <value> --token <value>
|
|
1403
|
+
|
|
1404
|
+
JSON file format (params.json):
|
|
1405
|
+
{
|
|
1406
|
+
"organisation": "example_organisation",
|
|
1407
|
+
"application": "example_application",
|
|
1408
|
+
"token": "your_bearer_token_here"
|
|
1409
|
+
}`)
|
|
1410
|
+
.action(async (paramsFile, options) => {
|
|
1411
|
+
try {
|
|
1412
|
+
|
|
1413
|
+
const output = await ServeReleaseV2Action(paramsFile, options);
|
|
1414
|
+
console.log(printColoredJSON(output));
|
|
1415
|
+
process.exit(0);
|
|
1416
|
+
} catch (err) {
|
|
1417
|
+
console.error("Error message:", err.message);
|
|
1418
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1419
|
+
process.exit(1);
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
program
|
|
1425
|
+
.command("UpdateDimension")
|
|
1426
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1427
|
+
.option("--dimension <dimension>", "dimension parameter")
|
|
1428
|
+
.option("--change_reason <change_reason>", "change_reason parameter")
|
|
1429
|
+
.option("--position <position>", "position parameter", (value) => {
|
|
1430
|
+
const parsed = parseInt(value, 10);
|
|
1431
|
+
if (isNaN(parsed)) {
|
|
1432
|
+
throw new Error("--position must be a valid integer");
|
|
1433
|
+
}
|
|
1434
|
+
return parsed;
|
|
1435
|
+
})
|
|
1436
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1437
|
+
.option("--application <application>", "application parameter")
|
|
1438
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1439
|
+
.description(`
|
|
1440
|
+
Update dimension request operation:
|
|
1441
|
+
|
|
1442
|
+
Usage 1 - Individual options:
|
|
1443
|
+
$ airborne-core-cli UpdateDimension \\
|
|
1444
|
+
--dimension <dimension> \\
|
|
1445
|
+
--change_reason <change_reason> \\
|
|
1446
|
+
--position <position> \\
|
|
1447
|
+
--organisation <organisation> \\
|
|
1448
|
+
--application <application> \\
|
|
1449
|
+
--token <string>
|
|
1450
|
+
|
|
1451
|
+
Usage 2 - JSON file:
|
|
1452
|
+
airborne-core-cli UpdateDimension @file.json
|
|
1453
|
+
|
|
1454
|
+
Usage 3 - Mixed Usage:
|
|
1455
|
+
$ airborne-core-cli UpdateDimension @params.json --dimension <value> --change_reason <value> --token <value>
|
|
1456
|
+
|
|
1457
|
+
Parameters:
|
|
1458
|
+
--dimension <string> (required) : Name of the dimension
|
|
1459
|
+
--change_reason <string> (required) : Reason for the change
|
|
1460
|
+
--position <integer> (required) : New position of the dimension
|
|
1461
|
+
--organisation <string> (required) : Name of the organisation
|
|
1462
|
+
--application <string> (required) : Name of the application
|
|
1463
|
+
--token <string> (required) : Bearer token for authentication
|
|
1464
|
+
|
|
1465
|
+
`)
|
|
1466
|
+
.usage('<action> [options]')
|
|
1467
|
+
.addHelpText('after', `
|
|
1468
|
+
Examples:
|
|
1469
|
+
|
|
1470
|
+
1. Using individual options:
|
|
1471
|
+
$ airborne-core-cli UpdateDimension \\
|
|
1472
|
+
--dimension <dimension> \\
|
|
1473
|
+
--change_reason <change_reason> \\
|
|
1474
|
+
--position <position> \\
|
|
1475
|
+
--organisation <organisation> \\
|
|
1476
|
+
--application <application> \\
|
|
1477
|
+
--token <string>
|
|
1478
|
+
|
|
1479
|
+
2. Using JSON file:
|
|
1480
|
+
$ airborne-core-cli UpdateDimension @params.json
|
|
1481
|
+
|
|
1482
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1483
|
+
$ airborne-core-cli UpdateDimension @params.json --dimension <value> --change_reason <value> --token <value>
|
|
1484
|
+
|
|
1485
|
+
JSON file format (params.json):
|
|
1486
|
+
{
|
|
1487
|
+
"dimension": "example_dimension",
|
|
1488
|
+
"change_reason": "example_change_reason",
|
|
1489
|
+
"position": 123,
|
|
1490
|
+
"organisation": "example_organisation",
|
|
1491
|
+
"application": "example_application",
|
|
1492
|
+
"token": "your_bearer_token_here"
|
|
1493
|
+
}`)
|
|
1494
|
+
.action(async (paramsFile, options) => {
|
|
1495
|
+
try {
|
|
1496
|
+
|
|
1497
|
+
const output = await UpdateDimensionAction(paramsFile, options);
|
|
1498
|
+
console.log(printColoredJSON(output));
|
|
1499
|
+
process.exit(0);
|
|
1500
|
+
} catch (err) {
|
|
1501
|
+
console.error("Error message:", err.message);
|
|
1502
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1503
|
+
process.exit(1);
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
program
|
|
1509
|
+
.command("UploadFile")
|
|
1510
|
+
.argument('[params_file]', 'JSON file containing all parameters (use @params.json format)')
|
|
1511
|
+
.option("--file <file>", "file parameter (file path, supports streaming)", (value) => {
|
|
1512
|
+
try {
|
|
1513
|
+
if (!fs.existsSync(value)) {
|
|
1514
|
+
throw new Error(`File not found: ${value}`);
|
|
1515
|
+
}
|
|
1516
|
+
return value; // Return path, will be processed later
|
|
1517
|
+
} catch (err) {
|
|
1518
|
+
throw new Error("--file must be a valid file path");
|
|
1519
|
+
}
|
|
1520
|
+
})
|
|
1521
|
+
.option("--file_path <file_path>", "file_path parameter")
|
|
1522
|
+
.option("--tag <tag>", "tag parameter")
|
|
1523
|
+
.option("--checksum <checksum>", "checksum parameter")
|
|
1524
|
+
.option("--organisation <organisation>", "organisation parameter")
|
|
1525
|
+
.option("--application <application>", "application parameter")
|
|
1526
|
+
.option("--token <token>", "Bearer token for authentication")
|
|
1527
|
+
.description(`
|
|
1528
|
+
Upload file request operation:
|
|
1529
|
+
|
|
1530
|
+
Usage 1 - Individual options:
|
|
1531
|
+
$ airborne-core-cli UploadFile \\
|
|
1532
|
+
--file <file-path> \\
|
|
1533
|
+
--file_path <file_path> \\
|
|
1534
|
+
--checksum <checksum> \\
|
|
1535
|
+
--organisation <organisation> \\
|
|
1536
|
+
--application <application> \\
|
|
1537
|
+
--token <string> \\
|
|
1538
|
+
[--tag <tag>]
|
|
1539
|
+
|
|
1540
|
+
Usage 2 - JSON file:
|
|
1541
|
+
airborne-core-cli UploadFile @file.json
|
|
1542
|
+
|
|
1543
|
+
Usage 3 - Mixed Usage:
|
|
1544
|
+
$ airborne-core-cli UploadFile @params.json --file <file-path> --file_path <value> --token <value>
|
|
1545
|
+
|
|
1546
|
+
Parameters:
|
|
1547
|
+
--file <file-path> (streaming) (required) : File path of file to be uploaded
|
|
1548
|
+
--file_path <string> (required) : Path where the file will be stored on sdk
|
|
1549
|
+
--tag <string> (optional) : tag to identify the file
|
|
1550
|
+
--checksum <string> (required) : SHA-256 digest of the file, encoded in Base64, used by the server to verify the integrity of the uploaded file
|
|
1551
|
+
--organisation <string> (required)
|
|
1552
|
+
--application <string> (required) : Name of the application
|
|
1553
|
+
--token <string> (required) : Bearer token for authentication
|
|
1554
|
+
|
|
1555
|
+
`)
|
|
1556
|
+
.usage('<action> [options]')
|
|
1557
|
+
.addHelpText('after', `
|
|
1558
|
+
Examples:
|
|
1559
|
+
|
|
1560
|
+
1. Using individual options:
|
|
1561
|
+
$ airborne-core-cli UploadFile \\
|
|
1562
|
+
--file <file-path> \\
|
|
1563
|
+
--file_path <file_path> \\
|
|
1564
|
+
--checksum <checksum> \\
|
|
1565
|
+
--organisation <organisation> \\
|
|
1566
|
+
--application <application> \\
|
|
1567
|
+
--token <string> \\
|
|
1568
|
+
[--tag <tag>]
|
|
1569
|
+
|
|
1570
|
+
2. Using JSON file:
|
|
1571
|
+
$ airborne-core-cli UploadFile @params.json
|
|
1572
|
+
|
|
1573
|
+
3. Mixed approach (JSON file + CLI overrides):
|
|
1574
|
+
$ airborne-core-cli UploadFile @params.json --file <file-path> --file_path <value> --token <value>
|
|
1575
|
+
|
|
1576
|
+
JSON file format (params.json):
|
|
1577
|
+
{
|
|
1578
|
+
"file": "./path/to/file.bin",
|
|
1579
|
+
"file_path": "example_file_path",
|
|
1580
|
+
"tag": "example_tag",
|
|
1581
|
+
"checksum": "example_checksum",
|
|
1582
|
+
"organisation": "example_organisation",
|
|
1583
|
+
"application": "example_application",
|
|
1584
|
+
"token": "your_bearer_token_here"
|
|
1585
|
+
}`)
|
|
1586
|
+
.action(async (paramsFile, options) => {
|
|
1587
|
+
try {
|
|
1588
|
+
|
|
1589
|
+
const output = await UploadFileAction(paramsFile, options);
|
|
1590
|
+
console.log(printColoredJSON(output));
|
|
1591
|
+
process.exit(0);
|
|
1592
|
+
} catch (err) {
|
|
1593
|
+
console.error("Error message:", err.message);
|
|
1594
|
+
console.error("Error executing:", printColoredJSON(err));
|
|
1595
|
+
process.exit(1);
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
program
|
|
1601
|
+
.command("configure")
|
|
1602
|
+
.requiredOption("-u, --base-url <url>", "Base endpoint URL for the API")
|
|
1603
|
+
.description(`
|
|
1604
|
+
Configure the CLI to use a specific API base URL.
|
|
1605
|
+
|
|
1606
|
+
This command allows you to set or update the base API endpoint used by all subsequent CLI operations.
|
|
1607
|
+
It is typically the first command you should run before using any other commands.
|
|
1608
|
+
|
|
1609
|
+
Usage:
|
|
1610
|
+
$ example-cli configure --base-url <api-url>
|
|
1611
|
+
|
|
1612
|
+
Parameters:
|
|
1613
|
+
-u, --base-url <url> (required)
|
|
1614
|
+
The base URL of your API endpoint.
|
|
1615
|
+
Example: https://api.example.com or http://localhost:3000
|
|
1616
|
+
|
|
1617
|
+
Examples:
|
|
1618
|
+
|
|
1619
|
+
1. Setting the base URL for production:
|
|
1620
|
+
$ example-cli configure --base-url https://api.example.com
|
|
1621
|
+
|
|
1622
|
+
2. Setting the base URL for local development:
|
|
1623
|
+
$ example-cli configure --base-url http://localhost:3000
|
|
1624
|
+
|
|
1625
|
+
3. Overriding an existing configuration:
|
|
1626
|
+
$ example-cli configure -u https://staging.example.com
|
|
1627
|
+
|
|
1628
|
+
`)
|
|
1629
|
+
.usage('--base-url <url>')
|
|
1630
|
+
.action(async (options) => {
|
|
1631
|
+
try {
|
|
1632
|
+
await setBaseUrl(options.baseUrl);
|
|
1633
|
+
console.log(`✅ Base URL set to: ${options.baseUrl}`);
|
|
1634
|
+
process.exit(0);
|
|
1635
|
+
} catch (err) {
|
|
1636
|
+
console.error("❌ Failed to create config", err.message);
|
|
1637
|
+
process.exit(1);
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
export default program;
|