# kwi25-sdk

> Simple TypeScript SDK for the-one-api

Latest version **1.0.3** (published 2022-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install kwi25-sdk
pnpm add kwi25-sdk
yarn add kwi25-sdk
bun add kwi25-sdk
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-12-21 |
| First published | 2022-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 113.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | kwi25 |

## Links

- npm: https://www.npmjs.com/package/kwi25-sdk
- Repository: https://github.com/kwingram25/kwi25-sdk
- Homepage: https://github.com/kwingram25/kwi25-sdk#readme
- Issues: https://github.com/kwingram25/kwi25-sdk/issues
- npm.io page: https://npm.io/package/kwi25-sdk

## Dependencies (1)

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

## Recent versions

- 1.0.3 (latest) — 2022-12-21
- 1.0.2 — 2022-12-21
- 1.0.1 — 2022-12-21
- 1.0.0 — 2022-12-21

## README

# kwi26-sdk

This is a basic promise-based TypeScript SDK for [TheOneApi](https://the-one-api.dev).

```ts
import TheOneApi, { Character } from 'kwi25-sdk';

const lotr = new TheOneApi({ apiKey: 'YOUR_API_KEY' });

// Fetch all characters
const characters = lotr.character.list()
    .then((characters: Character[]) => {
        console.log(characters);
    })
    .catch(console.error);

// Fetch one movie
const rotk = lotr.movie.withId('5cd95395de30eff6ebccde5d');
console.log(await rotk.get());

// Fetch all quotes from a movie
console.log(await rotk.quotes());

// Fetch book chapters
const chapters = await lotr.book.withId(')

// Search for quotes
const quotes = await lotr.quotes.list({
    filter: { 'dialog': { 'eq': '/samwise/i' } },
    sort: { key: 'book', asc: true }
})
```

## List Querying
```ts
// Each lotr.*.list() call, as well as *.quotes() and *.chapters(), accepts the following options:
type ListOptions<D extends Document> = {
  pagination?: {
    offset?: number;
    limit?: number;
    page?: number;
  };
  sort?: {
    key: keyof D;
    asc: boolean;
  };
  filter?: {
    [key in keyof D]?:
      | { gt: number }     // Greater than
      | { lt: number }     // Less than
      | { gte: number }    // Greater than or equal
      | { inc: string[] }  // Includes
      | { exc: string[] }  // Excludes
      | { exist: boolean } // Exists: true/false
      | { eq: string }     // Match or regex match
      | { neq: string };   // Does not match or regex match
  };
};
```

## Dependencies
* [Typescript-Starter](https://github.com/bitjson/typescript-starter) - initial module/ESM boilerplate
* [Axios](https://axios.io) - browser/Node friendly fetching

## Running
```
git clone https://github.com/kwingram25/kwi25-sdk
cd ./kwi25-sdk
yarn install

# Tests
TEST_API_KEY=your-key yarn test
```

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