1个稳定版本
4.0.4+20220928 | 2022年10月1日 |
---|
#47 在 #standard-error
每月43次 下载
4MB
37K SLoC
钱包对象命令行界面(CLI)允许您从终端舒适地使用Google钱包对象服务的多数功能。
默认情况下,所有输出都会打印到标准输出,但可以使用标志将其直接导向文件,不受您的shell功能限制。错误将打印到标准错误,并使程序退出代码不为零。
如果请求数据结构,这些将作为格式化的JSON返回,作为其他工具的输入很有用。
关于Walletobjects API的所有其他信息,请参阅官方文档网站。
安装和源代码
使用cargo安装命令行界面
cargo install google-walletobjects1-cli
用法
此文档是根据20220928版本的Walletobjects API生成的。CLI版本为4.0.4。
walletobjects1 [options]
eventticketclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
eventticketobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
modifylinkedofferobjects <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
flightclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
flightobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
genericclass
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
genericobject
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
giftcardclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
giftcardobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
issuer
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
jwt
insert (-r <kv>)... [-p <v>]... [-o <out>]
loyaltyclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
loyaltyobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
modifylinkedofferobjects <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
offerclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
offerobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
permissions
get <resource-id> [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
smarttap
insert (-r <kv>)... [-p <v>]... [-o <out>]
transitclass
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
transitobject
addmessage <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
get <resource-id> [-p <v>]... [-o <out>]
insert (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
update <resource-id> (-r <kv>)... [-p <v>]... [-o <out>]
walletobjects1 --help
Configuration:
[--scope <url>]...
Specify the authentication a method should be executed in. Each scope
requires the user to grant this application permission to use it.
If unset, it defaults to the shortest scope url for a particular method.
--config-dir <folder>
A directory into which we will store our persistent data. Defaults to
a user-writable directory that we will create during the first invocation.
[default: ~/.google-service-cli]
配置
程序将所有持久数据存储在~/.google-service-cli
目录中的JSON文件中,以walletobjects1-
为前缀。您可以使用--config-dir
标志在每个调用的基础上更改用于存储配置的目录。
以下段落提供了有关各种持久数据的更多信息。
身份验证
大多数API需要用户对请求进行身份验证。如果是这种情况,范围确定授予的权限集。这些权限的粒度通常不超过只读或完全访问。
如果没有设置,系统将自动选择最小的可行范围,例如,在调用只读方法时,它将只请求只读范围。您可以使用--scope
标志直接指定范围。所有适用的范围都在各自方法的CLI文档中有记录。
第一次使用作用域时,会要求用户进行授权。按照CLI的指示授予或拒绝权限。
如果用户已对作用域进行了认证,相关信息将以JSON格式存储在配置目录中,例如:~/.google-service-cli/walletobjects1-token-<scope-hash>.json
。不需要手动管理这些令牌。
要撤销授权的认证,请参阅官方文档。
应用程序密钥
为了允许任何应用程序使用Google服务,它需要使用Google开发者控制台进行注册。然后逐个启用应用程序可能使用的API。大多数API可以免费使用,并且有每日配额。
为了在不强迫任何人注册自己的应用程序的情况下更方便地使用CLI,CLI自带了一个默认应用程序密钥,并相应地进行了配置。这也意味着全球范围内的重用可能会耗尽每日配额。
您可以通过在此位置放置自己的密钥文件来解决这个问题:~/.google-service-cli/walletobjects1-secret.json
,假设已经为它启用了所需的walletobjects API。此类密钥文件可以从Google开发者控制台的APIs & auth -> Credentials -> Download JSON下载并直接使用。
有关如何设置Google项目和启用API的更多信息,请参阅官方文档。
调试
尽管CLI尽力提供可用的错误消息,但有时了解导致特定问题的确切原因可能很有用。这是通过允许将所有客户端-服务器通信以原样输出到标准错误来实现的。
使用--debug
标志将使用Debug
表示法将错误打印到标准错误。
您可以考虑将标准错误重定向到文件以方便使用,例如:walletobjects1 --debug <resource> <method> [options] 2>debug.txt
。
依赖项
~18–30MB
~567K SLoC