Skip to content

webhooks-plug/webhooks-plug-js-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webhooks Plug JS Client

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

installation

yarn add webplug

Usage

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
const service = await webplugClient.services.create("service-name");

 

  1. Retreive all services: webplugClient.services.all
const services = await webplugClient.services.all();

 

  1. Get the details of a service: webplugClient.services.get
const service = await webplugClient.services.get("service-id");

 

  1. Delete a service: webplugClient.services.delete
const service = await webplugClient.services.delete("service-id");

 

Users Module

  1. Create a user: webplugClient.users.create
const user = await webplugClient.users.create("name-of-user", "service-id");

 

  1. Retreive all users: webplugClient.users.all
const users = await webplugClient.users.all("service-id");

 

  1. Get the details of a user: webplugClient.users.get
const user = await webplugClient.users.get("user-id");

 

  1. Delete a user: webplugClient.users.delete
const user = await webplugClient.users.delete("user-id");

 

Subscriptions Module

  1. Create a subscription: webplugClient.subscriptions.create
const subscription = await webplugClient.subscriptions.create(
  "event-type-name",
  "endpoint-url",
  "id-of-user"
);

 

  1. Retreive all subscriptions for an event type: webplugClient.subscriptions.all
const subscriptions = await webplugClient.subscriptions.all("event-type-id");

 

  1. Get the details of a subscription: webplugClient.subscriptions.get
const subscription = await webplugClient.subscriptions.get("subscription-id");

 

  1. Delete a subscription: webplugClient.subscriptions.delete
const subscription = await webplugClient.subscriptions.delete(
  "subscription-id"
);

 

Event Types Module

  1. Create an event type: webplugClient.eventTypes.create
const eventType = await webplugClient.eventTypes.create(
  "event-type-name",
  "service-id"
);

 

  1. Retreive all event types for a service: webplugClient.eventTypes.all
const eventTypes = await webplugClient.eventTypes.all("service-id");

 

  1. Get the details of an event type: webplugClient.eventTypes.get
const eventType = await webplugClient.eventTypes.get("event-type-id");

 

  1. Delete an event type: webplugClient.eventTypes.delete
const eventType = await webplugClient.eventTypes.delete("event-type-id");

 

Events Module

  1. Publish an event: webplugClient.events.publish
const event = await webplugClient.events.create(
  "event-type-name",
  "user-id",
  "message-payload"
);

About

This repo holds the code for the webhooks js client repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published