{"meta":{"title":"查询","intro":"查询类型定义从服务器中检索数据的 GraphQL 操作。","product":"GraphQL API","breadcrumbs":[{"href":"/zh/graphql","title":"GraphQL API"},{"href":"/zh/graphql/reference","title":"参考"},{"href":"/zh/graphql/reference/queries","title":"查询"}],"documentType":"article"},"body":"# 查询\n\n查询类型定义从服务器中检索数据的 GraphQL 操作。\n\n## 关于查询\n\n每个 GraphQL 架构都有用于查询和变更的根类型。\n[查询类型](https://spec.graphql.org/June2018/#sec-Type-System)定义从服务器中检索数据的 GraphQL 操作。\n\n有关详细信息，请参阅 [使用 GraphQL 建立调用](/zh/graphql/guides/forming-calls-with-graphql#about-queries)。\n\n> \\[!NOTE]\n> 对于使用用户访问令牌发出的 GitHub App 请求，你应该为问题和拉取请求使用单独的查询。 例如，使用 `is:issue` 或 `is:pull-request` 筛选器及其等效项。 使用 `search` 连接在单一查询中返回问题和拉取请求的组合将产生一组空节点。\n\n## codeOfConduct\n\nLook up a code of conduct by its key.\n\n**Type:** CodeOfConduct\n\n### Arguments for `codeOfConduct`\n\n* `key` (String!): The code of conduct's key.\n\n## codesOfConduct\n\nLook up a code of conduct by its key.\n\n**Type:** \\[CodeOfConduct]\n\n## enterprise\n\nLook up an enterprise by URL slug.\n\n**Type:** Enterprise\n\n### Arguments for `enterprise`\n\n* `invitationToken` (String): The enterprise invitation token.\n* `slug` (String!): The enterprise URL slug.\n\n## enterpriseAdministratorInvitation\n\nLook up a pending enterprise administrator invitation by invitee, enterprise and role.\n\n**Type:** EnterpriseAdministratorInvitation\n\n### Arguments for `enterpriseAdministratorInvitation`\n\n* `enterpriseSlug` (String!): The slug of the enterprise the user was invited to join.\n* `role` (EnterpriseAdministratorRole!): The role for the enterprise member invitation.\n* `userLogin` (String!): The login of the user invited to join the enterprise.\n\n## enterpriseAdministratorInvitationByToken\n\nLook up a pending enterprise administrator invitation by invitation token.\n\n**Type:** EnterpriseAdministratorInvitation\n\n### Arguments for `enterpriseAdministratorInvitationByToken`\n\n* `invitationToken` (String!): The invitation token sent with the invitation email.\n\n## enterpriseMemberInvitation\n\nLook up a pending enterprise unaffiliated member invitation by invitee and enterprise.\n\n**Type:** EnterpriseMemberInvitation\n\n### Arguments for `enterpriseMemberInvitation`\n\n* `enterpriseSlug` (String!): The slug of the enterprise the user was invited to join.\n* `userLogin` (String!): The login of the user invited to join the enterprise.\n\n## enterpriseMemberInvitationByToken\n\nLook up a pending enterprise unaffiliated member invitation by invitation token.\n\n**Type:** EnterpriseMemberInvitation\n\n### Arguments for `enterpriseMemberInvitationByToken`\n\n* `invitationToken` (String!): The invitation token sent with the invitation email.\n\n## id\n\nID of the object.\n\n**Type:** ID!\n\n## license\n\nLook up an open source license by its key.\n\n**Type:** License\n\n### Arguments for `license`\n\n* `key` (String!): The license's downcased SPDX ID.\n\n## licenses\n\nReturn a list of known open source licenses.\n\n**Type:** \\[License]!\n\n## marketplaceCategories\n\nGet alphabetically sorted list of Marketplace categories.\n\n**Type:** \\[MarketplaceCategory!]!\n\n### Arguments for `marketplaceCategories`\n\n* `excludeEmpty` (Boolean): Exclude categories with no listings.\n* `excludeSubcategories` (Boolean): Returns top level categories only, excluding any subcategories.\n* `includeCategories` (\\[String!]): Return only the specified categories.\n\n## marketplaceCategory\n\nLook up a Marketplace category by its slug.\n\n**Type:** MarketplaceCategory\n\n### Arguments for `marketplaceCategory`\n\n* `slug` (String!): The URL slug of the category.\n* `useTopicAliases` (Boolean): Also check topic aliases for the category slug.\n\n## marketplaceListing\n\nLook up a single Marketplace listing.\n\n**Type:** MarketplaceListing\n\n### Arguments for `marketplaceListing`\n\n* `slug` (String!): Select the listing that matches this slug. It's the short name of the listing used in its URL.\n\n## marketplaceListings\n\nLook up Marketplace listings.\n\n**Type:** MarketplaceListingConnection!\n\n### Arguments for `marketplaceListings`\n\n* `adminId` (ID): Select listings that can be administered by the specified user.\n* `after` (String): Returns the elements in the list that come after the specified cursor.\n* `allStates` (Boolean): Select listings visible to the viewer even if they are not approved. If omitted or\n  false, only approved listings will be returned.\n* `before` (String): Returns the elements in the list that come before the specified cursor.\n* `categorySlug` (String): Select only listings with the given category.\n* `first` (Int): Returns the first n elements from the list.\n* `last` (Int): Returns the last n elements from the list.\n* `organizationId` (ID): Select listings for products owned by the specified organization.\n* `primaryCategoryOnly` (Boolean): Select only listings where the primary category matches the given category slug.\n* `slugs` (\\[String]): Select the listings with these slugs, if they are visible to the viewer.\n* `useTopicAliases` (Boolean): Also check topic aliases for the category slug.\n* `viewerCanAdmin` (Boolean): Select listings to which user has admin access. If omitted, listings visible to the\n  viewer are returned.\n* `withFreeTrialsOnly` (Boolean): Select only listings that offer a free trial.\n\n## meta\n\nReturn information about the GitHub instance.\n\n**Type:** GitHubMetadata!\n\n## node\n\nFetches an object given its ID.\n\n**Type:** Node\n\n### Arguments for `node`\n\n* `id` (ID!): ID of the object.\n\n## nodes\n\nLookup nodes by a list of IDs.\n\n**Type:** \\[Node]!\n\n### Arguments for `nodes`\n\n* `ids` (\\[ID!]!): The list of node IDs.\n\n## organization\n\nLookup a organization by login.\n\n**Type:** Organization\n\n### Arguments for `organization`\n\n* `login` (String!): The organization's login.\n\n## rateLimit\n\nThe client's rate limit information.\n\n**Type:** RateLimit\n\n### Arguments for `rateLimit`\n\n* `dryRun` (Boolean): If true, calculate the cost for the query without evaluating it.\n\n## relay\n\nWorkaround for re-exposing the root query object. (Refer to\n<https://github.com/facebook/relay/issues/112> for more information.).\n\n**Type:** Query!\n\n## repository\n\nLookup a given repository by the owner and repository name.\n\n**Type:** Repository\n\n### Arguments for `repository`\n\n* `followRenames` (Boolean): Follow repository renames. If disabled, a repository referenced by its old name will return an error.\n* `name` (String!): The name of the repository.\n* `owner` (String!): The login field of a user or organization.\n\n## repositoryOwner\n\nLookup a repository owner (ie. either a User or an Organization) by login.\n\n**Type:** RepositoryOwner\n\n### Arguments for `repositoryOwner`\n\n* `login` (String!): The username to lookup the owner by.\n\n## resource\n\nLookup resource by a URL.\n\n**Type:** UniformResourceLocatable\n\n### Arguments for `resource`\n\n* `url` (URI!): The URL.\n\n## search\n\nPerform a search across resources, returning a maximum of 1,000 results.\n\n**Type:** SearchResultItemConnection!\n\n### Arguments for `search`\n\n* `after` (String): Returns the elements in the list that come after the specified cursor.\n* `before` (String): Returns the elements in the list that come before the specified cursor.\n* `first` (Int): Returns the first n elements from the list.\n* `last` (Int): Returns the last n elements from the list.\n* `query` (String!): The search string to look for. GitHub search syntax is supported. For more\n  information, see \"Searching on\n  GitHub,\"\n  \"Understanding the search syntax,\"\n  and \"Sorting search results.\".\n* `type` (SearchType!): The types of search items to search within.\n\n## securityAdvisories\n\nGitHub Security Advisories.\n\n**Type:** SecurityAdvisoryConnection!\n\n### Arguments for `securityAdvisories`\n\n* `after` (String): Returns the elements in the list that come after the specified cursor.\n* `before` (String): Returns the elements in the list that come before the specified cursor.\n* `classifications` (\\[SecurityAdvisoryClassification!]): A list of classifications to filter advisories by.\n* `epssPercentage` (Float): The EPSS percentage to filter advisories by.\n* `epssPercentile` (Float): The EPSS percentile to filter advisories by.\n* `first` (Int): Returns the first n elements from the list.\n* `identifier` (SecurityAdvisoryIdentifierFilter): Filter advisories by identifier, e.g. GHSA or CVE.\n* `last` (Int): Returns the last n elements from the list.\n* `orderBy` (SecurityAdvisoryOrder): Ordering options for the returned topics.\n* `publishedSince` (DateTime): Filter advisories to those published since a time in the past.\n* `updatedSince` (DateTime): Filter advisories to those updated since a time in the past.\n\n## securityAdvisory\n\nFetch a Security Advisory by its GHSA ID.\n\n**Type:** SecurityAdvisory\n\n### Arguments for `securityAdvisory`\n\n* `ghsaId` (String!): GitHub Security Advisory ID.\n\n## securityVulnerabilities\n\nSoftware Vulnerabilities documented by GitHub Security Advisories.\n\n**Type:** SecurityVulnerabilityConnection!\n\n### Arguments for `securityVulnerabilities`\n\n* `after` (String): Returns the elements in the list that come after the specified cursor.\n* `before` (String): Returns the elements in the list that come before the specified cursor.\n* `classifications` (\\[SecurityAdvisoryClassification!]): A list of advisory classifications to filter vulnerabilities by.\n* `ecosystem` (SecurityAdvisoryEcosystem): An ecosystem to filter vulnerabilities by.\n* `first` (Int): Returns the first n elements from the list.\n* `last` (Int): Returns the last n elements from the list.\n* `orderBy` (SecurityVulnerabilityOrder): Ordering options for the returned topics.\n* `package` (String): A package name to filter vulnerabilities by.\n* `severities` (\\[SecurityAdvisorySeverity!]): A list of severities to filter vulnerabilities by.\n\n## sponsorables\n\nUsers and organizations who can be sponsored via GitHub Sponsors.\n\n**Type:** SponsorableItemConnection!\n\n### Arguments for `sponsorables`\n\n* `after` (String): Returns the elements in the list that come after the specified cursor.\n* `before` (String): Returns the elements in the list that come before the specified cursor.\n* `dependencyEcosystem` (SecurityAdvisoryEcosystem): Optional filter for which dependencies should be checked for sponsorable\n  owners. Only sponsorable owners of dependencies in this ecosystem will be\n  included. Used when onlyDependencies = true.\n  Upcoming Change on 2022-07-01 UTC\n  Description: dependencyEcosystem will be removed. Use the ecosystem argument instead.\n  Reason: The type is switching from SecurityAdvisoryEcosystem to DependencyGraphEcosystem.\n* `ecosystem` (DependencyGraphEcosystem): Optional filter for which dependencies should be checked for sponsorable\n  owners. Only sponsorable owners of dependencies in this ecosystem will be\n  included. Used when onlyDependencies = true.\n* `first` (Int): Returns the first n elements from the list.\n* `last` (Int): Returns the last n elements from the list.\n* `onlyDependencies` (Boolean): Whether only sponsorables who own the viewer's dependencies will be\n  returned. Must be authenticated to use. Can check an organization instead\n  for their dependencies owned by sponsorables by passing\n  orgLoginForDependencies.\n* `orderBy` (SponsorableOrder): Ordering options for users and organizations returned from the connection.\n* `orgLoginForDependencies` (String): Optional organization username for whose dependencies should be checked.\n  Used when onlyDependencies = true. Omit to check your own dependencies. If\n  you are not an administrator of the organization, only dependencies from its\n  public repositories will be considered.\n\n## topic\n\nLook up a topic by name.\n\n**Type:** Topic\n\n### Arguments for `topic`\n\n* `name` (String!): The topic's name.\n\n## user\n\nLookup a user by login.\n\n**Type:** User\n\n### Arguments for `user`\n\n* `login` (String!): The user's login.\n\n## viewer\n\nThe currently authenticated user.\n\n**Type:** User!"}