ipfs-search-client
v1.1.1
Published
Official TypeScript/JavaScript API client for ipfs-search.com, generated from the OpenAPI 3.0 definition.
Downloads
12
Maintainers
Readme
ipfs-search.com search API client
Official TypeScript/JavaScript client for https://api.ipfs-search.com/, generated based on the OpenAPI 3.0 definition.
Environment
- Node.js
- Webpack
- Browserify
Language level
- ES5 - you must have a Promises/A+ library installed
- ES6
Module system
- CommonJS
- ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json
. (Reference)
Installing
npm install ipfs-search-client
Usage
Search
const IpfsSearchApi = require('ipfs-search-client');
const api = new IpfsSearchApi.DefaultApi();
const q = 'water'; // {{String}} Search string query, based on Elasticsearch's [Query string query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query) syntax.
const opts = {
type: 'any', // {{Type}} Resource type. Omit to return all types.
page: 0, // {{Integer}} Page number.
};
api.searchGet(q, opts).then((error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: {data}');
}
});
Metadata
const IpfsSearchApi = require('ipfs-search-client');
const api = new IpfsSearchApi.DefaultApi();
const hash = 'QmcDCte64xtxqTVzdWnT5MG9yi3dFsNuLZjAyess4RJFWc'; // {{String}} IPLD Content ID (CID).
api.metadatahashGet(hash).then((error, data, response) => {
console.log('return');
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: {data}');
}
});
Building
To build an compile the typescript sources to javascript use:
npm install
npm run build
Publishing
First build the package then run npm publish