0.2.1 • Published 5 years ago

@haul/http-client-github v0.2.1

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
5 years ago

@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