# gaia-api-js

> GAIA API for JavaScript

Latest version **0.1.0** (published 2019-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install gaia-api-js
pnpm add gaia-api-js
yarn add gaia-api-js
bun add gaia-api-js
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-09-17 |
| First published | 2019-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | GAIA Team |
| Maintainers | gaia-team |
| Keywords | gaia, gaika, javascript, api |

## Links

- npm: https://www.npmjs.com/package/gaia-api-js
- Repository: https://gitlab.com/gaika-apis/javascript
- Homepage: https://gitlab.com/gaika-apis/javascript#readme
- Issues: https://gitlab.com/gaika-apis/javascript/issues
- npm.io page: https://npm.io/package/gaia-api-js

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.18.0

## Recent versions

- 0.1.0 (latest) — 2019-09-17
- 0.0.3 — 2019-09-04
- 0.0.2 — 2019-03-25
- 0.0.1 — 2019-03-25

## README

# GAIA API - JavaScript

This repository hosts an API for accessing GAIA remote services.

## Installing

Use `npm install gaia-api-js` or `yarn add gaia-api-js`.

## Usign GAIA API

Before using this API, you have to initialize the service with the API key provided.

```javascript
const GAIA = require('gaia-api-js')
const service = new GAIA('550e8400-e29b-41d4-a716-446655440000')
```

All the returning values are dependant of the OpenAPI specification for GAIA. Please, check it out [here](https://app.swaggerhub.com/apis-docs/GAIA-Service/GAIA/1.0.0) first.

### Classification

You can classify any content using `GAIA.classification`. Here is an example.

```javascript
const result = await service.classification(
  'es', // Language code matching the standard ISO 639.
  'Real Madrid, en la cuerda floja', // Title of the content.
  '¡Cristiano la lía parda!', // Introduction of the content.
  'Dos golpes tan seguidos...', // Text of the content.
  'https://marca.com' // Source of the content.
)
```

Returning `result` will be an object with two parameters:
* `code` is a `string` with the result code (example: `200`)
* `data`is an `object` with the result data. Please check the OpenAPI specification of this data (`ClassificationResponseBody`) [here](https://app.swaggerhub.com/apis-docs/GAIA-Service/GAIA/1.0.0).

### Filtering

You can classify any content using `GAIA.filtering`. Here is an example.

```javascript
const result = await service.filtering(
  'es', // Language code matching the standard ISO 639.
  'Real Madrid, en la cuerda floja. Dos golpes tan seguidos...' // Text of the content.
)
```

Returning `result` will be an object with two parameters:
* `code` is a `string` with the result code (example: `200`)
* `data`is an `object` with the result data. Please check the OpenAPI specification of this data (`FilteringResponseBody`) [here](https://app.swaggerhub.com/apis-docs/GAIA-Service/GAIA/1.0.0).

## Error handling

Service will fire an `error` when an unexpected behaviour occurs. This error has the next structure:
* `code` is a `string` with the error code (example: `500`)
* `name` is a `string` to display the error name.
* `message` is a `string` to display the error message.
* `stack` is the error stack.

## Dependencies

* `axios` is used for asynchronous request.

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