Coder Social home page Coder Social logo

ringcentral-extensible's Introduction

RingCentral Extensible SDK

Build Status

RingCentral Extensible is a SDK with a tiny core and lots of extensions. It is an endeavour to get rid of bloated SDK. You install extensions on demand.

Getting help and support

If you are having difficulty using this SDK, or working with the RingCentral API, please visit our developer community forums for help and to get quick answers to your questions. If you wish to contact the RingCentral Developer Support team directly, please submit a help ticket from our developer website.

Installation

yarn add @rc-ex/core

Then you should be able to import the SDK like this:

import RingCentral from '@rc-ex/core';

Usage

You can also find lots of useful code snippets from test cases.

This SDK supports extensions. You can enable features by installing extensions.

If you want to add features to this SDK, create an extension.

Logging

The logging implementation copies AWS SDK logging.

To enable logging:

RingCentral.config.logger = console;

Or you could use a third-party logger:

import winston from 'winston';

const logger = winston.createLogger({
  transports: [
    new winston.transports.Console({
      format: winston.format.simple(),
    }),
  ],
});
RingCentral.config.logger = logger;

Sample log entries:

[3/16/2022, 9:58:47 AM HTTP GET 200 OK] https://platform.devtest.ringcentral.com /restapi/v1.0/account/~/extension/~/call-log
[3/16/2022, 5:47:53 PM HTTP POST 401 Unauthorized] https://platform.ringcentral.com /restapi/oauth/token

A demo application printing logs to console.

Binary content downloading

Some sample code for binary content downloading may not work.

Because RingCentral is gradually migrating binary content to CDN such as media.ringcentral.com.

For example, to download the attachment of a fax:

// `message` is the fax message object
const r = await rc.get(message.attachments[0].uri, undefined, { responseType: 'arraybuffer' });
const content = r.data;

The following does NOT work:

// `message` is the fax message object
const content = await rc
  .restapi()
  .account()
  .extension()
  .messageStore(message.id)
  .content(message.attachments[0].id)
  .get();

Rule of thumb

But not all binary content has been migrated to CDN. If the resource to download provides you with a CDN uri, use that CDN uri. If there is no CDN uri provided, construct the uri as sample code shows.

For maintainers

Regenerate code using latest swagger spec

Please refer to the RingCentral Code Generator project.

Test

yarn reset && yarn compile && yarn test

Test one test case

t=auto-recover yarn test

Publish

Update version number in packages/core/src/Rest.ts

yarn lerna publish from-package

By default lerna check git tag to determine which packages to publish. from-package will make lerna check npmjs.com instead.

As I just tried, it works without from-package option.

NPM 2FA

I don't know how to make it work with lerna and I have to disable it via npmjs.com GUI: I disabled "Require two-factor authentication for write actions".

Add dependency

yarn workspace @rc-ex/debug add ramda

Todo

  • Extension to refresh token
  • Extension to do pagination

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.