@hcb.gg/api
v0.1.1
Published
HCB API
Readme
HCB JavaScript API
Hey there! This is an NPM package for interacting with HCB's API.
Installation
npm i @hcb.gg/apiUsage
import HCB from '@hcb.gg/api';
// Make unauthenticated Transparency API requests
const organization = await hcb.transparency.organizations.hq.get();
console.log(organization);
// Get an OAuth access token
const { access_token } = await HCB.oauth.token.post({
"code": "H2rGV8bx8CWtIRFJACuKl8Z1Cim5JwYz3EuYgTHiULG",
"client_secret": "jiZltkvECRlScTHLKtaujrf4J7VGmQa6ZHk3G1KVbOO",
"client_id": "b2VpJGuIfgYA0FqXztB65JSRuhuJbEUDi37PgO3uPl5",
"scope": "read write",
"redirect_uri": "https://example.com",
"grant_type": "authorization_code"
});
// Use the access token to make authenticated requests
const hcb = new HCB({ access_token });
const transfer = await hcb.organizations.hq.transfers.post({
"to_organization_id": "scrapyard",
"name": "💸 Money",
"amount_cents": 1000
});
console.log(transfer);