@haul/http-client-github

http client to ease interaction with github api(s)

Usage no npm install needed!

<script type="module">
  import haulHttpClientGithub from 'https://cdn.skypack.dev/@haul/http-client-github';
</script>

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