我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 2020-11-12. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

查询

本文内容

关于查询

每个 GraphQL 架构的查询和突变都有根类型。 查询类型可定义从服务器中检索数据的 GraphQL 操作。

更多信息请参阅“关于查询。”

注: 对于 用户到服务器 GitHub 应用程序 请求,您应该使用单独的查询来处理问题和拉取请求。 例如,使用 is:issueis:pull-request 过滤器及其等效功能。 使用 search 连接在单一查询中返回问题和拉取请求的组合将产生一组空节点。

连接

organizations

类型: OrganizationConnection!

A list of organizations.

参数

名称 描述

after (String)

Returns the elements in the list that come after the specified cursor.

before (String)

Returns the elements in the list that come before the specified cursor.

first (Int)

Returns the first n elements from the list.

last (Int)

Returns the last n elements from the list.


search

类型: SearchResultItemConnection!

Perform a search across resources.

参数

名称 描述

after (String)

Returns the elements in the list that come after the specified cursor.

before (String)

Returns the elements in the list that come before the specified cursor.

first (Int)

Returns the first n elements from the list.

last (Int)

Returns the last n elements from the list.

query (String!)

The search string to look for.

type (SearchType!)

The types of search items to search within.


securityAdvisories

类型: SecurityAdvisoryConnection!

GitHub Security Advisories.

参数

名称 描述

after (String)

Returns the elements in the list that come after the specified cursor.

before (String)

Returns the elements in the list that come before the specified cursor.

first (Int)

Returns the first n elements from the list.

last (Int)

Returns the last n elements from the list.

publishedSince (DateTime)

Filter advisories to those published since a time in the past.

updatedSince (DateTime)

Filter advisories to those updated since a time in the past.


securityVulnerabilities

类型: SecurityVulnerabilityConnection!

Software Vulnerabilities documented by GitHub Security Advisories.

参数

名称 描述

after (String)

Returns the elements in the list that come after the specified cursor.

before (String)

Returns the elements in the list that come before the specified cursor.

ecosystem (SecurityAdvisoryEcosystem)

An ecosystem to filter vulnerabilities by.

first (Int)

Returns the first n elements from the list.

last (Int)

Returns the last n elements from the list.

package (String)

A package name to filter vulnerabilities by.

severities ([SecurityAdvisorySeverity!])

A list of severities to filter vulnerabilities by.


users

类型: UserConnection!

A list of users.

参数

名称 描述

after (String)

Returns the elements in the list that come after the specified cursor.

before (String)

Returns the elements in the list that come before the specified cursor.

first (Int)

Returns the first n elements from the list.

last (Int)

Returns the last n elements from the list.


字段

codeOfConduct

类型: CodeOfConduct

Look up a code of conduct by its key.

参数

名称 描述

key (String!)

The code of conduct's key.


codesOfConduct

类型: [CodeOfConduct]

Look up a code of conduct by its key.


enterprise

类型: Enterprise

Look up an enterprise by URL slug.

参数

名称 描述

invitationToken (String)

The enterprise invitation token.

slug (String!)

The enterprise URL slug.


license

类型: License

Look up an open source license by its key.

参数

名称 描述

key (String!)

The license's downcased SPDX ID.


licenses

类型: [License]!

Return a list of known open source licenses.


meta

类型: GitHubMetadata!

Return information about the GitHub instance.


node

类型: Node

Fetches an object given its ID.

参数

名称 描述

id (ID!)

ID of the object.


nodes

类型: [Node]!

Lookup nodes by a list of IDs.

参数

名称 描述

ids ([ID!]!)

The list of node IDs.


organization

类型: Organization

Lookup a organization by login.

参数

名称 描述

login (String!)

The organization's login.


rateLimit

类型: RateLimit

The client's rate limit information.

参数

名称 描述

dryRun (Boolean)

If true, calculate the cost for the query without evaluating it.

The default value is false.


relay

类型: Query!

Hack to workaround https://github.com/facebook/relay/issues/112 re-exposing the root query object.


repository

类型: Repository

Lookup a given repository by the owner and repository name.

参数

名称 描述

name (String!)

The name of the repository.

owner (String!)

The login field of a user or organization.


repositoryOwner

类型: RepositoryOwner

Lookup a repository owner (ie. either a User or an Organization) by login.

参数

名称 描述

login (String!)

The username to lookup the owner by.


resource

类型: UniformResourceLocatable

Lookup resource by a URL.

参数

名称 描述

url (URI!)

The URL.


securityAdvisory

类型: SecurityAdvisory

Fetch a Security Advisory by its GHSA ID.

参数

名称 描述

ghsaId (String!)

GitHub Security Advisory ID.


topic

类型: Topic

Look up a topic by name.

参数

名称 描述

name (String!)

The topic's name.


user

类型: User

Lookup a user by login.

参数

名称 描述

login (String!)

The user's login.


viewer

类型: User!

The currently authenticated user.