# src-ts

> A TypeScript library with type definitions for the speedrun.com REST API, with some common utility functions.

Latest version **2.10.0** (published 2023-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install src-ts
pnpm add src-ts
yarn add src-ts
bun add src-ts
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.10.0 |
| Published | 2023-07-28 |
| First published | 2022-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 168.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mitchell Merry |
| Maintainers | mitchell-merry |
| Keywords | speedrun.com |

## Links

- npm: https://www.npmjs.com/package/src-ts
- npm.io page: https://npm.io/package/src-ts

## Dependencies (2)

- [bottleneck](https://npm.io/package/bottleneck.md) ^2.19.5
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.7

## Recent versions

- 2.10.0 (latest) — 2023-07-28
- 2.9.0 — 2023-04-07
- 2.8.0 — 2022-11-17
- 2.7.2 — 2022-11-08
- 2.7.1 — 2022-11-08
- 2.7.0 — 2022-11-08
- 2.6.3 — 2022-11-08
- 2.6.2 — 2022-10-28
- 2.6.1 — 2022-10-27
- 2.6.0 — 2022-10-27
- 2.5.3 — 2022-10-26
- 2.5.2 — 2022-10-26
- 2.5.1 — 2022-10-17
- 2.5.0 — 2022-10-13
- 2.4.4 — 2022-10-10
- … 18 more at https://npm.io/package/src-ts/versions

## README

# src-ts
[![npm version](https://badge.fury.io/js/src-ts.svg)](https://badge.fury.io/js/src-ts)

A TypeScript library providing functions to interface with and to describe the shape of the [public speedrun.com REST API](https://github.com/speedruncomorg/api) (v1).

- Types are defined under `/types`.
- Other utilities are defined under `/src`.

Find the package on npmjs.com [here](https://www.npmjs.com/package/src-ts).

DISCLAIMER: Functions that perform API requests are only added as I need them / they are requested. If one is missing, open an issue and I'll add it for you.

## Installation
With Node and npm installed (or equivalent):
```
npm i src-ts
```
If you wish to *just* use the type definitions provided (under `/types`), I recommend you install as a dev dependency only (with the `--save-dev` flag).

## Use
Import or require from 'src-ts' and you will have access to everything.

I recommend you use an identifier such as `SRC` to house the library, like so:
```js
// Modules
import * as SRC from 'src-ts';
// CommonJS
const SRC = require('src-ts');	

SRC.getGame('wys');	// returns a promise
```

But nothing stops you from doing it like so:
```js
// Modules
import { getGame } from 'src-ts';
// CommonJS
const { getGame } = require('src-ts');

getGame('wys');
```

For TypeScript, access is provided to the types under the same import:
```ts
import * as SRC from 'src-ts';

function doThingWithGame(game: SRC.Game) { ... }
```

Or, using the second method:
```ts
import { Game } from 'src-ts';

function doThingWithGame(game: Game) { ... }
```
Extensive documentation on functions and types ~~can be found on the wiki~~ is coming to the wiki, eventually.

## Build & Local Install
Clone or fork the repository, and then run the `build` npm script:
```bash
git clone https://github.com/mitchell-merry/src-ts.git
npm install

# Build library files & pack to tarball
npm run build
npm pack
```

To install the tarball in another project:
```bash
npm install <path-to-tarball>
```

For example, if I have a project `test-p` next to my clone of `src-ts`:
```bash
# Creates /lib folder in src-ts
src-ts> npm run build
# Creates 'src-ts-<version>.tgz' in src-ts
src-ts> npm pack
src-ts> cd ../test-p
# Installs the local package
test-p> npm install ../src-ts/src-ts-<version>.tgz
```

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