ma3route-cli
v0.7.0
Published
Terminal Client for Ma3Route REST API
Downloads
1
Readme
ma3route-cli
Terminal Client for the Ma3Route REST API v2
installation:
$ npm install --global ma3route-cli
usage:
options:
Options can be passed to any sub-command in different styles:
$ ma3route --limit=1 # preferred way
$ ma3route --limit 1
configurations:
To configure the client, you use the config
sub-comand:
$ ma3route config --sdk.key=somekey --sdk.secret=somesecret
$ ma3route config --limit=1
Note: you need an API key and secret to be able to interact with the API
All the configurations are used to build requests to the API. Therefore, if
you configure limit
to 10
, all requests to the API (where applicable)
will use this parameter.
The CLI ships with some default configurations, you can view them with:
$ ma3route config --default
To view your own configurations, you can view them with:
$ ma3route config --user
To delete a configuration, you specify its key, use --delete
:
$ ma3route config --delete=limit
$ ma3route config --delete=limit,sdk # multiple configuration values
endpoints:
The terminal client uses the awesome Ma3Route SDK for Node.js to perform operations against the API.
b, banner-adverts banner adverts
d, driving-reports driving reports
e, external-stream external stream
l, listed-adverts listed adverts
m, misc miscellaneous operations
n, news news articles
p, places places
t, traffic-updates traffic updates
u, users ma3route users
All these sub-commands refer to the SDK inner modules. For example,
banner-adverts
uses the bannerAdverts
sub-module in the SDK.
If a module (which most do) supports retrieving the relevant entities, you
can use the --get
flag or omit it entirely:
$ ma3route traffic-updates --get
$ ma3route traffic-updates # --get is implied
To create an entity, use the flag --create
:
$ ma3route users --create [email protected] --password=secretpassword
To delete an entity, use the flag --delete
:
$ ma3route traffic-updates --delete --id=101
Any other module function can be specified using a decamelized option.
For example, to invoke the getTowns
function in module places
, use the
flag --get-towns
$ ma3route places --get-towns
Note that not all commands support all these flags. For example, you can not delete a user with
users --delete
parameters:
To pass parameters to the any module function, you use flags. For example, if we wanted to limit a response to 20 items, we could:
$ ma3route driving-reports --limit=20
help information:
To view help information:
$ ma3route help
To view version information:
$ ma3route version
To enable debug output, just ensure the environment variable ${DEBUG}
is truthy:
$ DEBUG=1 ma3route config
You can also use the --debug
flag to show debug output:
$ ma3route config --debug
license:
The MIT License (MIT)
Copyright (c) 2015-2016 GochoMugo (www.gmugo.in)