Help us learn about your current experience with the documentation. Take the survey.

通过 GraphQL 使用自定义表情符号

  • 版本:免费版、专业版、旗舰版
  • 产品:GitLab.com、GitLab 自管版、GitLab 专属版

要在评论和描述中使用自定义表情符号, 您可以通过 GraphQL API 将其添加到顶级群组。

创建自定义表情符号

mutation CreateCustomEmoji($groupPath: ID!) {
  createCustomEmoji(input: {groupPath: $groupPath, name: "party-parrot", url: "https://cultofthepartyparrot.com/parrots/hd/parrot.gif"}) {
    clientMutationId
    customEmoji {
      name
    }
    errors
  }
}

将自定义表情符号添加到群组后,成员便可以像使用其他表情符号一样在评论中使用它。

属性

该查询接受以下属性:

属性 类型 必需 描述
group_path integer/string 顶级群组的 ID 或 URL 编码路径
name string 自定义表情符号的名称。
file string 自定义表情符号图片的 URL。

使用 GraphiQL

您可以使用 GraphiQL 来查询群组的表情符号。

  1. 打开 GraphiQL:

    • 对于 GitLab.com,请使用:https://gitlab.com/-/graphql-explorer
    • 对于 GitLab 自管版,请使用:https://gitlab.example.com/-/graphql-explorer
  2. 复制以下文本并将其粘贴到左侧窗口中。 在此查询中,gitlab-org 是群组路径。

        query GetCustomEmoji {
          group(fullPath: "gitlab-org") {
            id
            customEmoji {
              nodes {
                name,
                url
              }
            }
          }
        }
  3. 选择 Play

相关主题