Code Monkey home page Code Monkey logo

blogviojs's Introduction

Client Library for the Blogvio API

This is a JavaScript client library for the Blogvio API, written in CoffeeScript, suitable for use in most browsers.

Build Status ##Installation The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm) or using Bower Package Manager (bower).

In the browser

This library will be available at http://blogvio.com/sdk/sdk.js so add the following script tag in the head section of your page:

<script type="text/javascript" src="http://blogvio.com/sdk/sdk.js"></script>

Package Managers

Npm

If you don't have node or npm installed go to http://nodejs.org/ and install it. After the installation run the following command in your project's directory:

npm install blogviojs

The package will be available in node_modules/blogviojs. ####Bower If you don't have bower installed follow the guide at http://bower.io/ to install it then run the following command in your project's directory:

bower install blogviojs

The package will be available in your defined bower folder.

##Usage After installing the library in your page you can use the Blogvio SDK.

The library exposes a global Blogvio variable that you can use to interact with the SDK's functions.

The first step is to initialize the SDK with your Blogvio app_id and redirect_url:

Blogvio.init('<app_id here>','<redirect_url here>');

After this step you can login using the Blogvio.auth() function.

You can pass a Boolean parameter that indicates if a popup should be opened or you just want to check if user is logged in. Default will open popup.

This has promise support built-in using the aye library.

//Check if user is logged in
Blogio.auth(false).then(function(){/*handle success*/},function(){/*handle fail*/});
//Open popup to login user
Blogio.auth().then(function(){/*handle success*/},function(){/*handle fail*/});

After user is logged in you call the Blogvio API using Blogvio.api(url,method,data). This function returns a promise. For example if you want to grab user info:

//Grab user info
Blogio.api('users/me').then(function(data){/*handle success*/},function(error){/*handle fail*/});

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.