Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spinque/query-api

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spinque/query-api

TypeScript library to use the Spinque Query API in your project.

  • 0.2.2
  • npm
  • Socket score

Version published
Weekly downloads
296
increased by232.58%
Maintainers
2
Weekly downloads
 
Created
Source

@spinque/query-api

TypeScript library to use the Spinque Query API in your project.

Usage

Defining queries

Defining a single query:

import { Query } from '@spinque/query-api';

const single_query: Query = {
  endpoint: 'movie_search',
  parameters: { terms: 'call me' }
};

Stacking queries, for example for faceted search:

const stacked_queries: Query[] = [{
  endpoint: 'movie_search',
  parameters: { terms: 'call me' }
}, {
  endpoint: 'genres'
}];

Fetching results

Fetching results for a single query using an instance of the Api class:

import { Api } from '@spinque/query-api';

const api = new Api({
  workspace: 'my-workspace',
  config: 'default',
  api: 'movies'
});

try {
  const response = await api.fetch(query, { count: 10, offset: 0 });
} catch (error: any) {
  console.error(error);
}

Fetching using custom HTTP-library

Getting the URL for a request to fetch it using your own HTTP-library of preference:

import { urlFromQueries } from '@spinque/query-api/utils';

const apiConfig = {
  workspace: 'my-workspace',
  config: 'default',
  api: 'movies'
};

const url = urlFromQueries(apiConfig, query, { count: 10, offset: 0 });

Keywords

FAQs

Package last updated on 07 Mar 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc