Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 883 Bytes

File metadata and controls

39 lines (31 loc) · 883 Bytes

Backend API

Provides a set of helper functions to integrate the service into Franz.

Franz Backend Class Methods

validateServer(URL)

Validate if the given URL is a valid service instance.

Arguments

  1. string URL

Returns

Promise

Usage

// RocketChat integration
module.exports = (Franz) => {
  class RocketChat extends Franz {
    validateServer(URL) {
      const api = `${URL}/api/info`;
      return new Promise((resolve, reject) => {
        $.get(api, (resp) => {
          if (typeof(resp) === 'object' && 'build' in resp) {
            resolve();
          } else {
            reject();
          }
        }).fail(reject);
      });
    }
  }

  return RocketChat;
};