# @janiscommerce/api-browse

> A package to handle JANIS Views Browse APIs

Latest version **2.0.0** (published 2019-07-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install @janiscommerce/api-browse
pnpm add @janiscommerce/api-browse
yarn add @janiscommerce/api-browse
bun add @janiscommerce/api-browse
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-07-18 |
| First published | 2019-06-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Janis |
| Maintainers | janiscommerce |

## Links

- npm: https://www.npmjs.com/package/@janiscommerce/api-browse
- Repository: https://github.com/janis-commerce/api-browse
- Homepage: https://github.com/janis-commerce/api-browse#readme
- Issues: https://github.com/janis-commerce/api-browse/issues
- npm.io page: https://npm.io/package/@janiscommerce/api-browse

## Dependencies (2)

- [superstruct](https://npm.io/package/superstruct.md) ^0.6.1
- [@janiscommerce/api-view](https://npm.io/package/@janiscommerce/api-view.md) ^1.3.0

## Recent versions

- 2.0.0 (latest) — 2019-07-18
- 1.3.1 — 2019-07-18
- 1.3.0 — 2019-07-18
- 1.2.1 — 2019-07-05
- 1.2.0 — 2019-06-24
- 1.1.3 — 2019-06-24
- 1.1.2 — 2019-06-21
- 1.1.1 — 2019-06-21
- 1.1.0 — 2019-06-21
- 1.0.0 — 2019-06-21

## README

# API Browse

[![Build Status](https://travis-ci.org/janis-commerce/api-browse.svg?branch=master)](https://travis-ci.org/janis-commerce/api-browse)
[![Coverage Status](https://coveralls.io/repos/github/janis-commerce/api-browse/badge.svg?branch=master)](https://coveralls.io/github/janis-commerce/api-browse?branch=master)

A package to handle JANIS Views Browse APIs

# Installation

```
npm install @janiscommerce/api-browse
```

# Usage

- API Browse Data
```js
'use strict';

const { ApiBrowseData } = require('@janiscommerce/api-browse');

class MyApiBrowseData extends ApiBrowseData {

	get sortableFields() {
		return [
			'id',
			'status'
		];
	}

	get availableFilters() {
		return [
			'id',
			{
				name: 'status',
				valueMapper: Number
			}
		];
	}

	async formatRows(rows) {
		return rows.map(row => ({ ...row, oneMoreField: true }));
	}

}

module.exports = MyApiBrowseData;
```

- API Browse Filters
```js
'use strict';

const { ApiBrowseFilters } = require('@janiscommerce/api-browse');

class MyApiBrowseFilters extends ApiBrowseFilters {

	get getFiltersValues() {
		return {
			someField: {
				options: [
					{ label: 'some.label1', value: 1 },
					{ label: 'some.label2', value: 2 }
				]
			}
		};
	}

}

module.exports = MyApiBrowseFilters;
```

# Function minimal configuration

```yml
functions:
  handler: path/to/your.handler
  events:
    - http:
        integration: lambda
        path: view/{entity}/browse/data
        method: GET
        request:
          parameters:
            paths:
              entity: true
```

---
_Source: https://npm.io/package/@janiscommerce/api-browse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
