ctan-openapi-fetch
Version:
A thin wrapper around `openapi-fetch` for use with the CTAN API
50 lines (37 loc) • 1.35 kB
Markdown
# ctan-openapi-fetch
> A thin wrapper around openapi-fetch for use with the CTAN API
[![npm][npm-badge]](https://www.npmjs.com/package/ctan-openapi-fetch)
This package re-exports [openapi-fetch]'s factory functions
with some defaults for use with the CTAN API,
along with types pre-generated by [openapi-typescript],
allowing for easy use of type-safe CTAN clients.
[npm-badge]: https://img.shields.io/npm/v/ctan-openapi-fetch?logo=npm&logoColor=959da5&labelColor=2e353b&color=c40000
[openapi-fetch]: https://www.npmjs.com/package/openapi-fetch
[openapi-typescript]: https://www.npmjs.com/package/openapi-typescript
## Installation
```console
$ npm install ctan-openapi-fetch
```
## Usage
```typescript
import { createClient } from 'ctan-openapi-fetch/json-2.0';
const ctan = createClient();
const { data } = await ctan.GET('/pkg/{key}', {
params: {
path: {
key: 'texlive',
},
},
});
console.dir(data);
// {
// id: 'texlive',
// name: 'texlive',
// aliases: [],
// caption: 'A comprehensive distribution of TeX and friends',
// ...
```
For detailed usage of the factory functions and clients, please refer
to the [openapi-fetch documentation](https://openapi-ts.dev/openapi-fetch/).
## License
[MIT License](https://github.com/teatimeguest/node-texlive-packages/blob/main/packages/ctan-openapi-fetch/LICENSE)