{"meta":{"title":"ディスカッションでのGraphQL APIの利用","intro":"GitHub Discussions GraphQL API の使用方法について説明します。","product":"GraphQL API","breadcrumbs":[{"href":"/ja/graphql","title":"GraphQL API"},{"href":"/ja/graphql/guides","title":"ガイド"},{"href":"/ja/graphql/guides/using-the-graphql-api-for-discussions","title":"ディスカッションでの GraphQL の使用"}],"documentType":"article"},"body":"# ディスカッションでのGraphQL APIの利用\n\nGitHub Discussions GraphQL API の使用方法について説明します。\n\nGitHub Discussions GraphQL API を使用すると、ディスカッション投稿を取得、作成、編集、削除できます。\nGitHub Discussions の詳細については、「[ディスカッションについて](/ja/discussions/collaborating-with-your-community-using-discussions/about-discussions)」を参照してください。\n\nこの API は、認証されたユーザー、OAuth apps、および GitHub Apps で使用できます。 アクセス トークンには、プライベート リポジトリの `repo` スコープとパブリック リポジトリの `public_repo` スコープが必要です。 詳しくは、「[OAuth アプリのスコープ](/ja/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps)」をご覧ください。\n\n## フィールド\n\n### Repository.discussions\n\nリポジトリ内のディスカッションをリストします。\n`categoryId` が指定されている場合、そのカテゴリ内の結果だけが返されます。\n`answered` が指定されていない場合は、回答済みのディスカッションと未回答のディスカッションの両方が返されます。\n\n*シグニチャ:*\n\n```graphql\ndiscussions(\n  after: String,\n  before: String,\n  first: Int,\n  last: Int,\n  categoryId: ID = null,\n  \n  answered: Boolean = null,\n  \n  orderBy: DiscussionOrder = {field: UPDATED_AT, direction: DESC}\n) : Discussion\n```\n\n#### DiscussionOrder\n\n```graphql\n\"\"\"\nWays in which discussions can be ordered.\n\"\"\"\ninput DiscussionOrder {\n  \"\"\"\n  The field by which to order discussions.\n  \"\"\"\n  field: DiscussionOrderField!\n\n  \"\"\"\n  The direction in which to order discussions by the specified field.\n  \"\"\"\n  direction: OrderDirection!\n}\n```\n\n```graphql\n\"\"\"\nProperties by which discussion connections can be ordered.\n\"\"\"\nenum DiscussionOrderField {\n  \"\"\"\n  Order discussions by creation time.\n  \"\"\"\n  CREATED_AT\n\n  \"\"\"\n  Order discussions by most recent modification time.\n  \"\"\"\n  UPDATED_AT\n}\n```\n\n### リポジトリ.ディスカッションカテゴリ\n\nこのリポジトリ内で定義されている利用可能なディスカッションのカテゴリを返します。 各リポジトリは、最大で 25 個のカテゴリを持つことができます。 ディスカッションのカテゴリの詳細については、「[ディスカッションのカテゴリを管理する](/ja/discussions/managing-discussions-for-your-community/managing-categories-for-discussions#about-categories-for-discussions)」を参照してください。\n\n*シグニチャ:*\n\n```graphql\ndiscussionCategories(\n  after: String,\n  before: String,\n  first: Int,\n  last: Int,\n) : DiscussionCategoryConnection!\n```\n\n### リポジトリ.ディスカッション\n\nディスカッションを取得します。 指定された ID を持つディスカッションが存在しない場合、`null` を返します。\n\n*シグニチャ:*\n\n```graphql\ndiscussion(number: Int!) : Discussion\n```\n\n### Repository.pinnedDiscussions\n\nこのリポジトリにピン止めされたディスカッションを、ピンの位置の順序で返します。\n\n*シグニチャ:*\n\n```graphql\npinnedDiscussions(\n  after: String,\n  before: String,\n  first: Int,\n  last: Int,\n) : PinnedDiscussionConnection!\n```\n\n## オブジェクト\n\n**注:** 簡潔にするために、ここでは接続の種類は展開されません。 このスキーマで触れられているそれぞれのconnectionタイプは、GraphQL APIの他のconnectionと同じパターンに従います。 詳しくは、「[GraphQLの紹介](/ja/graphql/guides/introduction-to-graphql#connection)」をご覧ください。\n\n```graphql\nquery {\n  repository(owner: \"github\", name: \"some-repo\") {\n    discussions(first: 10) {\n      # type: DiscussionConnection\n      totalCount # Int!\n\n      pageInfo {\n        # type: PageInfo (from the public schema)\n        startCursor\n        endCursor\n        hasNextPage\n        hasPreviousPage\n      }\n\n      edges {\n        # type: DiscussionEdge\n        cursor\n        node {\n          # type: Discussion\n          id\n        }\n      }\n\n      nodes {\n        # type: Discussion\n        id\n      }\n    }\n  }\n}\n```\n\n### 議論\n\n<details>\n<summary>フィールド:</summary>\n\n```graphql\n\"\"\"\nA discussion in a repository.\n\"\"\"\ntype Discussion implements Comment & Deletable & Lockable & Node & Reactable & RepositoryNode & Subscribable & Updatable {\n  \"\"\"\n  Reason that the conversation was locked.\n  \"\"\"\n  activeLockReason: LockReason\n\n  \n  \"\"\"\n  Check if this discussion has been answered\n  \"\"\"\n  isAnswered: Boolean!\n  \n\n  \"\"\"\n  The comment chosen as this discussion's answer, if any.\n  \"\"\"\n  answer: DiscussionComment\n\n  \"\"\"\n  The time when a user chose this discussion's answer, if answered.\n  \"\"\"\n  answerChosenAt: DateTime\n\n  \"\"\"\n  The user who chose this discussion's answer, if answered.\n  \"\"\"\n  answerChosenBy: Actor\n\n  \"\"\"\n  The actor who authored the comment.\n  \"\"\"\n  author: Actor\n\n  \"\"\"\n  Author's association with the subject of the comment.\n  \"\"\"\n  authorAssociation: CommentAuthorAssociation!\n\n  \"\"\"\n  The main text of the discussion post.\n  \"\"\"\n  body: String!\n\n  \"\"\"\n  The body rendered to HTML.\n  \"\"\"\n  bodyHTML: HTML!\n\n  \"\"\"\n  The body rendered to text.\n  \"\"\"\n  bodyText: String!\n\n  \"\"\"\n  The category for this discussion.\n  \"\"\"\n  category: DiscussionCategory!\n\n  \"\"\"\n  The replies to the discussion.\n  \"\"\"\n  comments(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n  ): DiscussionCommentConnection!\n\n  \"\"\"\n  Identifies the date and time when the object was created.\n  \"\"\"\n  createdAt: DateTime!\n\n  \"\"\"\n  Check if this comment was created via an email reply.\n  \"\"\"\n  createdViaEmail: Boolean!\n\n  \"\"\"\n  Identifies the primary key from the database.\n  \"\"\"\n  databaseId: Int\n\n  \"\"\"\n  The actor who edited the comment.\n  \"\"\"\n  editor: Actor\n  id: ID!\n\n  \"\"\"\n  Check if this comment was edited and includes an edit with the creation data\n  \"\"\"\n  includesCreatedEdit: Boolean!\n\n  \"\"\"\n  The moment the editor made the last edit\n  \"\"\"\n  lastEditedAt: DateTime\n\n  \"\"\"\n  `true` if the object is locked\n  \"\"\"\n  locked: Boolean!\n\n  \"\"\"\n  The number identifying this discussion within the repository.\n  \"\"\"\n  number: Int!\n\n  \"\"\"\n  Identifies when the comment was published at.\n  \"\"\"\n  publishedAt: DateTime\n\n  \"\"\"\n  A list of reactions grouped by content left on the subject.\n  \"\"\"\n  reactionGroups: [ReactionGroup!]\n\n  \"\"\"\n  A list of Reactions left on the Issue.\n  \"\"\"\n  reactions(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Allows filtering Reactions by emoji.\n    \"\"\"\n    content: ReactionContent\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n\n    \"\"\"\n    Allows specifying the order in which reactions are returned.\n    \"\"\"\n    orderBy: ReactionOrder\n  ): ReactionConnection!\n\n  \"\"\"\n  The repository associated with this node.\n  \"\"\"\n  repository: Repository!\n\n  \"\"\"\n  The path for this discussion.\n  \"\"\"\n  resourcePath: URI!\n\n  \"\"\"\n  The title of this discussion.\n  \"\"\"\n  title: String!\n\n  \"\"\"\n  Identifies the date and time when the object was last updated.\n  \"\"\"\n  updatedAt: DateTime!\n\n  \"\"\"\n  The URL for this discussion.\n  \"\"\"\n  url: URI!\n\n  \"\"\"\n  A list of edits to this content.\n  \"\"\"\n  userContentEdits(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n  ): UserContentEditConnection\n\n  \"\"\"\n  Check if the current viewer can delete this object.\n  \"\"\"\n  viewerCanDelete: Boolean!\n\n  \"\"\"\n  Can user react to this subject\n  \"\"\"\n  viewerCanReact: Boolean!\n\n  \"\"\"\n  Check if the viewer is able to change their subscription status for the repository.\n  \"\"\"\n  viewerCanSubscribe: Boolean!\n\n  \"\"\"\n  Check if the current viewer can update this object.\n  \"\"\"\n  viewerCanUpdate: Boolean!\n\n  \"\"\"\n  Did the viewer author this comment.\n  \"\"\"\n  viewerDidAuthor: Boolean!\n\n  \"\"\"\n  Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.\n  \"\"\"\n  viewerSubscription: SubscriptionState\n}\n```\n\n</details>\n\n### ディスカッションコメント\n\n<details>\n<summary>フィールド</summary>\n\n```graphql\n\"\"\"\nA comment on a discussion.\n\"\"\"\ntype DiscussionComment implements Comment & Deletable & Minimizable & Node & Reactable & Updatable & UpdatableComment {\n  \"\"\"\n  The actor who authored the comment.\n  \"\"\"\n  author: Actor\n\n  \"\"\"\n  Author's association with the subject of the comment.\n  \"\"\"\n  authorAssociation: CommentAuthorAssociation!\n\n  \"\"\"\n  The body as Markdown.\n  \"\"\"\n  body: String!\n\n  \"\"\"\n  The body rendered to HTML.\n  \"\"\"\n  bodyHTML: HTML!\n\n  \"\"\"\n  The body rendered to text.\n  \"\"\"\n  bodyText: String!\n\n  \"\"\"\n  Identifies the date and time when the object was created.\n  \"\"\"\n  createdAt: DateTime!\n\n  \"\"\"\n  Check if this comment was created via an email reply.\n  \"\"\"\n  createdViaEmail: Boolean!\n\n  \"\"\"\n  Identifies the primary key from the database.\n  \"\"\"\n  databaseId: Int\n\n  \"\"\"\n  The time when this replied-to comment was deleted\n  \"\"\"\n  deletedAt: DateTime\n\n  \"\"\"\n  The discussion this comment was created in\n  \"\"\"\n  discussion: Discussion\n\n  \"\"\"\n  The actor who edited the comment.\n  \"\"\"\n  editor: Actor\n  id: ID!\n\n  \"\"\"\n  Check if this comment was edited and includes an edit with the creation data\n  \"\"\"\n  includesCreatedEdit: Boolean!\n\n  \"\"\"\n  Has this comment been chosen as the answer of its discussion?\n  \"\"\"\n  isAnswer: Boolean!\n\n  \"\"\"\n  Returns whether or not a comment has been minimized.\n  \"\"\"\n  isMinimized: Boolean!\n\n  \"\"\"\n  The moment the editor made the last edit\n  \"\"\"\n  lastEditedAt: DateTime\n\n  \"\"\"\n  Returns why the comment was minimized.\n  \"\"\"\n  minimizedReason: String\n\n  \"\"\"\n  Identifies when the comment was published at.\n  \"\"\"\n  publishedAt: DateTime\n\n  \"\"\"\n  A list of reactions grouped by content left on the subject.\n  \"\"\"\n  reactionGroups: [ReactionGroup!]\n\n  \"\"\"\n  A list of Reactions left on the Issue.\n  \"\"\"\n  reactions(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Allows filtering Reactions by emoji.\n    \"\"\"\n    content: ReactionContent\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n\n    \"\"\"\n    Allows specifying the order in which reactions are returned.\n    \"\"\"\n    orderBy: ReactionOrder\n  ): ReactionConnection!\n\n  \"\"\"\n  The threaded replies to this comment.\n  \"\"\"\n  replies(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n  ): DiscussionCommentConnection!\n\n  \"\"\"\n  The discussion comment this comment is a reply to\n  \"\"\"\n  replyTo: DiscussionComment\n\n  \"\"\"\n  The path for this discussion comment.\n  \"\"\"\n  resourcePath: URI!\n\n  \"\"\"\n  Identifies the date and time when the object was last updated.\n  \"\"\"\n  updatedAt: DateTime!\n\n  \"\"\"\n  The URL for this discussion comment.\n  \"\"\"\n  url: URI!\n\n  \"\"\"\n  A list of edits to this content.\n  \"\"\"\n  userContentEdits(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n  ): UserContentEditConnection\n\n  \"\"\"\n  Check if the current viewer can delete this object.\n  \"\"\"\n  viewerCanDelete: Boolean!\n\n  \"\"\"\n  Can the current user mark this comment as an answer?\n  \"\"\"\n  viewerCanMarkAsAnswer: Boolean!\n\n  \"\"\"\n  Check if the current viewer can minimize this object.\n  \"\"\"\n  viewerCanMinimize: Boolean!\n\n  \"\"\"\n  Can user react to this subject\n  \"\"\"\n  viewerCanReact: Boolean!\n\n  \"\"\"\n  Can the current user unmark this comment as an answer?\n  \"\"\"\n  viewerCanUnmarkAsAnswer: Boolean!\n\n  \"\"\"\n  Check if the current viewer can update this object.\n  \"\"\"\n  viewerCanUpdate: Boolean!\n\n  \"\"\"\n  Reasons why the current viewer can not update this comment.\n  \"\"\"\n  viewerCannotUpdateReasons: [CommentCannotUpdateReason!]!\n\n  \"\"\"\n  Did the viewer author this comment.\n  \"\"\"\n  viewerDidAuthor: Boolean!\n}\n```\n\n</details>\n\n### ディスカッションカテゴリ\n\n<details>\n<summary>フィールド</summary>\n\n```graphql\n\"\"\"\nA category for discussions in a repository.\n\"\"\"\ntype DiscussionCategory implements Node & RepositoryNode {\n  \"\"\"\n  Identifies the date and time when the object was created.\n  \"\"\"\n  createdAt: DateTime!\n\n  \"\"\"\n  A description of this category.\n  \"\"\"\n  description: String\n\n  \"\"\"\n  An emoji representing this category.\n  \"\"\"\n  emoji: String!\n\n  \"\"\"\n  This category's emoji rendered as HTML.\n  \"\"\"\n  emojiHTML: HTML!\n  id: ID!\n\n  \"\"\"\n  Whether or not discussions in this category support choosing an answer with the markDiscussionCommentAsAnswer mutation.\n  \"\"\"\n  isAnswerable: Boolean!\n\n  \"\"\"\n  The name of this category.\n  \"\"\"\n  name: String!\n\n  \"\"\"\n  The repository associated with this node.\n  \"\"\"\n  repository: Repository!\n\n  \"\"\"\n  Identifies the date and time when the object was last updated.\n  \"\"\"\n  updatedAt: DateTime!\n}\n```\n\n</details>\n\n### PinnedDiscussion\n\n<details>\n<summary>フィールド:</summary>\n\n```graphql\n\"\"\"\nA Pinned discussion is a discussion pinned to a repository's index page.\n\"\"\"\ntype PinnedDiscussion implements Node & RepositoryNode {\n  \"\"\"\n  Identifies the date and time when the object was created.\n  \"\"\"\n  createdAt: DateTime!\n\n  \"\"\"\n  Identifies the primary key from the database.\n  \"\"\"\n  databaseId: Int\n\n  \"\"\"\n  The discussion that was pinned.\n  \"\"\"\n  discussion: Discussion!\n\n  \"\"\"\n  Color stops of the chosen gradient\n  \"\"\"\n  gradientStopColors: [String!]!\n  id: ID!\n\n  \"\"\"\n  Background texture pattern\n  \"\"\"\n  pattern: PinnedDiscussionPattern!\n\n  \"\"\"\n  The actor that pinned this discussion.\n  \"\"\"\n  pinnedBy: Actor!\n\n  \"\"\"\n  Preconfigured background gradient option\n  \"\"\"\n  preconfiguredGradient: PinnedDiscussionGradient\n\n  \"\"\"\n  The repository associated with this node.\n  \"\"\"\n  repository: Repository!\n\n  \"\"\"\n  Identifies the date and time when the object was last updated.\n  \"\"\"\n  updatedAt: DateTime!\n}\n```\n\n</details>\n\n#### PinnedDiscussionPattern\n\n<details>\n<summary>値</summary>\n\n```graphql\n\"\"\"\nPreconfigured background patterns that may be used to style discussions pinned within a repository.\n\"\"\"\nenum PinnedDiscussionPattern {\n  \"\"\"\n  An upward-facing chevron pattern\n  \"\"\"\n  CHEVRON_UP\n\n  \"\"\"\n  A hollow dot pattern\n  \"\"\"\n  DOT\n\n  \"\"\"\n  A solid dot pattern\n  \"\"\"\n  DOT_FILL\n\n  \"\"\"\n  A heart pattern\n  \"\"\"\n  HEART_FILL\n\n  \"\"\"\n  A friendly octocat face pattern\n  \"\"\"\n  OCTOFACE\n\n  \"\"\"\n  A plus sign pattern\n  \"\"\"\n  PLUS\n}\n```\n\n</details>\n\n#### PinnedDiscussionGradient\n\n<details>\n<summary>値</summary>\n\n```graphql\n\"\"\"\nPreconfigured gradients that may be used to style discussions pinned within a repository.\n\"\"\"\nenum PinnedDiscussionGradient {\n  \"\"\"\n  A gradient of blue to mint\n  \"\"\"\n  BLUE_MINT\n\n  \"\"\"\n  A gradient of blue to purple\n  \"\"\"\n  BLUE_PURPLE\n\n  \"\"\"\n  A gradient of pink to blue\n  \"\"\"\n  PINK_BLUE\n\n  \"\"\"\n  A gradient of purple to coral\n  \"\"\"\n  PURPLE_CORAL\n\n  \"\"\"\n  A gradient of red to orange\n  \"\"\"\n  RED_ORANGE\n}\n```\n\n</details>\n\n## インターフェイス\n\n### リポジトリディスカッション作成者\n\n`User` と `Organization` 型によって実装されます。\n**注:** それが `Organization` から変換されたものである場合にのみ、`User` は、それに関連するディスカッションを行います。\n\n<details>\n<summary>フィールド</summary>\n\n```graphql\n\"\"\"\nRepresents an author of discussions in repositories.\n\"\"\"\ninterface RepositoryDiscussionAuthor {\n  \"\"\"\n  Discussions this user has started.\n  \"\"\"\n  repositoryDiscussions(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Filter discussions to only those that have been answered or not. Defaults to\n    including both answered and unanswered discussions.\n    \"\"\"\n    answered: Boolean = null\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n\n    \"\"\"\n    Ordering options for discussions returned from the connection.\n    \"\"\"\n    orderBy: DiscussionOrder = {field: CREATED_AT, direction: DESC}\n\n    \"\"\"\n    Filter discussions to only those in a specific repository.\n    \"\"\"\n    repositoryId: ID\n  ): DiscussionConnection!\n}\n```\n\n</details>\n\n### リポジトリディスカッションコメントの著者\n\nまた、`User` および `Organization` 型によって実装されます。\n\n<details>\n<summary>フィールド</summary>\n\n```graphql\n\"\"\"\nRepresents an author of discussion comments in repositories.\n\"\"\"\ninterface RepositoryDiscussionCommentAuthor {\n  \"\"\"\n  Discussion comments this user has authored.\n  \"\"\"\n  repositoryDiscussionComments(\n    \"\"\"\n    Returns the elements in the list that come after the specified cursor.\n    \"\"\"\n    after: String\n\n    \"\"\"\n    Returns the elements in the list that come before the specified cursor.\n    \"\"\"\n    before: String\n\n    \"\"\"\n    Returns the first _n_ elements from the list.\n    \"\"\"\n    first: Int\n\n    \"\"\"\n    Returns the last _n_ elements from the list.\n    \"\"\"\n    last: Int\n\n    \"\"\"\n    Filter discussion comments to only those that were marked as the answer\n    \"\"\"\n    onlyAnswers: Boolean = false\n\n    \"\"\"\n    Filter discussion comments to only those in a specific repository.\n    \"\"\"\n    repositoryId: ID\n  ): DiscussionCommentConnection!\n}\n```\n\n</details>\n\n## 突然変異\n\n以下のミューテーションは、GraphQL API中の他のミューテーションと同じ実装パターンに従っています。 それぞれのミューテーションは、そのミューテーションから名付けられた `Input` 型の引数を 1 つ取り、指定されたフィールドを含む `Payload` 型を返します。\n\nたとえば、これは基本の `createDiscussion` ミューテーションで、新しいディスカッションを作成します。\n\n```graphql\nmutation {\n  # input type: CreateDiscussionInput\n  createDiscussion(input: {repositoryId: \"1234\", categoryId: \"5678\", body: \"The body\", title: \"The title\"}) {\n\n    # response type: CreateDiscussionPayload\n    discussion {\n      id\n    }\n  }\n}\n```\n\n### ディスカッションを作成\n\n入力フィールド:\n\n* `body: String!` 新しいディスカッションの本文。\n* `title: String!` 新しいディスカッションのタイトル。\n* `repositoryId: ID!` ディスカッションを作成するリポジトリの ID。\n* `categoryId: ID!` このリポジトリ内の `DiscussionCategory` の ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `discussion: Discussion` 作成されたディスカッション。\n\n### ディスカッションを更新\n\n入力フィールド:\n\n* `discussionId: ID!` 更新するディスカッションのノード ID。\n* `body: String` ディスカッション本文の新しい内容。\n* `title: String` 新しいディスカッション タイトル。\n* `categoryId: ID` このディスカッションを変更する同じリポジトリ内の `DiscussionCategory` のノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `discussion: Discussion` 変更されたディスカッション。\n\n### ディスカッションを削除\n\n入力フィールド:\n\n* `id: ID!` 削除するディスカッションのノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `discussion: Discussion` 削除されたディスカッション。\n\n### ディスカッションコメントを追加する\n\n入力フィールド:\n\n* `body: String!` コメントの内容。\n* `discussionId: ID!` コメントするディスカッションのノード ID。\n* `replyToId: ID` 返信するディスカッション コメントのノード ID。 存在しなければ、作成されるコメントはトップレベルのコメントになる。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `comment: DiscussionComment` 作成されたディスカッション コメント。\n\n### ディスカッションコメント更新\n\n入力フィールド:\n\n* `body: String!` コメント本文の新しい内容。\n* `commentId: ID!` 更新するディスカッション コメントのノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `comment: DiscussionComment` 更新されたディスカッション コメント。\n\n### ディスカッションコメントを削除\n\n入力フィールド:\n\n* `id: ID!` 削除するディスカッション コメントのノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `comment: DiscussionComment` 削除されたディスカッション コメント。\n\n### ディスカッションのコメントを回答としてマーク\n\n入力フィールド:\n\n* `id: ID!` 解答としてマークするディスカッション コメントのノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `discussion: Discussion` 選択したコメントを含むディスカッション。\n\n### ディスカッションコメントの解答としてのマークを解除する\n\n入力フィールド:\n\n* `id: ID!` 解答としてのマークを解除するディスカッション コメントのノード ID。\n* `clientMutationId: String` ミューテーションを行っているクライアントの一意の識別子。\n\n戻り値のタイプに関するフィールド:\n\n* `clientMutationId: String` 入力として提供される一意の識別子。\n* `discussion: Discussion` マークされていないコメントを含むディスカッション。\n\n## Search\n\n最上位の `search` フィールドからディスカッションが返される場合があります。 ディスカッションを検索するには、`type` として `DISCUSSION` を指定します。\n`SearchResultItemConnection` 型には、返されたディスカッションの数を報告するための `discussionCount` フィールドがあり、`Discussion` 型が `SearchResultItem` ユニオンに追加されます。 詳細については、「[Search](/ja/graphql/reference/search#query-searchresultitemconnection)」および「[ディスカッションを検索する](/ja/search-github/searching-on-github/searching-discussions)」を参照してください。"}