npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@webex/integration-webexapis

v2.0.1

Published

> Webexapis is NodeJS library developed in TypeScript and can be used by JavaScript and TypeScript projects. It Contains webexapis implementations, DTOs, and some functionalites (token and context extraction from request) which can be used by developer ea

Downloads

17

Readme

WebexAPIs-Library

Webexapis is NodeJS library developed in typescript and can be used by Javascript and typescript projects. It Contains webexapis implementations, DTOs, and some functionalites (token and context extraction from request) which can be used by developer easily.

Webexapi library implementation is based on starter-kit

Table Of Contents

Install

via npm: npm install webexapis via yarn: yarn add webexapis

Usage

(Use cases and how to use library functions)

> Simple demo NodeJS app

USE CASE 1 : Use of service layer apis methods

  • Developer has to implements only controllers no need to create service layer
// meetingController.ts

import express from "express";
const app = express();
const port = 3000;

import { meetingService } from "webexapis";
import { Request, Response } from "express";

app.get("/meeting", async (request: Request, response: Response) => {
  await meetingService
    .getListMeeting(request.query, request.headers)
    .then((result) => {
      response.status(result.status);
      response.send(result.data);
    })
    .catch((error) => {
      console.log("unable to fetch list of meetings");
      response.status(error.response.status);
      response.send(error.response.data);
    });
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});

USE CASE 2 : Use of webexapiclients apis methods

  • Here, Developer has to create controller and service layer. Inside service layer developer has to use webexapiclients api methods.
// meetingService.ts

import { webexApiClient } from "webexapis";

// this getListMeeting function used in controller which is shown in USE CASE 1
async getListMeeting(reqQueryParams: any, reqHeaders: GetMeetingByIdHeader) {
  return await this.webexAPIClient.getListMeeting(reqQueryParams, reqHeaders);
}

USE CASE 3 : Use of webexapiclient setAuthorization function

  • Here, Developer has to use setAuthorization function inside service layer to set token
// meetingService.ts

import { webexApiClient } from "webexapis";

// this getListMeeting function used in controller which is shown in USE CASE 1
async getListMeeting(reqQueryParams: any, reqHeaders: GetMeetingByIdHeader) {
  
  const {authorization} = CommonUtils.extractContextAndAuthFromRequest(
      undefined, // if request.body is not present then use undefined
      reqHeaders
    );
  
  // Use of set authorization
  if (authorization) {
      // Set auth header on Webex API Client
      this.webexAPIClient.setAuthorizationHeader(authorization);
    } else {
      console.log('No authorization/token received in request');
    }

  return await this.webexAPIClient.getListMeeting(reqQueryParams, reqHeaders);
}

USE CASE 4 : Use of commonUtils extraction method

  • If developer wants to extract authorization(token) and context from request so developer can use this functions inside service layer
// This is how we can extract 

    /**
     * Extract context from request body
     * Extract auth string from request header OR context
    */
    const {context, reqDataWithoutContext, authorization} = CommonUtils.extractContextAndAuthFromRequest(
      reqData,
      reqHeaders
    );
    
// This extracted values used by developer as per requirements.
// In use case 3 : Shown that how we can use authorization to set token

USE CASE 5 : Use of DTO

  • DTOs can be used for typecasting or to show the type of request/response object
  • (There's other usecases of DTO as well but we used it for typecasting)
//ex.1

import { meetingDto } from "webexapis";

const listMeetingQueryParams = <meetingDto.ListMeetingQueryParams>request.query;
const listMeetingHeaders = <meetingDto.GetMeetingByIdHeader>request.headers;

//ex. 2

//...
getListMeeting(reqQuery: meetingDto.ListMeetingQueryParams, reqHeaders: meetingDto.GetMeetingByIdHeader)
//...

List of WebexAPIs

Meeting apis


Membership apis


People apis


Recordings apis


Room apis(space)


(Note : More apis will be available later)

Method Signature and overview

(List of all available functions with signature) (Note : Function name indicates that it belongs to which apis and refer above section to know more about api Ex. type of api get/post...)

This methods can be used inside controller layer

meetingService

  import {meetingService} from 'webexapis'
  //...
  meetingService.createMeeting(request.body,request.headers);
  //...
  • createMeeting(request.body, request.headers)

  • getListMeeting(request.query, request.headers)

  • getListMeetingRegistrants(request.params.meetingId, request.query, request.headers)

  • getMeetingById(request.params.meetingId, request.query, request.headers)

  • registerMeetingRegistrants(request.params.meetingId, request.body, request.headers)

  • listMeetingParticipants(request.query, request.headers)

membershipService

  import {membershipService} from 'webexapis'
  //...
  membershipService.createMembership(request.body,request.headers);
  //...
  • createMembership(request.body, request.headers)

  • deleteMembership(request.params.membershipId, request.headers)

peopleService

  import {peopleService} from 'webexapis'
  //...
  peopleService.getPersonDetails(request.params.personId, request.query, request.headers);
  //...
  • getPersonDetails(request.params.personId, request.query, request.headers)

recordingsService

  import {recordingsService} from 'webexapis'
  //...
  recordingsService.listRecordings(request.query,request.headers);
  //...
  • listRecordings(request.query,request.headers)

roomsService

  import {roomsService} from 'webexapis'
  //...
  roomsService.createRoom(request.body,request.headers);
  //...
  • createRoom(request.body, request.headers)

This methods can be used inside service layer

Webexapiclients

  import {webexApiClient} from 'webexapis'
  //...
  {
  //Here, we need to set authorization without this api will not work
  webexAPIClient.setAuthorizationHeader(request.headers.authorization);
  webexAPIClient.getListMeeting(reqQueryParams, reqHeaders);
  }
  //...
  • createMeeting(request.body)

  • getListMeeting(request.query, request.headers)

  • getListMeetingRegistrants(request.params.meetingId, request.query, request.headers)

  • getMeetingById(meetingId, request.query, request.headers)

  • registerMeetingRegistrant(request.params.meetingId, request.body)

  • listParticipantsByMeetingId(request.query)

  • createMembership(request.body)

  • deleteMembership(request.params.membershipId)

  • getPersonDetails(request.params.personId, request.query)

  • createRoom(request.body)

  • listRecordings(request.query)

//Below method takes authorization as argument (authorization can be extracted using commonUtils method or from request.headers.authorization)

  • setAuthorizationHeader(request.headers.authorization)

CommonUtils methods

  import {CommonUtils} from 'webexapis'
  //...
   const {context, reqDataWithoutContext, authorization} = CommonUtils.extractContextAndAuthFromRequest(//
      request.body,
      request.headers
    );
    // if request.body is not presents in request then pass undefined in place of request. like (undefined,req.headers)
  //...

Refrences