Skip to content

Commit

Permalink
docs(Update README): Add description and edit setup (#106)
Browse files Browse the repository at this point in the history
* docs(Update README): Add description and edit setup

* Updates after PR comments

* PR comment
  • Loading branch information
conor-ward authored Jun 29, 2020
1 parent aafb0d1 commit 095ab4c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 19 deletions.
84 changes: 66 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SwaggerHub CLI
==============

A command-line interface for SwaggerHub API (https://api.swaggerhub.com). Supports SwaggerHub SaaS and On-Premise.
The SwaggerHub CLI enables teams to build automation and workflows around SwaggerHub. Teams can use it in places like their CI/CD pipeline to create new APIs, create and update API versions, and mark API versions as published and default among other features. Every team has their own workflow, and the SwaggerHub CLI can help teams build the workflow that fits their needs.

<!-- toc -->
* [Requirements](#requirements)
Expand All @@ -18,14 +18,20 @@ Node.js 10 or later.
$ npm i -g swaggerhub-cli
```
## Setup
The SwaggerHub CLI can be configured through environment variables or through the [`swaggerhub configure`](#swaggerhub-configure) command. The CLI will look for the following environment variables.

* `SWAGGERHUB_API_KEY` (required) – **Important: keep this key secure.** This is the SwaggerHub API key the CLI will use for authentication. You can find your API key on the [user settings page](https://app.swaggerhub.com/settings/apiKey) in SwaggerHub.
* `SWAGGERHUB_URL` (optional, default is `https://api.swaggerhub.com/`) – Customers with on-premise installations need to point this to their on-premise API, which is `http(s)://{swaggerhub-host}/v1` (do not append a backslash).

Alernatively, you can use the `swaggerhub configure` command to create a configuration file for the CLI to use. This command will walk you through the steps to set up the necessary configurations.

```sh-session
$ swaggerhub configure
? SwaggerHub URL: https://api.swaggerhub.com
? API Key: <your-api-key>
```
SwaggerHub URL defaults to the SaaS version, `https://api.swaggerhub.com`. The URL can be reset using the **configure** command

Alternatively, these values can be set using the `SWAGGERHUB_URL` and `SWAGGERHUB_API_KEY` environment variables. These take precedence over config values.
Environment variables take precedence over the configuration file created by this command.
## Usage
```sh-session
$ swaggerhub COMMAND
Expand All @@ -46,9 +52,11 @@ USAGE
* [`swaggerhub api:unpublish OWNER/API_NAME/VERSION`](#swaggerhub-apiunpublish-ownerapi_nameversion)
* [`swaggerhub api:update OWNER/API_NAME/[VERSION]`](#swaggerhub-apiupdate-ownerapi_nameversion)
* [`swaggerhub configure`](#swaggerhub-configure)
* [`swaggerhub domain:publish OWNER/DOMAIN_NAME/VERSION`](#swaggerhub-domainpublish-ownerdomain_nameversion)
* [`swaggerhub domain:unpublish OWNER/DOMAIN_NAME/VERSION`](#swaggerhub-domainunpublish-ownerdomain_nameversion)
* [`swaggerhub help [COMMAND]`](#swaggerhub-help-command)

### swaggerhub api:create
## `swaggerhub api:create`

creates a new API / API version from a YAML/JSON file

Expand All @@ -73,9 +81,9 @@ EXAMPLES
swaggerhub api:create organization/api --file api.yaml
```

_See code: [src/commands/api/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/create.js)_
_See code: [src/commands/api/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/create.js)_

### swaggerhub api:get
## `swaggerhub api:get`

fetches an API definition

Expand All @@ -100,9 +108,9 @@ EXAMPLES
swaggerhub api:get organization/api/1.0.0 --json
```

_See code: [src/commands/api/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/get.js)_
_See code: [src/commands/api/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/get.js)_

### swaggerhub api:publish
## `swaggerhub api:publish`

publish an API version

Expand All @@ -120,9 +128,9 @@ EXAMPLE
swaggerhub api:publish organization/api/1.0.0
```

_See code: [src/commands/api/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/publish.js)_
_See code: [src/commands/api/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/publish.js)_

### swaggerhub api:setdefault
## `swaggerhub api:setdefault`

set the default version of an API

Expand All @@ -140,9 +148,9 @@ EXAMPLE
swaggerhub api:setdefault organization/api/2.0.0
```

_See code: [src/commands/api/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/setdefault.js)_
_See code: [src/commands/api/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/setdefault.js)_

### swaggerhub api:unpublish
## `swaggerhub api:unpublish`

unpublish an API version

Expand All @@ -160,9 +168,9 @@ EXAMPLE
swaggerhub api:unpublish organization/api/1.0.0
```

_See code: [src/commands/api/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/unpublish.js)_
_See code: [src/commands/api/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/unpublish.js)_

### swaggerhub api:update
## `swaggerhub api:update`

update an API version

Expand All @@ -187,9 +195,9 @@ EXAMPLES
swaggerhub api:update organization/api/1.0.0 --file api.json
```

_See code: [src/commands/api/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/api/update.js)_
_See code: [src/commands/api/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/api/update.js)_

### swaggerhub configure
## `swaggerhub configure`

configure application settings

Expand All @@ -204,9 +212,49 @@ DESCRIPTION
settings.
```

_See code: [src/commands/configure.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.6/src/commands/configure.js)_
_See code: [src/commands/configure.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/configure.js)_

## `swaggerhub domain:publish`

publish a domain version

```
USAGE
$ swaggerhub domain:publish OWNER/DOMAIN_NAME/VERSION
ARGUMENTS
OWNER/DOMAIN_NAME/VERSION Domain identifier
OPTIONS
-h, --help show CLI help
EXAMPLE
swaggerhub domain:publish organization/domain/1.0.0
```

_See code: [src/commands/domain/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/domain/publish.js)_

## `swaggerhub domain:unpublish`

unpublish a domain version

```
USAGE
$ swaggerhub domain:unpublish OWNER/DOMAIN_NAME/VERSION
ARGUMENTS
OWNER/DOMAIN_NAME/VERSION Domain identifier
OPTIONS
-h, --help show CLI help
EXAMPLE
swaggerhub domain:unpublish organization/domain/1.0.0
```

_See code: [src/commands/domain/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.2.7/src/commands/domain/unpublish.js)_

### swaggerhub help [COMMAND]
## `swaggerhub help [COMMAND]`

display help for swaggerhub

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swaggerhub-cli",
"description": "SwaggerHub CLI",
"version": "0.2.6",
"version": "0.2.7",
"author": "SmartBear",
"bin": {
"swaggerhub": "./bin/run"
Expand Down

0 comments on commit 095ab4c

Please sign in to comment.