@haul/http-client-github
v0.2.1
Published
http client to ease interaction with github api(s)
Downloads
1
Readme
@haul/http-client-github ·
Install
Using npm:
> npm install @haul/http-client-github
Using yarn:
> yarn add @haul/http-client-github
Usage
import {
createGithubClient,
} from '@haul/http-client-github';
// Initialize the client
const { client, actions } = createGithubClient(
process.env.GITHUB_API_TOKEN,
);
;(async async () => {
await actions.issue.createComment('user', 'repo', '49302', `Lorem ipsum dolor sit amet`);
// You can of course interact with the client directly (note that you lose type-safety)
await client<null>('/path/to/endpoint', { method: 'DELETE' });
})();
createGithubClient(token: string, fns...) => { client, actions }
Creates a new client. You can pass http-client
compatible middleware as rest arguments and they
will be passed to the