latchkey

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Latchkey

Latchkey

Instructions

使用说明

Latchkey is a CLI tool that automatically injects credentials into curl commands for supported public APIs. Credentials (mostly API tokens) can be either manually managed or, for some services, Latchkey can open a browser login pop-up window and extract API credentials from the session.
Use this skill when the user asks you to work with third-party services like Slack, Discord, Dropbox, GitHub, Linear and others on their behalf.
Usage:
  1. Use
    latchkey curl
    instead of regular
    curl
    for supported services.
  2. Pass through all regular curl arguments - latchkey is a transparent wrapper.
  3. Use
    latchkey services list
    to get a list of supported services.
  4. Use
    latchkey services info <service_name>
    to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
  5. If necessary, get or renew credentials first. Run
    latchkey auth browser <service_name>
    to open a browser login pop-up window if supported.
  6. Look for the newest documentation of the desired public API online. If using the
    browser
    auth command, avoid bot-only endpoints.
  7. Do not initiate a new login if the credentials status is
    valid
    - the user might just not have the necessary permissions for the action you're trying to do.
Latchkey是一款CLI工具,可自动将凭证注入到针对受支持公开API的curl命令中。凭证(主要是API令牌)既可以手动管理,对于部分服务,Latchkey还可以打开浏览器登录弹窗并从会话中提取API凭证。
当用户要求你代表他们处理Slack、Discord、Dropbox、GitHub、Linear等第三方服务时,请使用此技能。
使用方法:
  1. 使用
    latchkey curl
    替代常规的
    curl
    来调用受支持的服务。
  2. 传递所有常规curl参数 - Latchkey是一个透明的封装工具。
  3. 使用
    latchkey services list
    获取受支持服务的列表。
  4. 使用
    latchkey services info <service_name>
    获取特定服务的相关信息(身份验证选项、凭证状态、API文档链接、特殊要求等)。
  5. 如有必要,先获取或更新凭证。如果服务支持,运行
    latchkey auth browser <service_name>
    打开浏览器登录弹窗。
  6. 在线查找目标公开API的最新文档。如果使用
    browser
    身份验证命令,请避免使用仅机器人可访问的端点。
  7. 如果凭证状态为
    valid
    ,请勿发起新的登录
    - 用户可能只是没有执行你尝试操作的必要权限。

Examples

示例

Make an authenticated curl request

发起经过身份验证的curl请求

bash
latchkey curl [curl arguments]
bash
latchkey curl [curl arguments]

Creating a Slack channel

创建Slack频道

bash
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
  -H 'Content-Type: application/json' \
  -d '{"name":"my-channel"}'
(Notice that
-H 'Authorization: Bearer
is not present in the invocation.)
bash
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
  -H 'Content-Type: application/json' \
  -d '{"name":"my-channel"}'
(注意调用命令中没有
-H 'Authorization: Bearer
这一部分。)

Getting Discord user info

获取Discord用户信息

bash
latchkey curl 'https://discord.com/api/v10/users/@me'
bash
latchkey curl 'https://discord.com/api/v10/users/@me'

Detect expired credentials and force a new login to Discord

检测过期凭证并强制重新登录Discord

bash
latchkey services info discord  # Check the "credentialStatus" field - shows "invalid"
latchkey auth browser discord
latchkey curl 'https://discord.com/api/v10/users/@me'
Only do this when you notice that your previous call ended up not being authenticated (HTTP 401 or 403).
bash
latchkey services info discord  # 查看"credentialStatus"字段 - 显示"invalid"
latchkey auth browser discord
latchkey curl 'https://discord.com/api/v10/users/@me'
仅当你发现之前的调用未通过身份验证(HTTP 401或403错误)时,才执行此操作。

List available services

列出可用服务

bash
latchkey services list
Lists all services that latchkey knows about.
bash
latchkey services list
列出Latchkey支持的所有服务。

Get service-specific info

获取特定服务信息

bash
latchkey services info slack
Returns auth options, credentials status, and developer notes about the service. If
browser
is not present in the
authOptions
field, the service requires the user to directly set API credentials via
latchkey auth set
or
latchkey auth set-nocurl
before making requests.
bash
latchkey services info slack
返回服务的身份验证选项、凭证状态和开发者说明。如果
authOptions
字段中没有
browser
,则该服务要求用户在发起请求前通过
latchkey auth set
latchkey auth set-nocurl
直接设置API凭证。

Notes

注意事项

  • All curl arguments are passed through unchanged
  • Return code, stdout and stderr are passed back from curl
  • 所有curl参数将原封不动地传递
  • 返回码、标准输出和标准错误将从curl返回

Currently supported services

当前支持的服务

Latchkey currently offers varying levels of support for the following services: AWS, Calendly, Discord, Dropbox, Figma, GitHub, GitLab, Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets, Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Yelp, Zoom, and more.
Latchkey目前对以下服务提供不同程度的支持:AWS、Calendly、Discord、Dropbox、Figma、GitHub、GitLab、Gmail、Google Analytics、Google Calendar、Google Docs、Google Drive、Google Sheets、Linear、Mailchimp、Notion、Sentry、Slack、Stripe、Telegram、Yelp、Zoom等。