Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
knowledge-node
Advanced tools
Readme
Simple Node.js module for Google Graph Knowledge API.
Returns all possible types
to build search
parameters.
const Knowledge = require('knowledge-node')({ serverKey: '<Your Google Server Key>' });
const allTypes = Knowledge.types;
console.log(allTypes);
//"types": {
// "book": "Book",
// "bookSeries": "BookSeries",
// "educationalOrganization": "EducationalOrganization",
// ...
//}
Builds parameter object to be used on search
request.
Parameter | Type | Required | Information |
---|---|---|---|
query | String | Yes | |
limit | Number | No | Default: 20 |
indent | Boolean | No | Defaut: true |
types | Array[Types] | Yes |
const Knowledge = require('knowledge-node')({ serverKey: '<Your Google Server Key>' });
const query = 'Harry Potter';
const types = [
Knowledge.types.book,
Knowledge.types.bookSeries
];
const limit = 5;
const indent = true;
const parameters = Knowledge.buildParams(query, types, limit, indent);
//{
// "query": "Harry Potter",
// "limit": 5,
// "indent": true,
// "key": "<Google API Key>",
// "types": [
// "Book",
// "BookSeries"
// ]
//}
Makes search request to Google Knowledge API.
You must define correctly the search
parameters: please read Build Parameters
section.
For more extensive information about errors
and successful body response
, please read Google Knowledge Graph API Documentation.
const Knowledge = require('knowledge-node')({ serverKey: '<Your Google Server Key>' });
const query = 'Harry Potter';
const types = [
Knowledge.types.book,
Knowledge.types.bookSeries
];
const params = Knowledge.buildParams(query, types);
return Knowledge.search(params)
.then(body => {
//do something with success response
})
.catch(error => {
//handle error
});
First you should follow the Google Knowledge Graph Search API Prerequisites, so you have your Google Account setup.
Edit ./test/fixtures/auth.json file and add your Google Server Key. Install the dev dependencies and run the tests:
$ npm install
$ npm test
Licensed under the MIT License.
FAQs
Simple Node.js module for Google Knowledge API.
The npm package knowledge-node receives a total of 1 weekly downloads. As such, knowledge-node popularity was classified as not popular.
We found that knowledge-node 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.