swaggerhub-cli 0.5.0 → 0.6.2

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.5.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 --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}]}}}
1
+ {"version":"0.6.2","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,18 +1,18 @@
1
1
  {
2
2
  "name": "swaggerhub-cli",
3
3
  "description": "SwaggerHub CLI",
4
- "version": "0.5.0",
4
+ "version": "0.6.2",
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.3",
15
- "@oclif/plugin-plugins": "^1.10.0",
13
+ "@oclif/errors": "^1.3.5",
14
+ "@oclif/plugin-help": "^3.3.1",
15
+ "@oclif/plugin-plugins": "^2.0.11",
16
16
  "cli-ux": "^5.6.3",
17
17
  "deep-extend": "^0.6.0",
18
18
  "fs-extra": "^10.0.0",
@@ -29,17 +29,17 @@
29
29
  "babel-eslint": "^10.1.0",
30
30
  "chai": "^4.3.4",
31
31
  "eslint": "^7.28.0",
32
- "eslint_d": "^10.1.3",
33
32
  "eslint-plugin-chai-friendly": "^0.7.1",
34
33
  "eslint-plugin-immutable": "^1.0.0",
35
34
  "eslint-plugin-mocha": "^9.0.0",
36
35
  "eslint-plugin-node": "^11.1.0",
36
+ "eslint_d": "^10.1.3",
37
37
  "globby": "^11.0.3",
38
38
  "husky": "^6.0.0",
39
- "mocha": "^9.0.0",
39
+ "mocha": "^9.1.3",
40
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"
@@ -0,0 +1,48 @@
1
+ const { putProject } = require('../../../requests/project')
2
+ const {
3
+ getProjectIdentifierArg
4
+ } = require('../../../support/command/parse-input')
5
+ const BaseCommand = require('../../../support/command/base-command')
6
+
7
+ class ProjectApiAddCommand extends BaseCommand {
8
+
9
+ async run() {
10
+ const { args } = this.parse(ProjectApiAddCommand)
11
+ const projectPath = getProjectIdentifierArg(args)
12
+ const apiName = args['API']
13
+
14
+ await this.addApiToProject(projectPath, apiName)
15
+ }
16
+
17
+ async addApiToProject(projectPath, apiName) {
18
+
19
+ return this.executeHttp({
20
+ execute: () => putProject({ pathParams: [projectPath, 'apis', apiName] }),
21
+ onResolve: this.logCommandSuccess({ apiName, projectPath }),
22
+ options: {}
23
+ })
24
+ }
25
+ }
26
+
27
+ ProjectApiAddCommand.description = 'Adds an API to an existing project.'
28
+
29
+
30
+ ProjectApiAddCommand.examples = [
31
+ 'swaggerhub project:api:add organization/project_name my_api'
32
+ ]
33
+
34
+ ProjectApiAddCommand.args = [
35
+ {
36
+ name: 'OWNER/PROJECT_NAME',
37
+ required: true,
38
+ description: 'The project to add the API to'
39
+ },
40
+
41
+ {
42
+ name: 'API',
43
+ required: true,
44
+ description: 'The name of the API to add'
45
+ }
46
+ ]
47
+
48
+ module.exports = ProjectApiAddCommand
@@ -0,0 +1,69 @@
1
+ const { putProject, getProject } = require('../../../requests/project')
2
+ const {
3
+ getProjectIdentifierArg,
4
+ splitPathParams,
5
+ } = require('../../../support/command/parse-input')
6
+ const BaseCommand = require('../../../support/command/base-command')
7
+ const { getResponseContent } = require('../../../support/command/handle-response')
8
+ const { pipeAsync } = require('../../../utils/general')
9
+
10
+ class ProjectApiRemoveCommand extends BaseCommand {
11
+
12
+ async run() {
13
+ const { args } = this.parse(ProjectApiRemoveCommand)
14
+ const projectPath = getProjectIdentifierArg(args)
15
+ const apiToRemove = args['API']
16
+
17
+ await this.removeApiFromProject(projectPath, apiToRemove)
18
+ }
19
+
20
+ async getProjectDetails(owner, projectName) {
21
+ return this.executeHttp({
22
+ execute: () => getProject([owner, projectName]),
23
+ onResolve: pipeAsync(getResponseContent, JSON.parse),
24
+ options: {}
25
+ })
26
+ }
27
+
28
+ async removeApiFromProject(projectPath, apiName) {
29
+ const [owner, projectName] = splitPathParams(projectPath)
30
+
31
+ const project = await this.getProjectDetails(owner, projectName)
32
+ if (project.apis && !project.apis.includes(apiName)) {
33
+ return this.log(`Api \'${apiName}\' does not exist in project \'${projectPath}\'`)
34
+ }
35
+
36
+ project.apis = project.apis.filter(item => item !== apiName)
37
+ const updateRequest = {
38
+ pathParams: [owner, projectName],
39
+ body: JSON.stringify(project)
40
+ }
41
+
42
+ return this.executeHttp({
43
+ execute: () => putProject(updateRequest),
44
+ onResolve: this.logCommandSuccess({ apiName, projectPath }),
45
+ options: {}
46
+ })
47
+ }
48
+ }
49
+
50
+ ProjectApiRemoveCommand.description = 'Removes an API from a project in SwaggerHub.'
51
+
52
+ ProjectApiRemoveCommand.examples = [
53
+ 'swaggerhub project:api:remove organization/project_name my_api',
54
+ ]
55
+
56
+ ProjectApiRemoveCommand.args = [
57
+ {
58
+ name: 'OWNER/PROJECT_NAME',
59
+ required: true,
60
+ description: 'The project remove the API from'
61
+ },
62
+ {
63
+ name: 'API',
64
+ required: true,
65
+ description: 'The API to remove'
66
+ }
67
+ ]
68
+
69
+ module.exports = ProjectApiRemoveCommand
@@ -0,0 +1,77 @@
1
+ const { flags } = require('@oclif/command')
2
+ const { postProject } = require('../../requests/project')
3
+ const {
4
+ getProjectIdentifierArg,
5
+ splitPathParams,
6
+ splitFlagParams
7
+ } = require('../../support/command/parse-input')
8
+ const BaseCommand = require('../../support/command/base-command')
9
+
10
+ class CreateProjectCommand extends BaseCommand {
11
+
12
+ async run() {
13
+ const { args, flags } = this.parse(CreateProjectCommand)
14
+ const projectPath = getProjectIdentifierArg(args)
15
+ const [owner, name] = splitPathParams(projectPath)
16
+ const body = {
17
+ owner,
18
+ name
19
+ }
20
+ // Append optional flags to body if present
21
+ if (flags.description !== undefined) body.description = flags.description
22
+ if (flags.apis !== undefined) body.apis = splitFlagParams(flags.apis)
23
+ if (flags.domains !== undefined) body.domains = splitFlagParams(flags.domains)
24
+
25
+ await this.createProject(owner, name, JSON.stringify(body))
26
+ }
27
+
28
+ async createProject(owner, projectName, body) {
29
+ const createRequest = {
30
+ pathParams: [owner],
31
+ body
32
+ }
33
+
34
+ return this.executeHttp({
35
+ execute: () => postProject(createRequest),
36
+ onResolve: this.logCommandSuccess({ owner, projectName }),
37
+ options: {}
38
+ })
39
+ }
40
+ }
41
+
42
+ CreateProjectCommand.description = 'Creates a new project in SwaggerHub.'
43
+
44
+ CreateProjectCommand.examples = [
45
+ 'swaggerhub project:create organization/new_project_name --description "project description"',
46
+ 'swaggerhub project:create organization/new_project_name -a "testapi1,testapi2"',
47
+ 'swaggerhub project:create organization/new_project_name --apis "testapi1,testapi2"',
48
+ 'swaggerhub project:create organization/new_project_name -d "testdomain3,testdomain4"',
49
+ 'swaggerhub project:create organization/new_project_name --domains "testdomain3,testdomain4"',
50
+ 'swaggerhub project:create organization/new_project_name -a "testapi1" -d "testdomain3" --description "description"'
51
+ ]
52
+
53
+ CreateProjectCommand.args = [{
54
+ name: 'OWNER/PROJECT_NAME',
55
+ required: true,
56
+ description: 'The new project to create'
57
+ }]
58
+
59
+ CreateProjectCommand.flags = {
60
+ description: flags.string({
61
+ description: 'Description of project',
62
+ required: false
63
+ }),
64
+ apis: flags.string({
65
+ char: 'a',
66
+ description: 'Comma separated list of api names to include in project',
67
+ required: false
68
+ }),
69
+ domains: flags.string({
70
+ char: 'd',
71
+ description: 'Comma separated list of domain names to include in project',
72
+ required: false
73
+ }),
74
+ ...BaseCommand.flags
75
+ }
76
+
77
+ module.exports = CreateProjectCommand
@@ -0,0 +1,44 @@
1
+ const { deleteProject } = require('../../requests/project')
2
+ const { getProjectIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
+ const BaseCommand = require('../../support/command/base-command')
4
+
5
+ class DeleteProjectCommand extends BaseCommand {
6
+ constructor(...props) {
7
+ super(...props)
8
+ this.setSuccessMessage('ProjectDelete')
9
+ }
10
+
11
+ async run() {
12
+ const { args } = this.parse(DeleteProjectCommand)
13
+ const projectPath = getProjectIdentifierArg(args)
14
+ await this.deleteProject(projectPath)
15
+ }
16
+
17
+ async deleteProject(projectPath) {
18
+ const [owner, projectName] = splitPathParams(projectPath)
19
+
20
+ return this.executeHttp({
21
+ execute: () => deleteProject([owner, projectName]),
22
+ onResolve: this.logCommandSuccess({ projectPath }),
23
+ options: {}
24
+ })
25
+ }
26
+ }
27
+
28
+ DeleteProjectCommand.description = 'Deletes a project from SwaggerHub.'
29
+
30
+ DeleteProjectCommand.examples = [
31
+ 'swaggerhub project:delete organization/project_name'
32
+ ]
33
+
34
+ DeleteProjectCommand.args = [{
35
+ name: 'OWNER/PROJECT_NAME',
36
+ required: true,
37
+ description: 'Project to delete'
38
+ }]
39
+
40
+ DeleteProjectCommand.flags = {
41
+ ...BaseCommand.flags
42
+ }
43
+
44
+ module.exports = DeleteProjectCommand
@@ -0,0 +1,48 @@
1
+ const { putProject } = require('../../../requests/project')
2
+ const {
3
+ getProjectIdentifierArg
4
+ } = require('../../../support/command/parse-input')
5
+ const BaseCommand = require('../../../support/command/base-command')
6
+
7
+ class ProjectDomainAddCommand extends BaseCommand {
8
+
9
+ async run() {
10
+ const { args } = this.parse(ProjectDomainAddCommand)
11
+ const projectPath = getProjectIdentifierArg(args)
12
+ const domainName = args['DOMAIN']
13
+
14
+ await this.addDomainToProject(projectPath, domainName)
15
+ }
16
+
17
+ async addDomainToProject(projectPath, domainName) {
18
+
19
+ return this.executeHttp({
20
+ execute: () => putProject({ pathParams: [projectPath, 'domains', domainName] }),
21
+ onResolve: this.logCommandSuccess({ domainName, projectPath }),
22
+ options: {}
23
+ })
24
+ }
25
+ }
26
+
27
+ ProjectDomainAddCommand.description = 'Adds a domain to an existing project.'
28
+
29
+
30
+ ProjectDomainAddCommand.examples = [
31
+ 'swaggerhub project:domain:add organization/project_name my_domain'
32
+ ]
33
+
34
+ ProjectDomainAddCommand.args = [
35
+ {
36
+ name: 'OWNER/PROJECT_NAME',
37
+ required: true,
38
+ description: 'The project to add the domain to'
39
+ },
40
+
41
+ {
42
+ name: 'DOMAIN',
43
+ required: true,
44
+ description: 'The name of the domain to add'
45
+ }
46
+ ]
47
+
48
+ module.exports = ProjectDomainAddCommand
@@ -0,0 +1,69 @@
1
+ const { putProject, getProject } = require('../../../requests/project')
2
+ const {
3
+ getProjectIdentifierArg,
4
+ splitPathParams,
5
+ } = require('../../../support/command/parse-input')
6
+ const BaseCommand = require('../../../support/command/base-command')
7
+ const { getResponseContent } = require('../../../support/command/handle-response')
8
+ const { pipeAsync } = require('../../../utils/general')
9
+
10
+ class ProjectDomainRemoveCommand extends BaseCommand {
11
+
12
+ async run() {
13
+ const { args } = this.parse(ProjectDomainRemoveCommand)
14
+ const projectPath = getProjectIdentifierArg(args)
15
+ const domainToRemove = args['DOMAIN']
16
+
17
+ await this.removeDomainFromProject(projectPath, domainToRemove)
18
+ }
19
+
20
+ async getProjectDetails(owner, projectName) {
21
+ return this.executeHttp({
22
+ execute: () => getProject([owner, projectName]),
23
+ onResolve: pipeAsync(getResponseContent, JSON.parse),
24
+ options: {}
25
+ })
26
+ }
27
+
28
+ async removeDomainFromProject(projectPath, domainName) {
29
+ const [owner, projectName] = splitPathParams(projectPath)
30
+
31
+ const project = await this.getProjectDetails(owner, projectName)
32
+ if (project.domains && !project.domains.includes(domainName)) {
33
+ return this.log(`Domain \'${domainName}\' does not exist in project \'${projectPath}\'`)
34
+ }
35
+
36
+ project.domains = project.domains.filter(item => item !== domainName)
37
+ const updateRequest = {
38
+ pathParams: [owner, projectName],
39
+ body: JSON.stringify(project)
40
+ }
41
+
42
+ return this.executeHttp({
43
+ execute: () => putProject(updateRequest),
44
+ onResolve: this.logCommandSuccess({ domainName, projectPath }),
45
+ options: {}
46
+ })
47
+ }
48
+ }
49
+
50
+ ProjectDomainRemoveCommand.description = 'Removes a domain from a project in SwaggerHub.'
51
+
52
+ ProjectDomainRemoveCommand.examples = [
53
+ 'swaggerhub project:domain:remove organization/project_name my_domain',
54
+ ]
55
+
56
+ ProjectDomainRemoveCommand.args = [
57
+ {
58
+ name: 'OWNER/PROJECT_NAME',
59
+ required: true,
60
+ description: 'The project remove the domain from'
61
+ },
62
+ {
63
+ name: 'DOMAIN',
64
+ required: true,
65
+ description: 'The domain to remove'
66
+ }
67
+ ]
68
+
69
+ module.exports = ProjectDomainRemoveCommand
@@ -0,0 +1,51 @@
1
+ const { getProject } = require('../../requests/project')
2
+ const { getProjectIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
+ const { getResponseContent } = require('../../support/command/handle-response')
4
+ const { prettyPrintJSON } = require('../../utils/general')
5
+ const BaseCommand = require('../../support/command/base-command')
6
+
7
+ class GetProjectCommand extends BaseCommand {
8
+ constructor(...props) {
9
+ super(...props)
10
+ this.logProject = this.logProject.bind(this)
11
+ }
12
+
13
+ async run() {
14
+ const { args } = this.parse(GetProjectCommand)
15
+ const projectPath = getProjectIdentifierArg(args)
16
+ await this.getProject(projectPath)
17
+ }
18
+
19
+ async logProject(response) {
20
+ const project = await getResponseContent(response)
21
+ this.log(prettyPrintJSON(project))
22
+ }
23
+
24
+ async getProject(projectPath) {
25
+ const [owner, project] = splitPathParams(projectPath)
26
+
27
+ return this.executeHttp({
28
+ execute: () => getProject([owner, project]),
29
+ onResolve: this.logProject,
30
+ options: {}
31
+ })
32
+ }
33
+ }
34
+
35
+ GetProjectCommand.description = 'Retrieves the details for a project.'
36
+
37
+ GetProjectCommand.examples = [
38
+ 'swaggerhub project:get organization/project_name'
39
+ ]
40
+
41
+ GetProjectCommand.args = [{
42
+ name: 'OWNER/PROJECT_NAME',
43
+ required: true,
44
+ description: 'Project to retrieve the details for'
45
+ }]
46
+
47
+ GetProjectCommand.flags = {
48
+ ...BaseCommand.flags
49
+ }
50
+
51
+ module.exports = GetProjectCommand