1.0.1 • Published 5 years ago

blackbox-cli v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

blackbox-cli

Version standard-readme compliant

Blackbox command line interface.

The Blackbox command line interface (CLI) provides support for managing a Blackbox project. Project configuration is stored in the blackbox.json file and the OpenAPI definitions are stored in the openapi.json file. The CLI can be used to manage datatypes and services required by your project.

A Blackbox project is a project that provides a REST API conforming to the Blacbkox specification. The Blackbox specification provides standards for developing a REST API based on service and datatype definitions. The services and datatypes are defined within an OpenAPI document.

For further information about the Blackbox Specification refer to the Blackbox website.

Table of Contents

Install

npm i -g blackbox-cli

Usage

bb command [type] [options]

Commands

CommandDescription
initInitialises the Blackbox project with a root OpenAPI JSON file named openapi.json and a bb.json config file.
addAdds a Blackbox API component of a given type to the project.
listLists all Blackbox API components of a given type that exist within the project.
updateChanges an existing Blackbox API component. The component is identified by its type and name.
deleteDeletes an existing Blackbox API component. The component is identified by its type and name.
analyseNOT YET IMPLEMENTED: Analyses the Blackbox API specification within the openapi.json file and identifies any lack of compliance to the Blackbox Specification.

Types

TypeDescription
serviceA blackbox service.
datatypeA datatype for use by services.
repositoryA datatype repository for storing and loading datatype definitions.

Options

OptionDescription
--all, -aApply operation to all relevant items. E.g. bb delete service -a -n s1 will remove service s1 and any child services.
--datatype, -dThe data type of a service.
--descThe description of the API
--file, -fA source file to read in data appropriate to the command and type.
--methods, -mThe HTTP methods to be supported by the service.
--name, -nThe name of the entity being added or modified.
--service, -sThe parent service in the case of sub-services. Defaults to no parent; i.e. a root level service.
--summarySummary for a service.
--title, -tThe title of the API
--url, -uA source url to read in data appropriate to the command and type.

Examples

Initialise the blackbox project:

bb init -n weather -t "A weather API." --desc \
"An API for retrieving temperature and humidity information."

Add a remote repository (the repository will be added to your blackbox.json):

bb add repository --url http://example.com/repositories/maths.json

Add a datatype from a local file (the datatype will be added to your openapi.json):

bb add datatype --name temperature --file types.json

Add a service:

bb add service --name weather --summary \
"Weather service: Provides temperature and humidity information."

Add a sub-service:

bb add service --name temperature --service weather --summary \
"Returns a temperature object."

Assign the datatype for a service (the datatype must be primitive, already added to the openapi.json, or exist in a repository added to your blackbox.json; note that --service refers to the parent service and --name refers to the child service):

bb update service --service weather --name temperature --datatype temperature --method "post,delete"

Maintainers

@ellipsistechnology

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2019 Ben Millar