# publitio_js_sdk

> Simple JavaScript SDK for Publitio API

Latest version **1.1.5** (published 2021-05-07) · 0 weekly downloads

## Install

```sh
npm install publitio_js_sdk
pnpm add publitio_js_sdk
yarn add publitio_js_sdk
bun add publitio_js_sdk
```

## 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 | 1.1.5 |
| Published | 2021-05-07 |
| First published | 2018-01-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 313.1 KB |
| Known vulnerabilities | 0 (+25 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | ob1y2k, ennmichael |
| Keywords | publitio, api, javascript, js |

## Links

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

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.9-1
- [form-data](https://npm.io/package/form-data.md) ^2.5.0
- [@types/node](https://npm.io/package/@types/node.md) ^12.7.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.5 (latest) — 2021-05-07
- 1.1.4 — 2021-03-08
- 1.1.3 — 2021-02-23
- 1.1.1 — 2019-10-25
- 1.1.0 — 2019-10-19
- 1.0.10 — 2019-08-16
- 1.0.9 — 2019-08-11
- 1.0.8 — 2019-08-08
- 1.0.7 — 2019-08-08
- 1.0.6 — 2019-08-08
- 1.0.5 — 2019-08-08
- 1.0.2 — 2019-08-08
- 1.0.4 — 2018-12-12
- 1.0.3 — 2018-12-11
- 1.0.1 — 2018-01-25
- … 1 more at https://npm.io/package/publitio_js_sdk/versions

## README

# Publitio JS SDK

JavaScript SDK for the [Publitio API](https://publit.io).

## Installation

### Using npm:

```shell
$ npm install publitio_js_sdk
```

### Using yarn:

```shell
$ yarn add publitio_js_sdk
```

## Usage

This library runs both in Node and in the browser.
When using this library in the browser, note that it is
in [UMD](https://github.com/umdjs/umd) format.
This means you can load it either as a simple
`<script>` tag, or using RequireJS. You should always load
`publitio-api.min.js` in the browser.

### Using `require` in Node:

```javascript
const PublitioAPI = require('publitio_js_sdk').default
const publitio = new PublitioAPI('<API key>', '<API secret>')
```

### Using RequireJS in the browser:
```javascript
requirejs(
  ['node_modules/publitio_js_sdk/build/publitio-api.min.js'],
  PublitioAPI => { /*...*/ }
)
```

### Using `<script>` tags:
```html
<script src="node_modules/publitio_js_sdk/build/publitio-api.min.js"></script>
```

### Using ES6 modules in Node:

```javascript
import PublitioAPI from 'publitio_js_sdk'
const publitio = new PublitioAPI('<API key>', '<API secret>')
```

### Using ES6 modules in the browser (for example, with Webpack or Browserify):

```javascript
import PublitioAPI from './node_modules/publitio_js_sdk/build/publitio-api.min.js'
const publitio = new PublitioAPI('<API key>', '<API secret>')
```

The reason why you should import `publitio-api.min.js` in the
browser is so that Webpack or Browserify wouldn't include
Node-specific modules in your build, making your bundle needlessly large.

## Examples

Sample API call to list files: 

```javascript
publitio.call('/files/list', 'GET', { offset: '0', limit: '10'})
        .then(response => { console.log(response) })
        .catch(error => { console.log(error) })
```

See the [examples directory](https://github.com/ob1y2k/publitio_js_sdk/tree/master/examples) for useful examples
and check the [official Publitio docs](https://publit.io/docs/).

For legacy reasons, the following is also allowed:

```javascript
import { publitioApi } from 'publitio_js_sdk'
const publitio = publitioApi('<API key>', '<API secret>')
```

The `publitioApi` function is deprecated and should be avoided.

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