ipfs-search-client
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

ipfs-search.com search API client

Backers on Open Collective Sponsors on Open Collective

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

Package Sidebar

Install

npm i ipfs-search-client

Weekly Downloads

0

Version

1.1.1

License

AGPL-3.0-or-later

Unpacked Size

51.1 kB

Total Files

17

Last publish

Collaborators

  • dokterbob