chat (v1)
PREREQUISITE: Read ../gws-shared/SKILL.md for auth, global flags, and security rules. If missing, run gws generate-skills to create it.
CODEBLOCK0
Helper Commands
| Command | Description |
|---|
+send | Send a message to a space |
API Resources
customEmojis
- create — Creates a custom emoji. Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.
- delete — Deletes a custom emoji. By default, users can only delete custom emoji they created. Emoji managers assigned by the administrator can delete any custom emoji in the organization. See Learn about custom emojis in Google Chat. Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization.
- get — Returns details about a custom emoji. Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.
- list — Lists custom emojis visible to the authenticated user. Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat and Manage custom emoji permissions.
media
- download — Downloads media. Download is supported on the URI /v1/media/{+name}?alt=media.
- upload — Uploads an attachment. For an example, see Upload media as a file attachment.
spaces
- completeImport — Completes the import process for the specified space and makes it visible to users.
- create — Creates a space. Can be used to create a named space, or a group chat in Import mode. For an example, see Create a space.
- delete — Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see Delete a space.
- findDirectMessage — Returns the existing direct message with the specified user. If no direct message space is found, returns a 404 NOT_FOUND error. For an example, see Find a direct message. With app authentication, returns the direct message space between the specified user and the calling Chat app.
- get — Returns details about a space. For an example, see Get details about a space.
- list — Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see List spaces.
- patch — Updates a space. For an example, see Update a space. If you're updating the displayName field and receive the error message ALREADY_EXISTS, try a different display name.. An existing space within the Google Workspace organization might already use this display name.
- search — Returns a list of spaces in a Google Workspace organization based on an administrator's search. In the request, set use_admin_access to true. For an example, see Search for and manage spaces.
- setup — Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see Set up a space with initial members. To specify the human members to add, add memberships with the appropriate membership.member.name. To add a human user, use users/{user}, where {user} can be the email address for the user.
- members — Operations on the 'members' resource
- messages — Operations on the 'messages' resource
- spaceEvents — Operations on the 'spaceEvents' resource
users
- sections — Operations on the 'sections' resource
- spaces — Operations on the 'spaces' resource
Discovering Commands
Before calling any API method, inspect it:
CODEBLOCK1
Use gws schema output to build your --params and --json flags.
chat (v1)
前置条件: 请阅读 ../gws-shared/SKILL.md 了解认证、全局标志和安全规则。如果该文件缺失,请运行 gws generate-skills 创建。
bash
gws chat <资源> <方法> [标志]
辅助命令
API 资源
customEmojis
- create — 创建自定义表情符号。自定义表情符号仅适用于 Google Workspace 账户,且管理员必须为组织开启自定义表情符号功能。更多信息,请参阅了解 Google Chat 中的自定义表情符号和管理自定义表情符号权限。
- delete — 删除自定义表情符号。默认情况下,用户只能删除自己创建的自定义表情符号。管理员分配的表情符号管理员可以删除组织中的任何自定义表情符号。请参阅了解 Google Chat 中的自定义表情符号。自定义表情符号仅适用于 Google Workspace 账户,且管理员必须为组织开启自定义表情符号功能。
- get — 返回自定义表情符号的详细信息。自定义表情符号仅适用于 Google Workspace 账户,且管理员必须为组织开启自定义表情符号功能。更多信息,请参阅了解 Google Chat 中的自定义表情符号和管理自定义表情符号权限。
- list — 列出已认证用户可见的自定义表情符号。自定义表情符号仅适用于 Google Workspace 账户,且管理员必须为组织开启自定义表情符号功能。更多信息,请参阅了解 Google Chat 中的自定义表情符号和管理自定义表情符号权限。
media
- download — 下载媒体文件。通过 URI /v1/media/{+name}?alt=media 支持下载。
- upload — 上传附件。示例请参阅将媒体作为文件附件上传。
spaces
- completeImport — 完成指定空间的导入过程,使其对用户可见。
- create — 创建空间。可用于创建命名空间,或处于导入模式的群聊。示例请参阅创建空间。
- delete — 删除命名空间。始终执行级联删除,即空间中的子资源(如发布的消息和空间中的成员资格)也会被删除。示例请参阅删除空间。
- findDirectMessage — 返回与指定用户的现有私信。如果未找到私信空间,则返回 404 NOTFOUND 错误。示例请参阅查找私信。使用应用认证时,返回指定用户与调用 Chat 应用之间的私信空间。
- get — 返回空间的详细信息。示例请参阅获取空间详细信息。
- list — 列出调用者所属的空间。群聊和私信在发送第一条消息之前不会列出。示例请参阅列出空间。
- patch — 更新空间。示例请参阅更新空间。如果更新 displayName 字段时收到 ALREADYEXISTS 错误消息,请尝试使用其他显示名称。Google Workspace 组织中可能已有现有空间使用了此显示名称。
- search — 根据管理员搜索返回 Google Workspace 组织中的空间列表。在请求中,将 useadminaccess 设置为 true。示例请参阅搜索和管理空间。
- setup — 创建空间并向其中添加指定用户。调用用户会自动添加到空间,不应在请求中指定为成员资格。示例请参阅使用初始成员设置空间。要指定添加的人类成员,请使用相应的 membership.member.name 添加成员资格。要添加人类用户,请使用 users/{user},其中 {user} 可以是用户的电子邮件地址。
- members — 对 members 资源的操作
- messages — 对 messages 资源的操作
- spaceEvents — 对 spaceEvents 资源的操作
users
- sections — 对 sections 资源的操作
- spaces — 对 spaces 资源的操作
发现命令
在调用任何 API 方法之前,请先检查它:
bash
浏览资源和方法
gws chat --help
检查方法的必需参数、类型和默认值
gws schema chat.<资源>.<方法>
使用 gws schema 输出来构建你的 --params 和 --json 标志。