YusukeIwaki / GitHub-Issue-Viewer-2

2 stars 0 forks source link

GitHubのGraphQLのAPI使う #11

Open YusukeIwaki opened 7 years ago

YusukeIwaki commented 7 years ago

最新のissueに紐づくコメントも一緒に取りたいので、GraphQL使う

YusukeIwaki commented 7 years ago

リクエスト例

# Type queries into this side of the screen, and you will 
# see intelligent typeaheads aware of the current GraphQL type schema, 
# live syntax, and validation errors highlighted within the text.

# We'll get you started with a simple query showing your username!
query { 
  search(first:5, after:"Y3Vyc29yOjg=", query:"involves:YusukeIwaki", type: ISSUE) {
    issueCount,
    edges {
      node {
        ...on Issue {
          title,
          repository {
            url
          }
        }
        ...on PullRequest {
          title,
          repository {
            url
          }
        }
      }
      cursor
    }
    pageInfo {
      hasNextPage
      startCursor
      endCursor
    }
  }
}

レスポンス

{
  "data": {
    "search": {
      "issueCount": 946,
      "edges": [
        {
          "node": {
            "title": "fix the issue that RealmObjectObserver's callback is called repeatedly",
            "repository": {
              "url": "https://github.com/RocketChat/Rocket.Chat.Android"
            }
          },
          "cursor": "Y3Vyc29yOjk="
        },
        {
          "node": {
            "title": "Added a burger menu",
            "repository": {
              "url": "https://github.com/RocketChat/Rocket.Chat.Android"
            }
          },
          "cursor": "Y3Vyc29yOjEw"
        },
        {
          "node": {
            "title": "[v1.0-beta] `stream-room-messages` doesn't work",
            "repository": {
              "url": "https://github.com/RocketChat/Rocket.Chat.Android"
            }
          },
          "cursor": "Y3Vyc29yOjEx"
        },
        {
          "node": {
            "title": "Push notifications using the Cordova plugin code",
            "repository": {
              "url": "https://github.com/RocketChat/Rocket.Chat.Android"
            }
          },
          "cursor": "Y3Vyc29yOjEy"
        },
        {
          "node": {
            "title": "1.0.1リリース",
            "repository": {
              "url": "https://github.com/YusukeIwaki/GitHub-Issue-Viewer-2"
            }
          },
          "cursor": "Y3Vyc29yOjEz"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "startCursor": "Y3Vyc29yOjk=",
        "endCursor": "Y3Vyc29yOjEz"
      }
    }
  }
}