swaggerhub-cli 0.13.0 → 0.15.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/README.md +209 -122
- package/bin/run +5 -4
- package/oclif.manifest.json +283 -122
- package/package.json +14 -12
- package/src/check-node-version.js +3 -2
- package/src/commands/api/clone.js +66 -0
- package/src/commands/api/create.js +10 -10
- package/src/commands/api/delete.js +7 -7
- package/src/commands/api/get.js +9 -9
- package/src/commands/api/publish.js +7 -7
- package/src/commands/api/rename.js +8 -10
- package/src/commands/api/setdefault.js +6 -6
- package/src/commands/api/unpublish.js +5 -5
- package/src/commands/api/update.js +11 -11
- package/src/commands/api/validate/download-rules.js +11 -11
- package/src/commands/api/validate/index.js +10 -10
- package/src/commands/api/validate/local.js +11 -11
- package/src/commands/configure.js +8 -8
- package/src/commands/domain/clone.js +66 -0
- package/src/commands/domain/create.js +14 -14
- package/src/commands/domain/delete.js +7 -7
- package/src/commands/domain/get.js +8 -8
- package/src/commands/domain/publish.js +6 -6
- package/src/commands/domain/rename.js +78 -0
- package/src/commands/domain/setdefault.js +6 -6
- package/src/commands/domain/unpublish.js +6 -6
- package/src/commands/domain/update.js +11 -11
- package/src/commands/integration/create.js +7 -7
- package/src/commands/integration/delete.js +6 -6
- package/src/commands/integration/execute.js +6 -6
- package/src/commands/integration/get.js +9 -9
- package/src/commands/integration/list.js +7 -7
- package/src/commands/integration/update.js +6 -6
- package/src/commands/project/api/add.js +7 -9
- package/src/commands/project/api/remove.js +10 -13
- package/src/commands/project/create.js +9 -13
- package/src/commands/project/delete.js +7 -7
- package/src/commands/project/domain/add.js +7 -9
- package/src/commands/project/domain/remove.js +10 -13
- package/src/commands/project/get.js +8 -8
- package/src/commands/project/list.js +6 -6
- package/src/commands/project/member/list.js +8 -8
- package/src/commands/spectral/download.js +9 -9
- package/src/commands/spectral/upload.js +11 -11
- package/src/config/index.js +18 -4
- package/src/format-readme.js +3 -2
- package/src/help.js +2 -2
- package/src/hooks/setup-config.js +9 -5
- package/src/index.js +2 -2
- package/src/requests/api.js +3 -3
- package/src/requests/domain.js +3 -3
- package/src/requests/project.js +2 -2
- package/src/requests/spec.js +5 -5
- package/src/requests/spectral.js +3 -3
- package/src/requests/standardization.js +4 -4
- package/src/support/command/base-command.js +11 -12
- package/src/support/command/base-validate-command.js +3 -3
- package/src/support/command/handle-response.js +7 -5
- package/src/support/command/parse-input.js +8 -6
- package/src/support/command/update-command.js +5 -5
- package/src/support/http/default-headers.js +1 -1
- package/src/support/http/header-templates.js +2 -2
- package/src/support/http/index.js +7 -7
- package/src/support/http/proxy-agent.js +4 -4
- package/src/support/inquirer/index.js +4 -4
- package/src/support/inquirer/prompt-templates.js +3 -3
- package/src/support/isOnPrem.js +3 -3
- package/src/template-strings/errors.js +6 -6
- package/src/template-strings/index.js +3 -3
- package/src/template-strings/info.js +10 -4
- package/src/utils/definitions.js +8 -6
- package/src/utils/general.js +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { getDomain, postDomain } from '../../requests/domain.js'
|
|
4
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
5
|
+
import { getVersion, parseDefinition } from '../../utils/definitions.js'
|
|
6
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
7
|
+
import UpdateCommand from '../../support/command/update-command.js'
|
|
8
8
|
|
|
9
9
|
const isDomainNameAvailable = response => response.status === 404
|
|
10
10
|
|
|
@@ -62,8 +62,8 @@ class CreateDomainCommand extends UpdateCommand {
|
|
|
62
62
|
const { args, flags } = await this.parse(CreateDomainCommand)
|
|
63
63
|
const definition = parseDefinition(flags.file)
|
|
64
64
|
const domainVersion = getVersion(definition)
|
|
65
|
-
const
|
|
66
|
-
const [owner, name, version = domainVersion] = splitPathParams(
|
|
65
|
+
const domainPath = getDomainIdentifierArg(args)
|
|
66
|
+
const [owner, name, version = domainVersion] = splitPathParams(domainPath)
|
|
67
67
|
const type = 'domains'
|
|
68
68
|
|
|
69
69
|
const argsObj = {
|
|
@@ -96,15 +96,15 @@ An error will occur if the domain version already exists.
|
|
|
96
96
|
CreateDomainCommand.examples = [
|
|
97
97
|
'swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public',
|
|
98
98
|
'swaggerhub domain:create organization/domain --file domain.yaml',
|
|
99
|
-
'swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json',
|
|
99
|
+
'swaggerhub domain:create organization/domain/1.0.0 --published=publish --file domain.json',
|
|
100
100
|
'swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json',
|
|
101
|
-
'swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json'
|
|
101
|
+
'swaggerhub domain:create organization/domain/1.0.0 --published=publish --setdefault --file domain.json'
|
|
102
102
|
]
|
|
103
103
|
|
|
104
104
|
CreateDomainCommand.args = {
|
|
105
105
|
'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
|
|
106
106
|
required: true,
|
|
107
|
-
description: 'Domain to create on
|
|
107
|
+
description: 'Domain to create on Swagger'
|
|
108
108
|
})
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -115,7 +115,7 @@ CreateDomainCommand.flags = {
|
|
|
115
115
|
required: true
|
|
116
116
|
}),
|
|
117
117
|
visibility: Flags.string({
|
|
118
|
-
description: 'visibility of domain in
|
|
118
|
+
description: 'visibility of domain in Swagger',
|
|
119
119
|
options: ['public', 'private'],
|
|
120
120
|
default: 'private'
|
|
121
121
|
}),
|
|
@@ -135,4 +135,4 @@ CreateDomainCommand.flags = {
|
|
|
135
135
|
...BaseCommand.flags
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
export default CreateDomainCommand
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { deleteDomain } from '../../requests/domain.js'
|
|
3
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
5
|
+
import inquirer from 'inquirer'
|
|
6
6
|
|
|
7
7
|
class DeleteDomainCommand extends BaseCommand {
|
|
8
8
|
|
|
@@ -49,7 +49,7 @@ DeleteDomainCommand.examples = [
|
|
|
49
49
|
DeleteDomainCommand.args = {
|
|
50
50
|
'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
|
|
51
51
|
required: true,
|
|
52
|
-
description: 'Domain to delete on
|
|
52
|
+
description: 'Domain to delete on Swagger'
|
|
53
53
|
})
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -61,4 +61,4 @@ DeleteDomainCommand.flags = {
|
|
|
61
61
|
...BaseCommand.flags
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
export default DeleteDomainCommand
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { getDomainIdentifierArg, reqType, resolvedParam, splitPathParams } from '../../support/command/parse-input.js'
|
|
3
|
+
import { hasJsonStructure, prettyPrintJSON } from '../../utils/general.js'
|
|
4
|
+
import { getDomain } from '../../requests/domain.js'
|
|
5
|
+
import { getResponseContent } from '../../support/command/handle-response.js'
|
|
6
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
7
7
|
|
|
8
8
|
class GetDomainCommand extends BaseCommand {
|
|
9
9
|
constructor(...props) {
|
|
@@ -54,7 +54,7 @@ GetDomainCommand.examples = [
|
|
|
54
54
|
GetDomainCommand.args = {
|
|
55
55
|
'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
|
|
56
56
|
required: true,
|
|
57
|
-
description: 'Domain to fetch from
|
|
57
|
+
description: 'Domain to fetch from Swagger'
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -66,4 +66,4 @@ GetDomainCommand.flags = {
|
|
|
66
66
|
...BaseCommand.flags
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
export default GetDomainCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
3
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
4
|
+
import UpdateCommand from '../../support/command/update-command.js'
|
|
5
5
|
|
|
6
6
|
class PublishCommand extends UpdateCommand {
|
|
7
7
|
|
|
@@ -24,7 +24,7 @@ PublishCommand.examples = [
|
|
|
24
24
|
PublishCommand.args = {
|
|
25
25
|
'OWNER/DOMAIN_NAME/VERSION': Args.string({
|
|
26
26
|
required: true,
|
|
27
|
-
description: 'Domain to publish on
|
|
27
|
+
description: 'Domain to publish on Swagger'
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -36,4 +36,4 @@ PublishCommand.flags = {
|
|
|
36
36
|
...BaseCommand.flags
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
export default PublishCommand
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
2
|
+
import { Args, Flags, Errors } from '@oclif/core'
|
|
3
|
+
import {
|
|
4
|
+
noVersionRegex,
|
|
5
|
+
apiNameRegex
|
|
6
|
+
} from '../../support/command/parse-input.js'
|
|
7
|
+
import { errorMsg } from '../../template-strings/index.js'
|
|
8
|
+
import { postDomain } from '../../requests/domain.js'
|
|
9
|
+
|
|
10
|
+
const { CLIError } = Errors
|
|
11
|
+
|
|
12
|
+
const getDomainToRename = args => {
|
|
13
|
+
const domainPath = args['OWNER/DOMAIN_NAME']
|
|
14
|
+
if (!noVersionRegex.test(domainPath)) {
|
|
15
|
+
throw new CLIError(errorMsg.argsMustMatchFormat({ format: 'OWNER/DOMAIN_NAME' }))
|
|
16
|
+
}
|
|
17
|
+
return domainPath
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const getDomainNewName = args => {
|
|
21
|
+
const newName = args['DOMAIN_NEW_NAME']
|
|
22
|
+
if (!apiNameRegex.test(newName)) {
|
|
23
|
+
throw new CLIError(errorMsg.argsMustMatchFormat({ format: 'DOMAIN_NEW_NAME' }))
|
|
24
|
+
}
|
|
25
|
+
return newName
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class RenameDomainCommand extends BaseCommand {
|
|
29
|
+
|
|
30
|
+
async run() {
|
|
31
|
+
const { args, flags } = await this.parse(RenameDomainCommand)
|
|
32
|
+
|
|
33
|
+
const domainPath = getDomainToRename(args)
|
|
34
|
+
const newName = getDomainNewName(args)
|
|
35
|
+
const queryParams = { newName }
|
|
36
|
+
if (flags.force) queryParams.force = 'true'
|
|
37
|
+
|
|
38
|
+
this.log(`Renaming domain: '${domainPath}' to '${newName}'`)
|
|
39
|
+
|
|
40
|
+
await this.executeHttp({
|
|
41
|
+
execute: () => postDomain({
|
|
42
|
+
pathParams: [domainPath, 'rename'],
|
|
43
|
+
queryParams,
|
|
44
|
+
body: '{}'
|
|
45
|
+
}),
|
|
46
|
+
onResolve: this.logCommandSuccess({ domainPath, newName }),
|
|
47
|
+
options: {}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
RenameDomainCommand.description = 'rename a domain'
|
|
53
|
+
|
|
54
|
+
RenameDomainCommand.examples = [
|
|
55
|
+
'swaggerhub domain:rename organization/domainOldName domainNewName',
|
|
56
|
+
'swaggerhub domain:rename organization/domainOldName domainNewName --force'
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
RenameDomainCommand.args = {
|
|
60
|
+
'OWNER/DOMAIN_NAME': Args.string({
|
|
61
|
+
required: true,
|
|
62
|
+
description: 'Domain to be renamed'
|
|
63
|
+
}),
|
|
64
|
+
'DOMAIN_NEW_NAME': Args.string({
|
|
65
|
+
required: true,
|
|
66
|
+
description: 'New name for the domain'
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
RenameDomainCommand.flags = {
|
|
71
|
+
force: Flags.boolean({
|
|
72
|
+
char: 'f',
|
|
73
|
+
description: 'rename the domain even if it is referenced by APIs or other domains'
|
|
74
|
+
}),
|
|
75
|
+
...BaseCommand.flags
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default RenameDomainCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
3
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
4
|
+
import UpdateCommand from '../../support/command/update-command.js'
|
|
5
5
|
|
|
6
6
|
class SetDefaultDomainCommand extends UpdateCommand {
|
|
7
7
|
|
|
@@ -23,10 +23,10 @@ SetDefaultDomainCommand.examples = [
|
|
|
23
23
|
SetDefaultDomainCommand.args = {
|
|
24
24
|
'OWNER/DOMAIN_NAME/VERSION': Args.string({
|
|
25
25
|
required: true,
|
|
26
|
-
description: 'Domain to set as default on
|
|
26
|
+
description: 'Domain to set as default on Swagger'
|
|
27
27
|
})
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
SetDefaultDomainCommand.flags = BaseCommand.flags
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
export default SetDefaultDomainCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
3
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
4
|
+
import UpdateCommand from '../../support/command/update-command.js'
|
|
5
5
|
|
|
6
6
|
class UnpublishCommand extends UpdateCommand {
|
|
7
7
|
|
|
@@ -23,10 +23,10 @@ UnpublishCommand.examples = [
|
|
|
23
23
|
UnpublishCommand.args = {
|
|
24
24
|
'OWNER/DOMAIN_NAME/VERSION': Args.string({
|
|
25
25
|
required: true,
|
|
26
|
-
description: 'Domain to unpublish on
|
|
26
|
+
description: 'Domain to unpublish on Swagger'
|
|
27
27
|
})
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
UnpublishCommand.flags = BaseCommand.flags
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
export default UnpublishCommand
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { getDomain, postDomain } from '../../requests/domain.js'
|
|
4
|
+
import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
5
|
+
import { getVersion, parseDefinition } from '../../utils/definitions.js'
|
|
6
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
7
|
+
import UpdateCommand from '../../support/command/update-command.js'
|
|
8
8
|
|
|
9
9
|
class UpdateDomainCommand extends UpdateCommand {
|
|
10
10
|
|
|
@@ -65,7 +65,7 @@ class UpdateDomainCommand extends UpdateCommand {
|
|
|
65
65
|
UpdateDomainCommand.description = `update a domain
|
|
66
66
|
The domain version from the file will be used unless the version is specified in the command argument.
|
|
67
67
|
When no file is specified then the default domain version will be updated.
|
|
68
|
-
The domain visibility can be changed by using visibility flag.
|
|
68
|
+
The domain visibility can be changed by using the --visibility flag.
|
|
69
69
|
`
|
|
70
70
|
|
|
71
71
|
UpdateDomainCommand.examples = [
|
|
@@ -80,7 +80,7 @@ UpdateDomainCommand.examples = [
|
|
|
80
80
|
UpdateDomainCommand.args = {
|
|
81
81
|
'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
|
|
82
82
|
required: true,
|
|
83
|
-
description: 'Domain to update on
|
|
83
|
+
description: 'Domain to update on Swagger'
|
|
84
84
|
})
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -92,7 +92,7 @@ UpdateDomainCommand.flags = {
|
|
|
92
92
|
multiple: false
|
|
93
93
|
}),
|
|
94
94
|
visibility: Flags.string({
|
|
95
|
-
description: 'visibility of domain in
|
|
95
|
+
description: 'visibility of domain in Swagger',
|
|
96
96
|
options: ['public', 'private']
|
|
97
97
|
}),
|
|
98
98
|
published: Flags.string({
|
|
@@ -107,4 +107,4 @@ UpdateDomainCommand.flags = {
|
|
|
107
107
|
...BaseCommand.flags
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
export default UpdateDomainCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { postApi } from '../../requests/api.js'
|
|
3
|
+
import { getApiIdentifierArg, readConfigFile } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
5
5
|
|
|
6
6
|
class CreateIntegrationCommand extends BaseCommand {
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ class CreateIntegrationCommand extends BaseCommand {
|
|
|
30
30
|
|
|
31
31
|
CreateIntegrationCommand.description = `creates a new API integration from a JSON configuration file.
|
|
32
32
|
See the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/main/examples/integrations
|
|
33
|
-
When VERSION is not included in the argument, the integration will be added to
|
|
33
|
+
When VERSION is not included in the argument, the integration will be added to the default API version.
|
|
34
34
|
`
|
|
35
35
|
|
|
36
36
|
CreateIntegrationCommand.examples = [
|
|
@@ -40,7 +40,7 @@ CreateIntegrationCommand.examples = [
|
|
|
40
40
|
CreateIntegrationCommand.args = {
|
|
41
41
|
'OWNER/API_NAME/[VERSION]': Args.string({
|
|
42
42
|
required: true,
|
|
43
|
-
description: 'API to add integration to on
|
|
43
|
+
description: 'API to add integration to on Swagger'
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -53,4 +53,4 @@ CreateIntegrationCommand.flags = {
|
|
|
53
53
|
...BaseCommand.flags
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
export default CreateIntegrationCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { deleteApi } from '../../requests/api.js'
|
|
3
|
+
import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
5
5
|
|
|
6
6
|
class DeleteIntegrationCommand extends BaseCommand {
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ DeleteIntegrationCommand.examples = [
|
|
|
31
31
|
DeleteIntegrationCommand.args = {
|
|
32
32
|
'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
|
|
33
33
|
required: true,
|
|
34
|
-
description: 'Integration to delete for given API on
|
|
34
|
+
description: 'Integration to delete for given API on Swagger'
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -39,4 +39,4 @@ DeleteIntegrationCommand.flags = {
|
|
|
39
39
|
...BaseCommand.flags
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
export default DeleteIntegrationCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { postApi } from '../../requests/api.js'
|
|
3
|
+
import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
5
5
|
|
|
6
6
|
class ExecuteIntegrationCommand extends BaseCommand {
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ ExecuteIntegrationCommand.examples = [
|
|
|
31
31
|
ExecuteIntegrationCommand.args = {
|
|
32
32
|
'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
|
|
33
33
|
required: true,
|
|
34
|
-
description: 'Integration to execute for given API on
|
|
34
|
+
description: 'Integration to execute for given API on Swagger'
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -39,4 +39,4 @@ ExecuteIntegrationCommand.flags = {
|
|
|
39
39
|
...BaseCommand.flags
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
export default ExecuteIntegrationCommand
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { getApi } from '../../requests/api.js'
|
|
3
|
+
import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import { getResponseContent } from '../../support/command/handle-response.js'
|
|
5
|
+
import { prettyPrintJSON } from '../../utils/general.js'
|
|
6
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
7
7
|
|
|
8
8
|
class GetIntegrationCommand extends BaseCommand {
|
|
9
9
|
constructor(...props) {
|
|
@@ -33,7 +33,7 @@ class GetIntegrationCommand extends BaseCommand {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
GetIntegrationCommand.description = '
|
|
36
|
+
GetIntegrationCommand.description = 'retrieves an integration for the given API.'
|
|
37
37
|
|
|
38
38
|
GetIntegrationCommand.examples = [
|
|
39
39
|
'swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704'
|
|
@@ -42,7 +42,7 @@ GetIntegrationCommand.examples = [
|
|
|
42
42
|
GetIntegrationCommand.args = {
|
|
43
43
|
'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
|
|
44
44
|
required: true,
|
|
45
|
-
description: 'Integration to fetch for given API on
|
|
45
|
+
description: 'Integration to fetch for given API on Swagger'
|
|
46
46
|
})
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -50,4 +50,4 @@ GetIntegrationCommand.flags = {
|
|
|
50
50
|
...BaseCommand.flags
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
export default GetIntegrationCommand
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ux, Args } from '@oclif/core'
|
|
2
|
+
import { getApi } from '../../requests/api.js'
|
|
3
|
+
import { getResponseContent } from '../../support/command/handle-response.js'
|
|
4
|
+
import { getApiIdentifierArg } from '../../support/command/parse-input.js'
|
|
5
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
6
6
|
|
|
7
7
|
class ListIntegrationCommand extends BaseCommand {
|
|
8
8
|
constructor(...props) {
|
|
@@ -52,7 +52,7 @@ ListIntegrationCommand.examples = [
|
|
|
52
52
|
ListIntegrationCommand.args = {
|
|
53
53
|
'OWNER/API_NAME/[VERSION]': Args.string({
|
|
54
54
|
required: true,
|
|
55
|
-
description: 'API to list integrations for
|
|
55
|
+
description: 'API to list integrations for'
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -60,4 +60,4 @@ ListIntegrationCommand.flags = {
|
|
|
60
60
|
...BaseCommand.flags
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
export default ListIntegrationCommand
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { putApi } from '../../requests/api.js'
|
|
3
|
+
import { getIntegrationIdentifierArg, readConfigFile, splitPathParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
5
5
|
|
|
6
6
|
class UpdateIntegrationCommand extends BaseCommand {
|
|
7
7
|
|
|
@@ -36,7 +36,7 @@ UpdateIntegrationCommand.examples = [
|
|
|
36
36
|
UpdateIntegrationCommand.args = {
|
|
37
37
|
'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
|
|
38
38
|
required: true,
|
|
39
|
-
description: 'Integration to update for given API on
|
|
39
|
+
description: 'Integration to update for given API on Swagger'
|
|
40
40
|
})
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -49,4 +49,4 @@ UpdateIntegrationCommand.flags = {
|
|
|
49
49
|
...BaseCommand.flags
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
export default UpdateIntegrationCommand
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} = require('../../../support/command/parse-input')
|
|
6
|
-
const BaseCommand = require('../../../support/command/base-command')
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { putProject } from '../../../requests/project.js'
|
|
3
|
+
import { getProjectIdentifierArg } from '../../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../../support/command/base-command.js'
|
|
7
5
|
|
|
8
6
|
class ProjectApiAddCommand extends BaseCommand {
|
|
9
7
|
|
|
@@ -35,12 +33,12 @@ ProjectApiAddCommand.examples = [
|
|
|
35
33
|
ProjectApiAddCommand.args = {
|
|
36
34
|
'OWNER/PROJECT_NAME': Args.string({
|
|
37
35
|
required: true,
|
|
38
|
-
description: 'The project to add the API to on
|
|
36
|
+
description: 'The project to add the API to on Swagger'
|
|
39
37
|
}),
|
|
40
38
|
'API': Args.string({
|
|
41
39
|
required: true,
|
|
42
|
-
description: 'The name of the API on
|
|
40
|
+
description: 'The name of the API on Swagger to add'
|
|
43
41
|
})
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
export default ProjectApiAddCommand
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
const BaseCommand = require('../../../support/command/base-command')
|
|
8
|
-
const { getResponseContent } = require('../../../support/command/handle-response')
|
|
9
|
-
const { pipeAsync } = require('../../../utils/general')
|
|
1
|
+
import { Args } from '@oclif/core'
|
|
2
|
+
import { putProject, getProject } from '../../../requests/project.js'
|
|
3
|
+
import { getProjectIdentifierArg, splitPathParams } from '../../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../../support/command/base-command.js'
|
|
5
|
+
import { getResponseContent } from '../../../support/command/handle-response.js'
|
|
6
|
+
import { pipeAsync } from '../../../utils/general.js'
|
|
10
7
|
|
|
11
8
|
class ProjectApiRemoveCommand extends BaseCommand {
|
|
12
9
|
|
|
@@ -48,7 +45,7 @@ class ProjectApiRemoveCommand extends BaseCommand {
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
ProjectApiRemoveCommand.description = 'Removes an API from a project in
|
|
48
|
+
ProjectApiRemoveCommand.description = 'Removes an API from a project in Swagger.'
|
|
52
49
|
|
|
53
50
|
ProjectApiRemoveCommand.examples = [
|
|
54
51
|
'swaggerhub project:api:remove organization/project_name my_api',
|
|
@@ -57,12 +54,12 @@ ProjectApiRemoveCommand.examples = [
|
|
|
57
54
|
ProjectApiRemoveCommand.args = {
|
|
58
55
|
'OWNER/PROJECT_NAME': Args.string({
|
|
59
56
|
required: true,
|
|
60
|
-
description: 'The project to remove the API from on
|
|
57
|
+
description: 'The project to remove the API from on Swagger'
|
|
61
58
|
}),
|
|
62
59
|
'API': Args.string({
|
|
63
60
|
required: true,
|
|
64
|
-
description: 'The name of the API on
|
|
61
|
+
description: 'The name of the API on Swagger to remove'
|
|
65
62
|
})
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
|
|
65
|
+
export default ProjectApiRemoveCommand
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
splitPathParams,
|
|
6
|
-
splitFlagParams
|
|
7
|
-
} = require('../../support/command/parse-input')
|
|
8
|
-
const BaseCommand = require('../../support/command/base-command')
|
|
1
|
+
import { Flags, Args } from '@oclif/core'
|
|
2
|
+
import { postProject } from '../../requests/project.js'
|
|
3
|
+
import { getProjectIdentifierArg, splitPathParams, splitFlagParams } from '../../support/command/parse-input.js'
|
|
4
|
+
import BaseCommand from '../../support/command/base-command.js'
|
|
9
5
|
|
|
10
6
|
class CreateProjectCommand extends BaseCommand {
|
|
11
7
|
|
|
@@ -39,7 +35,7 @@ class CreateProjectCommand extends BaseCommand {
|
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
CreateProjectCommand.description = 'Creates a new project in
|
|
38
|
+
CreateProjectCommand.description = 'Creates a new project in Swagger.'
|
|
43
39
|
|
|
44
40
|
CreateProjectCommand.examples = [
|
|
45
41
|
'swaggerhub project:create organization/new_project_name --description "project description"',
|
|
@@ -53,7 +49,7 @@ CreateProjectCommand.examples = [
|
|
|
53
49
|
CreateProjectCommand.args = {
|
|
54
50
|
'OWNER/PROJECT_NAME': Args.string({
|
|
55
51
|
required: true,
|
|
56
|
-
description: 'The new project to create on
|
|
52
|
+
description: 'The new project to create on Swagger'
|
|
57
53
|
})
|
|
58
54
|
}
|
|
59
55
|
|
|
@@ -64,15 +60,15 @@ CreateProjectCommand.flags = {
|
|
|
64
60
|
}),
|
|
65
61
|
apis: Flags.string({
|
|
66
62
|
char: 'a',
|
|
67
|
-
description: 'Comma
|
|
63
|
+
description: 'Comma-separated list of API names to include in project',
|
|
68
64
|
required: false
|
|
69
65
|
}),
|
|
70
66
|
domains: Flags.string({
|
|
71
67
|
char: 'd',
|
|
72
|
-
description: 'Comma
|
|
68
|
+
description: 'Comma-separated list of domain names to include in project',
|
|
73
69
|
required: false
|
|
74
70
|
}),
|
|
75
71
|
...BaseCommand.flags
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
|
|
74
|
+
export default CreateProjectCommand
|