gedex/janrain-cli

dev-master 2015-08-26 16:20 UTC

This package is not auto-updated.

Last update: 2024-09-18 09:22:33 UTC


README

CLI工具,用于与Janrain进行交互。

从源代码安装

git clone git@github.com:xwp/janrain-cli-tools.git jcli
cd jcli
composer install

您可以通过在当前目录下运行./bin/jcli来执行。

如果您想构建phar文件

box build

并将文件移动到您的OS PATH

mv jcli.phar /usr/local/bin/jcli

现在您可以从任何地方运行jcli

配置

第一次运行时,您需要配置您的jcli。默认情况下,client_idclient_secretbase_url都是空的

jcli config -l

这些是需要设置的配置密钥。用以下方式设置它

jcli config client_id YOUR_CLIENT_ID
jcli config client_secret YOUR_CLIENT_SECRET
jcli config base_url YOUR_BASE_URL

此外,您可以将default_type设置为设置默认实体类型。现在,每次您运行命令时都可以忽略-t选项。

jcli config default_type user

命令

$ ./bin/jcli
jcli version @package_version@

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  config                 Janrain config
  help                   Displays help for a command
  list                   Lists commands
 entity
  entity:count           Retrieve number of records of entity type
  entity:fill-unsub-key  Fill empty unsubscribe key on records
  entity:find            Find entity
  entity:update          Update an entity
  entity:view            Retrieve a single entity
 type
  type:list              Retrieve all entity types

查找记录

jcli entity:find "gender != 'male'"

限制输出为10条记录

jcli entity:find "gender != 'male'" -m 10

指定偏移量(从第5条记录开始)

jcli entity:find "gender != 'male'" -m 10 -f 5

记录计数

jcli entity:count "gender != 'male' AND birthday is not null"

查看单个记录

jcli entity:view id=999
jcli entity:view uuid=c0613105-f632-41ce-80eb-56668df7fc83

更新记录

jcli entity:update id=999 givenName=Akeda displayName="Akeda Bagus"

更新所有空ETUID属性

jcli entity:fill-unsub-key

您可能会从Janrain收到API速率限制。如果是这样,jcli将输出消息。在这种情况下,您可以再次运行jcli entity:fill-unsub-key以处理剩余的记录。