
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A JavaScript interface to the Hud.ai API. To get started install via npm:
npm install --save hud-ai
First, you'll need to register a client application. This can currently only be done by reaching out to the engineering team.
const HudAi = require('hud-ai');
const client = HudAi.create({
clientId: 'CLIENT_ID',
redirectUri: 'http://www.example.com/oauth/callbacks/hud-ai'
});
// Send the user to the authorization URL, where they can choose to grant your
// app permissions to access the service on their behalf (if permission has
// already been given, they'll automatically be redirected)
window.location = client.getAuthorizeUri('token');
// token will be returned as the query param `authToken` to your redirect URL
const querystring = require('query-string');
const parsed = querystring.parse(location.hash);
client.setAccessToken(parsed.access_token);
NOTE: The process of token retrieval will need to be performed again when the token becomes invalid (they're currently valid for 30 days).
Because servers can be trusted to keep a secret, setup is much more straightforward.
Client Authentication:
const HudAi = require('hud-ai');
const client = HudAi.create({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET'
});
Acting on behalf of a user:
const redirectUrl = client.getAuthorizeUri('code');
// Send the user to the authorization URL, where they can choose to grant your
// app permissions to access the service on their behalf (if permission has
// already been given, they'll automatically be redirected)
// the code to exchange will be returned as the query param `code` to your
// redirect URL
const querystring = require('query-string');
const parsed = querystring.parse(location.search);
client.setAuthorizationCode(parsed.code);
Parameter | Usage | Example |
---|---|---|
clientId * | Registered Client ID | '46ef9d9b-89a9-4fd2-84cf-af6de31f2618' |
clientSecret | Registered Client Secret | '59170c3e-e2c9-4244-92d8-c3595d4af325' |
baseApiUrl | Specify an alternate server to request resources from | 'https://stage.api.hud.ai/v1' |
baseAuthUrl | Specify an alternate server to request auth tokens from | 'https://stage.accounts.hud.ai' |
redirectUri | Path to redirect auth requests to (required for #get_authorize_uri ) | 'https://app.example.com/oauth/callbacks/hud-ai' |
request | axios is used under the hood, pass a config through here |
client.articles.get('SOME_ARTICLE_ID')
.then(article => console.log(article))
.catch(err => console.log('Got an error!', err));
*
and bolded Type
indicates required paramlimit
s higher than that will have no effect)Entity | Method Base |
---|---|
Article | client.articles |
ArticleHighlights | client.articleHighlights |
ArticleKeyTerm | client.articleKeyTerms |
ArticleTag | client.articleTags |
Company | client.companies |
CompanyEvent | client.companyEvents |
CompanyIndustry | client.companyIndustries |
CompanyKeyTerm | client.companyKeyTerms |
CompanyProfile | client.companyProfile |
Domain | client.domains |
Industry | client.industries |
KeyTerm | client.keyTerms |
Person | client.people |
PersonKeyTerm | client.personKeyTerms |
Quote | client.quotes |
Source | client.sources |
TextCorpus | client.textCorpora |
Tweet | client.tweets |
User | client.users |
UserCompany | client.userCompanies |
UserCompanyGroup | client.userCompanyGroups |
UserContact | client.userContacts |
UserDigestSubscription | client.userDigestSubscriptions |
UserKeyTerm | client.userKeyTerms |
UserSource | client.userSources |
UserTemplate | client.userTemplates |
Video | client.videos |
FAQs
Hud.ai API Client
The npm package hud-ai receives a total of 8 weekly downloads. As such, hud-ai popularity was classified as not popular.
We found that hud-ai demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.