# webplug

> This holds the code for the webhooks plug client used to connect to the server

Latest version **0.0.12** (published 2024-01-23) · ISC license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2024-01-23 |
| First published | 2024-01-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 82.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | davetech012 |
| Keywords | webhooks, js-client, notifications |

## Links

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

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.6.5
- [typescript](https://npm.io/package/typescript.md) ^5.3.3

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 0.0.12 (latest) — 2024-01-23
- 0.0.11 — 2024-01-23
- 0.0.10 — 2024-01-23
- 0.0.9 — 2024-01-23
- 0.0.8 — 2024-01-23
- 0.0.6 — 2024-01-23
- 0.0.5 — 2024-01-22
- 0.0.4 — 2024-01-22
- 0.0.3 — 2024-01-21
- 0.0.2 — 2024-01-21
- 0.0.1 — 2024-01-21

## README

## Webhooks Plug JS Client

This holds the code for the webhooks plug client used to connect to the server

## installation

```bash
yarn add webplug
```

## Usage

```js
import Webplug from "webplug";

const webplugClient = new Webplug({
  url: "api-gateway-url",
  apiKey: "api-key-api-gateway",
});
```

## Documentation

### Services Module

1. Create a service: `webplugClient.services.create`

```js
const service = await webplugClient.services.create("service-name");
```

&nbsp;

2. Retreive all services: `webplugClient.services.all`

```js
const services = await webplugClient.services.all();
```

&nbsp;

3. Get the details of a service: `webplugClient.services.get`

```js
const service = await webplugClient.services.get("service-id");
```

&nbsp;

4. Delete a service: `webplugClient.services.delete`

```js
const service = await webplugClient.services.delete("service-id");
```

&nbsp;

### Users Module

1. Create a user: `webplugClient.users.create`

```js
const user = await webplugClient.users.create("name-of-user", "service-id");
```

&nbsp;

2. Retreive all users: `webplugClient.users.all`

```js
const users = await webplugClient.users.all("service-id");
```

&nbsp;

3. Get the details of a user: `webplugClient.users.get`

```js
const user = await webplugClient.users.get("user-id");
```

&nbsp;

4. Delete a user: `webplugClient.users.delete`

```js
const user = await webplugClient.users.delete("user-id");
```

&nbsp;

### Subscriptions Module

1. Create a subscription: `webplugClient.subscriptions.create`

```js
const subscription = await webplugClient.subscriptions.create(
  "event-type-name",
  "endpoint-url",
  "id-of-user"
);
```

&nbsp;

2. Retreive all subscriptions for an event type: `webplugClient.subscriptions.all`

```js
const subscriptions = await webplugClient.subscriptions.all("event-type-id");
```

&nbsp;

3. Get the details of a subscription: `webplugClient.subscriptions.get`

```js
const subscription = await webplugClient.subscriptions.get("subscription-id");
```

&nbsp;

4. Delete a subscription: `webplugClient.subscriptions.delete`

```js
const subscription = await webplugClient.subscriptions.delete(
  "subscription-id"
);
```

&nbsp;

### Event Types Module

1. Create an event type: `webplugClient.eventTypes.create`

```js
const eventType = await webplugClient.eventTypes.create(
  "event-type-name",
  "service-id"
);
```

&nbsp;

2. Retreive all event types for a service: `webplugClient.eventTypes.all`

```js
const eventTypes = await webplugClient.eventTypes.all("service-id");
```

&nbsp;

3. Get the details of an event type: `webplugClient.eventTypes.get`

```js
const eventType = await webplugClient.eventTypes.get("event-type-id");
```

&nbsp;

4. Delete an event type: `webplugClient.eventTypes.delete`

```js
const eventType = await webplugClient.eventTypes.delete("event-type-id");
```

&nbsp;

### Events Module

1. Publish an event: `webplugClient.events.publish`

```js
const event = await webplugClient.events.create(
  "event-type-name",
  "user-id",
  "message-payload"
);
```

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