Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Use GraphQL API to get issue template #105

Open
skanehira opened this issue Feb 12, 2021 · 0 comments
Open

Use GraphQL API to get issue template #105

skanehira opened this issue Feb 12, 2021 · 0 comments
Labels
issue about issue features refactoring refactoring

Comments

@skanehira
Copy link
Owner

👔 Overview

Currently use REST API to get issue template from https://api.github.com/repos/:owner/:repo/git/trees/:branch but it's not better because we must filter files to get templates.

\ 'url': printf('https://api.github.com/repos/%s/%s/git/trees/%s', a:owner, a:repo, a:branch),

I found GraohQL API that can get issue template only.
Use this API we can improve get issue template to better.

https://docs.github.com/ja/graphql/reference/objects#issuetemplate

request

query {
  repositoryOwner(login: "skanehira") {
    repository(name: "gh.vim") {
     	issueTemplates {
        about
        body
        name
        title
      } 
    }
  }
}

response

{
  "data": {
    "repositoryOwner": {
      "repository": {
        "issueTemplates": [
          {
            "about": "Bug report",
            "body": "## 🐛 Summary\n<!--\nThanks your report.\nPlease write summary of bug.\n-->\n\n## 💔 Enviroment\n- Vim/Neovim Version:\n- OS: \n\n## 👀 Steps\n<!--\nPlease write how reproduce the bug.\n-->\n1. Do action\n2. Do another action\n3. Wrong Behavior !!\n\n## 🆗 Expected\n\n\n## 🚑 Actual\n\n\n",
            "name": "Bug report",
            "title": null
          },
          {
            "about": "Request",
            "body": "## 👔 Overview\n<!--\nThanks your request.\nPlease write summary of request.\n-->\n\n## 👖 How to achieve\n<!--\nHow to achieve the feature\n-->\n\n## 🧦 Steps\n<!--\nHow to use this feature\n-->\n\n1. Do action\n2. Do another action\n3. Wrong Behavior !!\n\n",
            "name": "Request",
            "title": null
          }
        ]
      }
    }
  }
}

👖 How to achieve

  1. Replace REST API to GrpahQL API to get issue templates

🧦 Steps

No current operations and changes

@skanehira skanehira added issue about issue features refactoring refactoring labels Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue about issue features refactoring refactoring
Projects
None yet
Development

No branches or pull requests

1 participant