GithubHelp home page GithubHelp logo

eliot-akira / cloudrail-si-node-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ivan801/cloudrail-si-node-sdk

0.0 3.0 0.0 239 KB

Unified API Library for: Cloud Storage, Social Profiles, Payment, Email, SMS & POIs. Included services are Dropbox, Google Drive, OneDrive, Box, Facebook, GitHub, Google+, LinkedIn, Instagram, Slack, Twitter, Windows Live, Yahoo, PayPal, Stripe, Mailjet, Sendgrid, Twilio, Nexmo, Google Places, Foursquare, Yelp.

Home Page: https://cloudrail.com

License: Other

JavaScript 100.00%

cloudrail-si-node-sdk's Introduction

CloudRail SI for node.js

Integrate Multiple Services With Just One API

CloudRail is a free software library which abstracts multiple APIs from different providers into a single and universal interface.

--- ---

Full documentation can be found at https://github.com/CloudRail/cloudrail-si-node-sdk/wiki

Learn more about CloudRail on https://cloudrail.com



With CloudRail, you can easily integrate external APIs into your application. CloudRail is an abstracted interface that takes several services and then gives a developer-friendly API that uses common functions between all providers. This means that, for example, upload() works in exactly the same way for Dropbox as it does for Google Drive, OneDrive, and other Cloud Storage Services, and getEmail() works similarly the same way across all social networks.

Current Interfaces

Interface Included Services
Cloud Storage Dropbox, Google Drive, OneDrive, Box
Profile Facebook, GitHub, Google+, LinkedIn, Slack, Twitter, Windows Live, Yahoo, Instagram
Payment PayPal, Stripe
Email Maljet, Sendgrid
SMS Twilio, Nexmo
Point of Interest Google Places, Foursquare, Yelp
Social Facebook, Twitter

Cloud Storage Interface:

  • Dropbox
  • Box
  • Google Drive
  • Microsoft OneDrive

Features:

  • Download files from Cloud Storage.
  • Upload files to Cloud Storage.
  • Get Meta Data of files, folders and perform all standard operations (copy, move, etc) with them.
  • Retrieve user and quota information
  • Generate share links for files and folders

Full Documentation

Code Example:

const services = require("cloudrail-si").services;
// let cs = new services.Box(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let cs = new services.OneDrive(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let cs = new services.GoogleDrive(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
let cs = new services.Dropbox(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");

cs.createFolder("/TestFolder", (err) => { // <---
    if (err) throw err;
    let fileStream = fs.createReadStream("UserData.csv");
    let size = fs.statSync("UserData.csv").size;
    cs.upload("/TestFolder/Data.csv", fileStream, size, false, (err) => { // <---
        if (err) throw err;
        console.log("Upload successfully finished");
    });
});

Profile Interface:

  • Facebook
  • Github
  • Google Plus
  • LinkedIn
  • Slack
  • Twitter
  • Windows Live
  • Yahoo
  • Instagram

Features

  • Get profile information, including full names, emails, genders, date of birth, and locales.
  • Retrieve profile pictures.
  • Login using the Social Network.

Full Documentation

Code Example:

const services = require("cloudrail-si").services;
// let profile = new services.GooglePlus(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let profile = new services.GitHub(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let profile = new services.Slack(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// let profile = new services.Instagram(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
// ...
let profile = new services.Facebook(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");

profile.getFullName((err, fullName) => {
    if (err) throw err;
    console.log("User's full name is " + fullName);
});

profile.getEmail((err, email) => {
    if (err) throw err;
    console.log("User's email address is " + email);
});

Payment Interface:

  • PayPal
  • Stripe

Features

  • Perform charges
  • Refund previously made charges
  • Manage subscriptions

Full Documentation

Code Example

const services = require("cloudrail-si").services;
const types = require("cloudrail-si").types;
// let payment = new services.Stripe(null, "[secretKey]");
let payment = new services.PayPal(null, true, "[clientIdentifier]", "[clientSecret]");

let source = new types.CreditCard(null, 6, 2021, "xxxxxxxxxxxxxxxx", "visa", "<FirstName>", "<LastName>", null);
payment.createCharge(500, "USD", source, (err, charge) => {
    if (err) throw err;
    console.log("Successfully charged " + charge.amount + " " + charge.currency);
});

Email Interface:

  • Mailjet
  • Sendgrid

Features

  • Send Email

Full Documentation

Code Example

const services = require("cloudrail-si").services;
// let email = new services.Mailjet(null, "[clientID]", "[clientSecret]");
let email = new services.Sendgrid(null, "[username]", "[password]");

email.sendEmail("[email protected]", "CloudRail", ["[email protected]", "[email protected]"], "Welcome", "Hello from CloudRail", null, null, null, (err) => {
    if (err) throw err;
    console.log("Email successfully sent");
});

SMS Interface:

  • Twilio
  • Nexmo

Features

  • Send SMS

Full Documentation

Code Example

const services = require("cloudrail-si").services;
// let sms = new services.Nexmo(null, "[clientIdentifier]", "[clientSecret]");
let sms = new services.Twilio(null, "[clientIdentifier]", "[clientSecret]");

sms.sendSMS("CloudRail", "+4912345678", "Hello from CloudRail", (err) => {
    if (err) throw err;
    console.log("SMS successfully sent");
});

Points of Interest Interface:

  • Google Places
  • Foursquare
  • Yelp

Features

  • Get a list of POIs nearby
  • Filter by categories or search term

Full Documentation

Code Example

const services = require("cloudrail-si").services;
// let poi = new services.Foursquare(null, "[clientID]", "[clientSecret]");
// let poi = new services.Yelp(null, "[consumerKey]", "[consumerSecret]", "[token]", "[tokenSecret]");
let poi = new services.GooglePlaces(null, "[apiKey]");

poi.getNearbyPOIs(49.4557091, 8.5279138, 1000, "restaurant", null, (err, pois) => {
    if (err) throw err;
    console.log("Amount of locations called 'restaurant' in a 1 km radius around the given coordinates: " + pois.length);
});

Social Interface:

  • Facebook
  • Twitter

Features

  • Get the IDs of a user's friends/followers. Works well with the Profile interface's "login with" to check if two of your users are friends on a platform
  • Post to a user's wall

Full Documentation

Code Example:

const services = require("cloudrail-si").services;
// let social = new services.Facebook(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]", "[state]");
let social = new services.Twitter(redirectReceiver, "[clientIdentifier]", "[clientSecret]", "[redirectUri]");

social.getConnections((err, connIds) => {
    if (err) throw err;
    console.log("User has " + connIds.length + " connections");
});

social.postUpdate("Hello from CloudRail", (err) => {
    if (err) throw err;
    console.log("Update posted");
});

More interfaces are coming soon.

Advantages of Using CloudRail

  • Consistent Interfaces: As functions work the same across all services, you can perform tasks between services simply.

  • Easy Authentication: CloudRail includes easy ways to authenticate, to remove one of the biggest hassles of coding for external APIs.

  • Switch services instantly: One line of code is needed to set up the service you are using. Changing which service is as simple as changing the name to the one you wish to use.

  • Simple Documentation: There is no searching around Stack Overflow for the answer. The CloudRail documentation at https://docs.cloudrail.com/ is regularly updated, clean, and simple to use.

  • No Maintenance Times: The CloudRail Libraries are updated when a provider changes their API.

  • Direct Data: Everything happens directly in the Library. No data ever passes a CloudRail server.

NPM

npm install cloudrail-si

Typescript

(this only concerns Typescript users)

The package includes an index.d.ts file. To use the typings provided, include services and types like so:

/// <reference path="node_modules/cloudrail-si/index.d.ts" />

import {PointsOfInterest} from "cloudrail-si/interfaces/PointsOfInterest";
import {Foursquare} from "cloudrail-si/services/Foursquare";
import {POI} from "cloudrail-si/types/POI";

let poi:PointsOfInterest = new Foursquare(null, "[clientID]", "[clientSecret]");

poi.getNearbyPOIs(49.4557091, 8.5279138, 1000, "restaurant", null, (err:Error, pois:POI[]) => {
    if (err) console.log(err);
    console.log("Amount of locations called 'restaurant' in a 1 km radius around the given coordinates: " + pois.length);
});

Examples

Check out https://github.com/CloudRail/cloudrail-si-node-sdk/tree/master/examples for examples of how to e.g. implement a redirectReceiver and more complex use cases.

Get Updates

To keep updated with CloudRail, including any new providers that are added, just add your email address to https://cloudrail.com/updates/.

Pricing

CloudRail is free to use. For all projects; commercial and non-commercial. We want APIs to be accessible to all developers. We want APIs to be easier to manage. This is only possible if there are free, powerful tools out there to do this. The only favor we are asking for, is to spread the word about this library. Thank you!

CloudRail also has enterprise licensing options. Please contact us for more information: [email protected]

Other Platforms

CloudRail is also available for other platforms like Android, iOS and Java. You can find all libraries on https://cloudrail.github.io

Questions?

Get in touch at any time by emailing us: [email protected]

or

Tag a question with cloudrail on StackOverflow

cloudrail-si-node-sdk's People

Contributors

florianwendel avatar felixkm avatar

Watchers

James Cloos avatar 3λiȯ+ avatar  avatar

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.