npm package: @sequel-dev/api
Description: ## Description
Latest version: 0.1.13

# @sequel-dev/api

## Description

Sequel JavaScript API SDK for Node.js

With Sequel APIs, you get access to pre-built audio, video and chat components with complete customization and a user experience that takes years to build in-house. Build your live video platform in minutes, not months.

## Installing

To install the this package, simply type add or install `@sequel-dev/api` using your favorite package manager:

- `npm install @sequel-dev/api`
- `yarn add @sequel-dev/api`
- `pnpm add @sequel-dev/api`

_Support for Browser and React Native coming soon_

## Getting Started

### Credentials

- In order to benefit from the SDK, you should have an account at Sequel, if you don't have it already, you can [create your free trial account](https://www.sequel.io/pricing).

- Once you have your account, go to the [admin panel](https://admin.sequel.io/) and click on the `Integrations` menu on the left sidebar.

- Copy the Client ID and Client Secret values from the Sequel API integration box to be used in the next step.

### Usage

The Sequel API SDK is structured in modules, please take a look at the following examples on how to use them:

Example 1: Utilizing the global sequel SDK object:

```ts
import { sequel } from "@sequel-dev/api";

// Initiate the API SDK with your credentials
const sdk = sequel.configure({ 
  clientId: 'client-id',
  clientSecret: 'client-secret'
})

// Start using the available methods of the SDK
sdk.company.getCompanyById(/** input parameter */)
sdk.networking.addNetworkingHub(/** input parameters */);
sdk.event.addEvent(/** input parameters */);
```

Example 2: Importing the modules individually as needed:

```ts
import { sequel, event, networking, company } from "@sequel-dev/api";

// Initiate the API SDK with your credentials or
// you can skip this step by setting the environment variables
// SEQUEL_API_CLIENT_ID and SEQUEL_API_SECRET_ID
sequel.configure({ 
  clientId: 'client-id',
  clientSecret: 'client-secret'
})

// Start using the available methods of the SDK
company.getCompanyById(/** input parameter */)
networking.addNetworkingHub(/** input parameters */);
event.addEvent(/** input parameters */);
```

> The list of available modules and respective methods can be found in the Reference section.

#### Async/await

We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
operator to wait for the promise returned by send operation as follows:

```js
// async/await.
try {
  const event = await eventService.addEvent(newEvent);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}
```

Async-await is clean, concise, intuitive, easy to debug and has better error handling
as compared to using Promise chains or callbacks.

#### Promises

You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining)
to execute send operation.

```js
eventService.addEvent(newEvent).then(
  (data) => {
    // process data.
  },
  (error) => {
    // error handling.
  }
);
```

## Reference

***networking***

_Create a new networking hub_
```ts
networking.addNetworkingHub()
```
_Return a list of participants_
```ts
networking.getNetworkingHubParticipants()
```
_Clear all networking hub chat channels with the option to clear individual circles_
```ts
networking.clearChat()
```
_Set a user profile_
```ts
networking.setUserProfile()
```
_Invite another user to join a conversation_
```ts
networking.inviteUser()
```
_Register a user for the networking hub_
```ts
networking.registerUser()
```
_Delete a registered user from the networking hub_
```ts
networking.deleteRegistrantById()
```
_Return the embed code for the Networking hub component_
```ts
networking.getEmbedNetworkingHubById()
```
_Find NetworkingHub by ID_
```ts
networking.getNetworkingHubById()
```
_Updates a NetworkingHub details_
```ts
networking.updateNetworkingHub()
```
_Retrieves the download URL for the MP4 recording for the specified circle id and recording id_
```ts
networking.getNetworkingHubCircleRecordingDownloadUrl()
```
***company***

_Find company by ID_
```ts
company.getCompanyById()
```
_Updates a company details_
```ts
company.updateCompany()
```
_List all companies under a parent company_
```ts
company.listChildCompanies()
```
_List all events under a parent company_
```ts
company.listCompanyEvents()
```
_Create a new company under a parent company_
```ts
company.addCompanyToParent()
```
_Update metadata for the company_
```ts
company.updateCompanyMetadata()
```
***event***

_Create a new event_
```ts
event.addEvent()
```
_Return the embed code for the event component_
```ts
event.getEmbedEventById()
```
_Return a list of all registered users_
```ts
event.getRegisteredUsers()
```
_Register a user for the event_
```ts
event.registerUser()
```
_Delete a registered user from the event_
```ts
event.deleteRegistrantById()
```
_Delete a presenter id from the event_
```ts
event.deletePresenterById()
```
_Add a presenter id to the event_
```ts
event.addPresenterById()
```
_Delete an organizer id from the event_
```ts
event.deleteHostById()
```
_Add an organizer id to the event_
```ts
event.addHostById()
```
_Return a list of replays for this event_
```ts
event.getAvailableReplays()
```
_Find event by ID_
```ts
event.getEventById()
```
_Updates an event details_
```ts
event.updateEvent()
```
_Delete an event_
```ts
event.deleteEvent()
```
_Create a new event based on source event _
```ts
event.cloneEvent()
```
***customization***

_Returns the event customization theme for all events for the company based on the business rules._
```ts
customization.getCompanyTheme()
```
_Returns the event customization theme for the event based on the business rules._
```ts
customization.getEventTheme()
```
_Returns the default event customization theme that applies to all events, unless overridden at the company and event level. This endpoint can be used for clients which update to theme or for preview. The default theme can be used as a starting point to edit new themes._
```ts
customization.getDefaultEventTheme()
```
_Returns an array of color pallets (with primary, secondary and tertiary colors) that can be used in the editor. This endpoint can be used for clients which update to theme or for preview._
```ts
customization.getSuggestedColorPallets()
```
_Returns the event customization theme overrides over the platform event customization theme that applies to all events for the company, unless overridden at the event level. This endpoint can be used for clients which update to theme or for preview._
```ts
customization.getCompanyEventsCustomization()
```
_Adds or updates event customization theme overrides that will be applied to the all events for the company. This endpoint can be used by clients which update to theme or for preview._
```ts
customization.updateCompanyEventsCustomization()
```
_Deletes the event customization theme for company. The events without their own customization will use the default Sequel Platform theme, after deletion._
```ts
customization.deleteCompanyEventsCustomization()
```
_Returns the event customization theme overrides over the platform and event company customization theme for the event. This endpoint can be used for clients which update to theme or for preview._
```ts
customization.getEventCustomization()
```
_Adds or updates event customization theme overrides that will be applied for the event. This endpoint can be used by clients which update to theme or for preview._
```ts
customization.updateEventCustomization()
```
_Deletes the event customization theme overrides for the event. All events default to company specific event customization theme, if it exists or the default platform theme, after deletion._
```ts
customization.deleteEventCustomization()
```
_Returns list of customized fonts associated with the company_
```ts
customization.getCompanyCustomizedFonts()
```
_Add new fonts for the company. The value is stored at the company level, but can be used by customization themes on both event and company levels. If the name of the font, matches the existing font, it will update the font URL._
```ts
customization.updateCompanyCustomizedFonts()
```
_Unregister the specified font associated with the specified company._
```ts
customization.deleteCompanyCustomizedFonts()
```
***usage***

_Participant List with engaged minutes_
```ts
usage.getParticipantListWithEngagedMinutesByEvent()
```
_Live video watched over time_
```ts
usage.getLiveVideoWatchedOverTime()
```
_Top participants by event type_
```ts
usage.getTopParticipantsByEventType()
```
_Events summary and average engagement time_
```ts
usage.getEventsSummaryAndAverageEngagementTime()
```
_Lifetime usage for a company_
```ts
usage.getLifetimeUsageForACompany()
```
_Usage for a company in a date range_
```ts
usage.getCompanyUsageByPeriod()
```
_Daily minutes in a date range_
```ts
usage.getDailyMinutesByPeriod()
```
_Virtual stage usage by the day in a date range_
```ts
usage.getDailyVirtualStageUsageByPeriod()
```
_Networking usage by the day in a date range_
```ts
usage.getNetworkingUsageByPeriod()
```
_Get poll results_
```ts
usage.getEventPollsResults()
```
_Get Q&A results_
```ts
usage.getEventQuestionsResults()
```
_Get chat transcripts_
```ts
usage.getChatTranscripts()
```
***webhooks***

_Creates a webhook subscription for the company or a particular event_
```ts
webhooks.registerWebhook()
```
_Deletes the webhook subscription based on the unique ID_
```ts
webhooks.unregisterWebhook()
```

## License

This SDK is distributed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
see LICENSE for more information.