swaggerhub-cli 0.3.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":"0.3.0","commands":{"configure":{"id":"configure","description":"configure application settings\nEnter the SwaggerHub URL - default is https://api.swaggerhub.com\nCustomers with on-premise installations need to point this to their on-premise API, which is http(s)://{swaggerhub-host}/v1\nEnter the API Key - this can be retrieved from https://app.swaggerhub.com/settings/apiKey\nYou can set these as environment variables: SWAGGERHUB_URL, SWAGGERHUB_API_KEY. These take priority over config settings.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"api:create":{"id":"api:create","description":"creates a new API / API version from a YAML/JSON file\nThe API version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the API version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:create organization/api/1.0.0 --file api.yaml --visibility public","swaggerhub api:create organization/api --file api.yaml","swaggerhub api:create organization/api/1.0.0 --publish --file api.json","swaggerhub api:create organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:create organization/api/1.0.0 --publish --setdefault --file api.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"],"default":"private"},"publish":{"name":"publish","type":"boolean","description":"sets the API version as published","required":false,"allowNo":false},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to create in SwaggerHub","required":true}]},"api:get":{"id":"api:get","description":"fetches an API definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the API in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:get organization/api","swaggerhub api:get organization/api/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the API in JSON format.","allowNo":false},"resolved":{"name":"resolved","type":"boolean","char":"r","description":"gets the resolved API definition (supported in v1.25+). ","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"SwaggerHub API to fetch","required":true}]},"api:publish":{"id":"api:publish","description":"publish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:publish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:setdefault":{"id":"api:setdefault","description":"set the default version of an API","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:setdefault organization/api/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:unpublish":{"id":"api:unpublish","description":"unpublish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:unpublish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:update":{"id":"api:update","description":"update an API\nThe API version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default API version will be updated.\nThe API visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:update organization/api --file api.yaml","swaggerhub api:update organization/api/1.0.0 --file api.json","swaggerhub api:update organization/api/1.0.0 --publish --file api.json","swaggerhub api:update organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --publish --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"]},"publish":{"name":"publish","type":"boolean","description":"sets the API version as published","required":false,"allowNo":false},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to update in SwaggerHub","required":true}]},"api:validate":{"id":"api:validate","description":"get validation result for an API version\nWhen VERSION is not included in the argument, the default version will be validated.\nAn error will occur if the API version does not exist.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:validate organization/api/1.0.0","swaggerhub api:validate organization/api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API Identifier","required":true}]},"domain:create":{"id":"domain:create","description":"creates a new domain / domain version from a YAML/JSON file\nThe domain version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the domain version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public","swaggerhub domain:create organization/domain --file domain.yaml","swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"],"default":"private"},"publish":{"name":"publish","type":"boolean","description":"sets the domain version as published","required":false,"allowNo":false},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to create in SwaggerHub","required":true}]},"domain:get":{"id":"domain:get","description":"fetches a domain definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the domain in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:get organization/domain","swaggerhub domain:get organization/domain/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the domain in JSON format.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"SwaggerHub domain to fetch","required":true}]},"domain:publish":{"id":"domain:publish","description":"publish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:publish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:unpublish":{"id":"domain:unpublish","description":"unpublish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:unpublish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"integration:create":{"id":"integration:create","description":"creates a new API integration from a JSON configuration file.\nSee the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/master/examples/integrations\nWhen VERSION is not included in the argument, the integration will be added to be default API version.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:create organization/api/1.0.0 --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API where integration will be added","required":true}]},"integration:delete":{"id":"integration:delete","description":"deletes the integration from the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to delete","required":true}]},"integration:execute":{"id":"integration:execute","description":"executes an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to execute for given API","required":true}]},"integration:get":{"id":"integration:get","description":"retieves an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to fetch for given API","required":true}]},"integration:list":{"id":"integration:list","description":"list integrations on an API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:list organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to list integrations on","required":true}]},"integration:update":{"id":"integration:update","description":"update the configuration of an API integration.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to update on the given API","required":true}]}}}
1
+ {"version":"0.6.1","commands":{"configure":{"id":"configure","description":"configure application settings\nEnter the SwaggerHub URL - default is https://api.swaggerhub.com\nCustomers with on-premise installations need to point this to their on-premise API, which is http(s)://{swaggerhub-host}/v1\nEnter the API Key - this can be retrieved from https://app.swaggerhub.com/settings/apiKey\nYou can set these as environment variables: SWAGGERHUB_URL, SWAGGERHUB_API_KEY. These take priority over config settings.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"api:create":{"id":"api:create","description":"creates a new API / API version from a YAML/JSON file\nThe API version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the API version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:create organization/api/1.0.0 --file api.yaml --visibility public","swaggerhub api:create organization/api --file api.yaml","swaggerhub api:create organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:create organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:create organization/api/1.0.0 --published=publish --setdefault --file api.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to create in SwaggerHub","required":true}]},"api:delete":{"id":"api:delete","description":"delete an API or API version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:delete organization/api/1.0.0","swaggerhub api:delete organization/api","swaggerhub api:delete organization/api --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete API without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to delete in SwaggerHub","required":true}]},"api:get":{"id":"api:get","description":"fetches an API definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the API in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:get organization/api","swaggerhub api:get organization/api/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the API in JSON format.","allowNo":false},"resolved":{"name":"resolved","type":"boolean","char":"r","description":"gets the resolved API definition (supported in v1.25+). ","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"SwaggerHub API to fetch","required":true}]},"api:publish":{"id":"api:publish","description":"publish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:publish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:setdefault":{"id":"api:setdefault","description":"set the default version of an API","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:setdefault organization/api/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:unpublish":{"id":"api:unpublish","description":"unpublish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:unpublish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:update":{"id":"api:update","description":"update an API\nThe API version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default API version will be updated.\nThe API visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:update organization/api --file api.yaml","swaggerhub api:update organization/api/1.0.0 --file api.json","swaggerhub api:update organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:update organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --published=unpublish --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to update in SwaggerHub","required":true}]},"api:validate":{"id":"api:validate","description":"get validation result for an API version\nWhen VERSION is not included in the argument, the default version will be validated.\nAn error will occur if the API version does not exist.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:validate organization/api/1.0.0","swaggerhub api:validate organization/api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API Identifier","required":true}]},"domain:create":{"id":"domain:create","description":"creates a new domain / domain version from a YAML/JSON file\nThe domain version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the domain version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public","swaggerhub domain:create organization/domain --file domain.yaml","swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to create in SwaggerHub","required":true}]},"domain:delete":{"id":"domain:delete","description":"delete a domain or domain version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:delete organization/domain/1.0.0","swaggerhub domain:delete organization/domain","swaggerhub domain:delete organization/domain --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete domain without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to delete in SwaggerHub","required":true}]},"domain:get":{"id":"domain:get","description":"fetches a domain definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the domain in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:get organization/domain","swaggerhub domain:get organization/domain/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the domain in JSON format.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"SwaggerHub domain to fetch","required":true}]},"domain:publish":{"id":"domain:publish","description":"publish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:publish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:setdefault":{"id":"domain:setdefault","description":"set the default version of a domain","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:setdefault organization/domain/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"domain identifier","required":true}]},"domain:unpublish":{"id":"domain:unpublish","description":"unpublish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:unpublish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:update":{"id":"domain:update","description":"update a domain\nThe domain version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default domain version will be updated.\nThe domain visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:update organization/domain --file domain.yaml","swaggerhub domain:update organization/domain/1.0.0 --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=publish --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=unpublish --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"domain to update in SwaggerHub","required":true}]},"integration:create":{"id":"integration:create","description":"creates a new API integration from a JSON configuration file.\nSee the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/master/examples/integrations\nWhen VERSION is not included in the argument, the integration will be added to be default API version.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:create organization/api/1.0.0 --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API where integration will be added","required":true}]},"integration:delete":{"id":"integration:delete","description":"deletes the integration from the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to delete","required":true}]},"integration:execute":{"id":"integration:execute","description":"executes an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to execute for given API","required":true}]},"integration:get":{"id":"integration:get","description":"retieves an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to fetch for given API","required":true}]},"integration:list":{"id":"integration:list","description":"list integrations on an API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:list organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to list integrations on","required":true}]},"integration:update":{"id":"integration:update","description":"update the configuration of an API integration.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to update on the given API","required":true}]},"project:create":{"id":"project:create","description":"Creates a new project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:create organization/new_project_name --description \"project description\"","swaggerhub project:create organization/new_project_name -a \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name --apis \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name -d \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name --domains \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name -a \"testapi1\" -d \"testdomain3\" --description \"description\""],"flags":{"description":{"name":"description","type":"option","description":"Description of project","required":false},"apis":{"name":"apis","type":"option","char":"a","description":"Comma separated list of api names to include in project","required":false},"domains":{"name":"domains","type":"option","char":"d","description":"Comma separated list of domain names to include in project","required":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The new project to create","required":true}]},"project:delete":{"id":"project:delete","description":"Deletes a project from SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:delete organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to delete","required":true}]},"project:get":{"id":"project:get","description":"Retrieves the details for a project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:get organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to retrieve the details for","required":true}]},"project:list":{"id":"project:list","description":"list projects","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:list","swaggerhub project:list organization"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER","description":"Organization to list projects for","required":false}]},"project:api:add":{"id":"project:api:add","description":"Adds an API to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:add organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the API to","required":true},{"name":"API","description":"The name of the API to add","required":true}]},"project:api:remove":{"id":"project:api:remove","description":"Removes an API from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:remove organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the API from","required":true},{"name":"API","description":"The API to remove","required":true}]},"project:domain:add":{"id":"project:domain:add","description":"Adds a domain to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:add organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the domain to","required":true},{"name":"DOMAIN","description":"The name of the domain to add","required":true}]},"project:domain:remove":{"id":"project:domain:remove","description":"Removes a domain from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:remove organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the domain from","required":true},{"name":"DOMAIN","description":"The domain to remove","required":true}]},"project:member:list":{"id":"project:member:list","description":"list members of a project","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:member:list organisation/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to list members of","required":true}]}}}
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
1
  {
2
2
  "name": "swaggerhub-cli",
3
3
  "description": "SwaggerHub CLI",
4
- "version": "0.3.0",
4
+ "version": "0.6.1",
5
5
  "author": "SmartBear",
6
6
  "bin": {
7
7
  "swaggerhub": "./bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/SmartBear/swaggerhub-cli/issues",
10
10
  "dependencies": {
11
- "@oclif/command": "^1.8.0",
11
+ "@oclif/command": "^1.8.16",
12
12
  "@oclif/config": "^1.17.0",
13
- "@oclif/errors": "^1.3.4",
14
- "@oclif/plugin-help": "^3.2.2",
15
- "@oclif/plugin-plugins": "^1.10.0",
16
- "cli-ux": "^5.5.1",
13
+ "@oclif/errors": "^1.3.5",
14
+ "@oclif/plugin-help": "^3.3.1",
15
+ "@oclif/plugin-plugins": "^2.0.11",
16
+ "cli-ux": "^5.6.3",
17
17
  "deep-extend": "^0.6.0",
18
- "fs-extra": "^9.1.0",
19
- "inquirer": "^8.0.0",
20
- "js-yaml": "^3.14.1",
18
+ "fs-extra": "^10.0.0",
19
+ "inquirer": "^8.1.0",
20
+ "js-yaml": "^4.1.0",
21
21
  "json-templates": "^4.1.0",
22
22
  "lodash": "^4.17.21",
23
23
  "node-fetch": "^2.6.1",
24
- "semver": "^7.3.4"
24
+ "semver": "^7.3.5"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@oclif/dev-cli": "^1.26.0",
28
28
  "@oclif/test": "^1.2.8",
29
29
  "babel-eslint": "^10.1.0",
30
- "chai": "^4.3.0",
31
- "eslint": "^7.22.0",
32
- "eslint-plugin-chai-friendly": "^0.6.0",
30
+ "chai": "^4.3.4",
31
+ "eslint": "^7.28.0",
32
+ "eslint-plugin-chai-friendly": "^0.7.1",
33
33
  "eslint-plugin-immutable": "^1.0.0",
34
- "eslint-plugin-mocha": "^8.0.0",
34
+ "eslint-plugin-mocha": "^9.0.0",
35
35
  "eslint-plugin-node": "^11.1.0",
36
- "eslint_d": "^10.0.4",
37
- "globby": "^11.0.1",
38
- "husky": "^5.1.3",
39
- "mocha": "^8.3.2",
40
- "nock": "^13.0.5",
36
+ "eslint_d": "^10.1.3",
37
+ "globby": "^11.0.3",
38
+ "husky": "^6.0.0",
39
+ "mocha": "^9.1.3",
40
+ "nock": "^13.1.0",
41
41
  "nyc": "^15.1.0",
42
- "rewire": "^5.0.0",
42
+ "rewire": "^6.0.0",
43
43
  "tmp": "^0.2.1"
44
44
  },
45
45
  "engines": {
@@ -79,6 +79,9 @@
79
79
  },
80
80
  "integration": {
81
81
  "description": "this topic supports the management of Integrations"
82
+ },
83
+ "projects": {
84
+ "description": "this topic supports the management of Projects"
82
85
  }
83
86
  },
84
87
  "helpClass": "./src/help"
@@ -85,7 +85,7 @@ class CreateAPICommand extends UpdateCommand {
85
85
  })()
86
86
  }
87
87
 
88
- if (flags.publish) await this.updatePublish(type, owner, name, version)
88
+ if (flags.published === 'publish') await this.updatePublish(type, owner, name, version, true)
89
89
  if (flags.setdefault) await this.updateDefault(type, owner, name, version)
90
90
  }
91
91
  }
@@ -98,9 +98,9 @@ An error will occur if the API version already exists.
98
98
  CreateAPICommand.examples = [
99
99
  'swaggerhub api:create organization/api/1.0.0 --file api.yaml --visibility public',
100
100
  'swaggerhub api:create organization/api --file api.yaml',
101
- 'swaggerhub api:create organization/api/1.0.0 --publish --file api.json',
101
+ 'swaggerhub api:create organization/api/1.0.0 --published=publish --file api.json',
102
102
  'swaggerhub api:create organization/api/1.0.0 --setdefault --file api.json',
103
- 'swaggerhub api:create organization/api/1.0.0 --publish --setdefault --file api.json'
103
+ 'swaggerhub api:create organization/api/1.0.0 --published=publish --setdefault --file api.json'
104
104
  ]
105
105
 
106
106
  CreateAPICommand.args = [{
@@ -120,9 +120,10 @@ CreateAPICommand.flags = {
120
120
  options: ['public', 'private'],
121
121
  default: 'private'
122
122
  }),
123
- publish: flags.boolean({
124
- description: 'sets the API version as published',
125
- default: false,
123
+ published: flags.string({
124
+ description: 'sets the lifecycle setting of the API version',
125
+ options: ['publish', 'unpublish'],
126
+ default: 'unpublish',
126
127
  required: false,
127
128
  dependsOn: ['file']
128
129
  }),
@@ -0,0 +1,63 @@
1
+ const { flags } = require('@oclif/command')
2
+ const { deleteApi } = require('../../requests/api')
3
+ const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
+ const BaseCommand = require('../../support/command/base-command')
5
+ const inquirer = require('inquirer')
6
+
7
+ class DeleteAPICommand extends BaseCommand {
8
+
9
+ async run() {
10
+ const { args, flags } = this.parse(DeleteAPICommand)
11
+ const apiPath = getApiIdentifierArg(args)
12
+ const [owner, name, version] = splitPathParams(apiPath)
13
+
14
+ if (version) {
15
+ this.logCommandSuccess = this.setSuccessMessage('deletedVersion')
16
+ } else if (!flags.force && await this.confirmDeletion(name) !== true) {
17
+ return
18
+ }
19
+
20
+ await this.executeHttp({
21
+ execute: () => deleteApi([apiPath]),
22
+ onResolve: this.logCommandSuccess({ type: 'API', owner, name, version }),
23
+ options: {}
24
+ })
25
+ }
26
+
27
+ async confirmDeletion(apiName) {
28
+ const confirm = await inquirer.prompt([
29
+ {
30
+ type: 'confirm',
31
+ name: 'answer',
32
+ message: `Are you sure you want to delete '${apiName}' definition entirely?`,
33
+ default: false
34
+ }
35
+ ])
36
+ return confirm.answer
37
+ }
38
+ }
39
+
40
+ DeleteAPICommand.description = `delete an API or API version
41
+ `
42
+
43
+ DeleteAPICommand.examples = [
44
+ 'swaggerhub api:delete organization/api/1.0.0',
45
+ 'swaggerhub api:delete organization/api',
46
+ 'swaggerhub api:delete organization/api --force'
47
+ ]
48
+
49
+ DeleteAPICommand.args = [{
50
+ name: 'OWNER/API_NAME/[VERSION]',
51
+ required: true,
52
+ description: 'API to delete in SwaggerHub'
53
+ }]
54
+
55
+ DeleteAPICommand.flags = {
56
+ force: flags.boolean({
57
+ char: 'f',
58
+ description: 'delete API without prompting for confirmation'
59
+ }),
60
+ ...BaseCommand.flags
61
+ }
62
+
63
+ module.exports = DeleteAPICommand
@@ -8,7 +8,7 @@ class PublishCommand extends UpdateCommand {
8
8
  const apiPath = getApiIdentifierArg(args)
9
9
  const [owner, name, version] = splitPathParams(apiPath)
10
10
 
11
- await this.updatePublish('apis', owner, name, version)
11
+ await this.updatePublish('apis', owner, name, version, true)
12
12
  }
13
13
  }
14
14
 
@@ -1,23 +1,15 @@
1
- const { putApi } = require('../../requests/api')
2
- const { getApiIdentifierArg } = require('../../support/command/parse-input')
1
+ const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
2
  const BaseCommand = require('../../support/command/base-command')
3
+ const UpdateCommand = require('../../support/command/update-command')
4
4
 
5
- class UnpublishCommand extends BaseCommand {
5
+ class UnpublishCommand extends UpdateCommand {
6
6
 
7
7
  async run() {
8
8
  const { args } = this.parse(UnpublishCommand)
9
9
  const apiPath = getApiIdentifierArg(args)
10
+ const [owner, name, version] = splitPathParams(apiPath)
10
11
 
11
- const unpublish = {
12
- pathParams: [apiPath, 'settings', 'lifecycle'],
13
- body: JSON.stringify({ published: false })
14
- }
15
-
16
- await this.executeHttp({
17
- execute: () => putApi(unpublish),
18
- onResolve: this.logCommandSuccess({ apiPath }),
19
- options: { resolveStatus: [403] }
20
- })
12
+ await this.updatePublish('apis', owner, name, version, false)
21
13
  }
22
14
  }
23
15
 
@@ -1,25 +1,30 @@
1
1
  const { flags } = require('@oclif/command')
2
2
  const { readFileSync } = require('fs-extra')
3
- const { getApi, postApi, putApi } = require('../../requests/api')
3
+ const { getApi, postApi } = require('../../requests/api')
4
4
  const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
5
5
  const { getVersion, parseDefinition } = require('../../utils/oas')
6
6
  const BaseCommand = require('../../support/command/base-command')
7
7
  const UpdateCommand = require('../../support/command/update-command')
8
- const { getResponseContent } = require('../../support/command/handle-response')
9
8
 
10
9
  class UpdateAPICommand extends UpdateCommand {
11
10
 
12
- async updateApi({ owner, name, version, flags, isPrivate, visibility }) {
11
+ async updateApi(owner, name, version, flags) {
12
+ const queryParams = { version }
13
+
14
+ if (flags.visibility) {
15
+ queryParams['isPrivate'] = flags.visibility !== 'public'
16
+ this.logCommandSuccess = this.setSuccessMessage('ApiUpdateVisibility')
17
+ }
13
18
 
14
19
  const updateApiObj = {
15
20
  pathParams: [owner, name],
16
- queryParams: { version, isPrivate },
21
+ queryParams,
17
22
  body: readFileSync(flags.file)
18
23
  }
19
24
 
20
25
  return await this.executeHttp({
21
26
  execute: () => postApi(updateApiObj),
22
- onResolve: this.logCommandSuccess({ owner, name, version, visibility }),
27
+ onResolve: this.logCommandSuccess({ owner, name, version, visibility: flags.visibility }),
23
28
  options: { resolveStatus: [403] }
24
29
  })
25
30
  }
@@ -41,43 +46,17 @@ class UpdateAPICommand extends UpdateCommand {
41
46
  if (flags.file) {
42
47
  await this.handleUpdate(owner, name, apiVersion, flags)
43
48
  } else if (flags.visibility) {
44
- await this.updateVisibility(owner, name, apiVersion, flags)
49
+ await this.updateVisibility(type, owner, name, apiVersion, flags.visibility !== 'public')
45
50
  }
46
51
 
47
- if (flags.publish) await this.updatePublish(type, owner, name, apiVersion)
52
+ if (flags.published) await this.updatePublish(type, owner, name, apiVersion, flags.published === 'publish')
48
53
  if (flags.setdefault) await this.updateDefault(type, owner, name, apiVersion)
49
54
  }
50
55
 
51
- async handleUpdate(owner, name, apiVersion, flags) {
52
- await this.executeHttp({
53
- execute: () => getApi([owner, name, apiVersion, 'settings', 'private']),
54
- onResolve: async response => {
55
- const content = await getResponseContent(response)
56
- const versionSettings = JSON.parse(content)
57
- const isPrivate = flags.visibility ? flags.visibility !== 'public' : versionSettings.private
58
- const visibility = isPrivate ? 'private' : 'public'
59
- return this.updateApi({ owner, name, version: apiVersion, flags, isPrivate, visibility })
60
- },
61
- options: { resolveStatus: [403] }
62
- })
63
- }
64
-
65
- async updateVisibility(owner, name, apiVersion, flags) {
66
- const isPrivate = flags.visibility !== 'public'
67
- const visibility = isPrivate ? 'private' : 'public'
68
- const updateApiObj = {
69
- pathParams: [owner, name, apiVersion, 'settings', 'private'],
70
- body: JSON.stringify({ private: isPrivate })
71
- }
72
-
56
+ async handleUpdate(owner, name, version, flags) {
73
57
  await this.executeHttp({
74
- execute: () => putApi(updateApiObj),
75
- onResolve: this.setSuccessMessage('visibilityUpdate')({
76
- owner,
77
- name,
78
- version: apiVersion,
79
- visibility
80
- }),
58
+ execute: () => getApi([owner, name, version]),
59
+ onResolve: () => this.updateApi(owner, name, version, flags),
81
60
  options: { resolveStatus: [403] }
82
61
  })
83
62
  }
@@ -92,9 +71,9 @@ The API visibility can be changed by using visibility flag.
92
71
  UpdateAPICommand.examples = [
93
72
  'swaggerhub api:update organization/api --file api.yaml',
94
73
  'swaggerhub api:update organization/api/1.0.0 --file api.json',
95
- 'swaggerhub api:update organization/api/1.0.0 --publish --file api.json',
74
+ 'swaggerhub api:update organization/api/1.0.0 --published=publish --file api.json',
96
75
  'swaggerhub api:update organization/api/1.0.0 --setdefault --file api.json',
97
- 'swaggerhub api:update organization/api/1.0.0 --publish --setdefault --file api.json',
76
+ 'swaggerhub api:update organization/api/1.0.0 --published=unpublish --setdefault --file api.json',
98
77
  'swaggerhub api:update organization/api/1.0.0 --visibility=private',
99
78
  ]
100
79
 
@@ -115,9 +94,10 @@ UpdateAPICommand.flags = {
115
94
  description: 'visibility of API in SwaggerHub',
116
95
  options: ['public', 'private']
117
96
  }),
118
- publish: flags.boolean({
119
- description: 'sets the API version as published',
120
- required: false
97
+ published: flags.string({
98
+ description: 'sets the lifecycle setting of the API version',
99
+ options: ['publish', 'unpublish'],
100
+ required: false,
121
101
  }),
122
102
  setdefault: flags.boolean({
123
103
  description: 'sets API version to be the default',
@@ -83,7 +83,7 @@ class CreateDomainCommand extends UpdateCommand {
83
83
  })()
84
84
  }
85
85
 
86
- if (flags.publish) await this.updatePublish(type, owner, name, version)
86
+ if (flags.published === 'publish') await this.updatePublish(type, owner, name, version, true)
87
87
  if (flags.setdefault) await this.updateDefault(type, owner, name, version)
88
88
  }
89
89
  }
@@ -118,9 +118,10 @@ CreateDomainCommand.flags = {
118
118
  options: ['public', 'private'],
119
119
  default: 'private'
120
120
  }),
121
- publish: flags.boolean({
122
- description: 'sets the domain version as published',
123
- default: false,
121
+ published: flags.string({
122
+ description: 'sets the lifecycle setting of the domain version',
123
+ options: ['publish', 'unpublish'],
124
+ default: 'unpublish',
124
125
  required: false,
125
126
  dependsOn: ['file']
126
127
  }),
@@ -0,0 +1,63 @@
1
+ const { flags } = require('@oclif/command')
2
+ const { deleteDomain } = require('../../requests/domain')
3
+ const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
+ const BaseCommand = require('../../support/command/base-command')
5
+ const inquirer = require('inquirer')
6
+
7
+ class DeleteDomainCommand extends BaseCommand {
8
+
9
+ async run() {
10
+ const { args, flags } = this.parse(DeleteDomainCommand)
11
+ const domainPath = getDomainIdentifierArg(args)
12
+ const [owner, name, version] = splitPathParams(domainPath)
13
+
14
+ if (version) {
15
+ this.logCommandSuccess = this.setSuccessMessage('deletedVersion')
16
+ } else if (!flags.force && await this.confirmDeletion(name) !== true) {
17
+ return
18
+ }
19
+
20
+ await this.executeHttp({
21
+ execute: () => deleteDomain([domainPath], { 'force': 'true' }),
22
+ onResolve: this.logCommandSuccess({ type: 'domain', owner, name, version }),
23
+ options: {}
24
+ })
25
+ }
26
+
27
+ async confirmDeletion(name) {
28
+ const confirm = await inquirer.prompt([
29
+ {
30
+ type: 'confirm',
31
+ name: 'answer',
32
+ message: `Are you sure you want to delete '${name}' definition entirely?`,
33
+ default: false
34
+ }
35
+ ])
36
+ return confirm.answer
37
+ }
38
+ }
39
+
40
+ DeleteDomainCommand.description = `delete a domain or domain version
41
+ `
42
+
43
+ DeleteDomainCommand.examples = [
44
+ 'swaggerhub domain:delete organization/domain/1.0.0',
45
+ 'swaggerhub domain:delete organization/domain',
46
+ 'swaggerhub domain:delete organization/domain --force'
47
+ ]
48
+
49
+ DeleteDomainCommand.args = [{
50
+ name: 'OWNER/DOMAIN_NAME/[VERSION]',
51
+ required: true,
52
+ description: 'Domain to delete in SwaggerHub'
53
+ }]
54
+
55
+ DeleteDomainCommand.flags = {
56
+ force: flags.boolean({
57
+ char: 'f',
58
+ description: 'delete domain without prompting for confirmation'
59
+ }),
60
+ ...BaseCommand.flags
61
+ }
62
+
63
+ module.exports = DeleteDomainCommand
@@ -9,7 +9,7 @@ class PublishCommand extends UpdateCommand {
9
9
  const domainPath = getDomainIdentifierArg(args)
10
10
  const [owner, name, version] = splitPathParams(domainPath)
11
11
 
12
- await this.updatePublish('domains', owner, name, version)
12
+ await this.updatePublish('domains', owner, name, version, true)
13
13
  }
14
14
  }
15
15
 
@@ -0,0 +1,30 @@
1
+ const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
2
+ const BaseCommand = require('../../support/command/base-command')
3
+ const UpdateCommand = require('../../support/command/update-command')
4
+
5
+ class SetDefaultDomainCommand extends UpdateCommand {
6
+
7
+ async run() {
8
+ const { args } = this.parse(SetDefaultDomainCommand)
9
+ const domainPath = getDomainIdentifierArg(args)
10
+ const [owner, name, version] = splitPathParams(domainPath)
11
+
12
+ await this.updateDefault('domains', owner, name, version)
13
+ }
14
+ }
15
+
16
+ SetDefaultDomainCommand.description = 'set the default version of a domain'
17
+
18
+ SetDefaultDomainCommand.examples = [
19
+ 'swaggerhub domain:setdefault organization/domain/2.0.0'
20
+ ]
21
+
22
+ SetDefaultDomainCommand.args = [{
23
+ name: 'OWNER/DOMAIN_NAME/VERSION',
24
+ required: true,
25
+ description: 'domain identifier'
26
+ }]
27
+
28
+ SetDefaultDomainCommand.flags = BaseCommand.flags
29
+
30
+ module.exports = SetDefaultDomainCommand
@@ -1,23 +1,15 @@
1
- const { putDomain } = require('../../requests/domain')
2
1
  const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
2
  const BaseCommand = require('../../support/command/base-command')
3
+ const UpdateCommand = require('../../support/command/update-command')
4
4
 
5
- class UnpublishCommand extends BaseCommand {
5
+ class UnpublishCommand extends UpdateCommand {
6
6
 
7
7
  async run() {
8
8
  const { args } = this.parse(UnpublishCommand)
9
9
  const domainPath = getDomainIdentifierArg(args)
10
+ const [owner, name, version] = splitPathParams(domainPath)
10
11
 
11
- const publish = {
12
- pathParams: [domainPath, 'settings', 'lifecycle'],
13
- body: JSON.stringify({ published: false })
14
- }
15
-
16
- await this.executeHttp({
17
- execute: () => putDomain(publish),
18
- onResolve: this.logCommandSuccess({ domainPath }),
19
- options: { resolveStatus: [403] }
20
- })
12
+ await this.updatePublish('domains', owner, name, version, false)
21
13
  }
22
14
  }
23
15