get-github-issue

A util to get github issue

Usage no npm install needed!

<script type="module">
  import getGithubIssue from 'https://cdn.skypack.dev/get-github-issue';
</script>

README

get-github-issue

A util to get github issue

Install

$ npm i -S get-github-issue
import GetGithubIssue from 'get-github-issue';

Or umd builds are also available

<script src="path/to/get-github-issue.js"></script>

Usage

const issue = new GetGithubIssue({
    clientID: '', // GitHub Application Client ID
    clientSecret: '', // GitHub Application Client Secret
    repo: '', // GitHub repo
    owner: '', // GitHub repo owner
    cache: true, // Whether to use the cache
    excerpt: 120, // Excerpt length
    pageSize: 10, // Length per page
    requestType: 'full', // Custom media types: raw | text | html | full
    loadFn: state => state, // Loading status
    labels: {
        post: 'POST', // Post label
        page: 'PAGE', // Post label
        config: 'CONFIG', // Config label
    },
});

// Get through pagination and tags
issue
    .byPage({
        page: 1, // Custom page number
        labels: 'code', // Custom labels
        type: 'POST', // Label type
    })
    .then(data => {
        console.log(data);
    });

// Get through ID
issue.byId(13).then(data => {
    console.log(data);
});

License

MIT © Harvey Zack