-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathunpublish.js
32 lines (24 loc) · 928 Bytes
/
unpublish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { Args } = require('@oclif/core')
const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
const BaseCommand = require('../../support/command/base-command')
const UpdateCommand = require('../../support/command/update-command')
class UnpublishCommand extends UpdateCommand {
async run() {
const { args } = await this.parse(UnpublishCommand)
const apiPath = getApiIdentifierArg(args)
const [owner, name, version] = splitPathParams(apiPath)
await this.updatePublish('apis', owner, name, version, false)
}
}
UnpublishCommand.description = 'unpublish an API version'
UnpublishCommand.examples = [
'swaggerhub api:unpublish organization/api/1.0.0'
]
UnpublishCommand.args = {
'OWNER/API_NAME/VERSION': Args.string({
required: true,
description: 'API identifier'
})
}
UnpublishCommand.flags = BaseCommand.flags
module.exports = UnpublishCommand