Giter Site home page Giter Site logo

surl-node's Introduction

surl-node

NodeJS client for SURL services

Installation

Simply run npm install surl-node and then include it in your scripts using var surl = require("surl-node");.

Getting Started

After installing surl-node and adding the module to your script, you can authenticate with

surl.authenticate("username","password",function(err){
    //Do what you need to here
});

and then shorten a URL with

surl.url("http://google.com/",{shorturl:"google",pubstats:false,privurl:true},function(err,slug){
    //Once again, do what you need to here
});

Methods

surl.authenticate(username,password,callback)

Authenticates you with the SURL API using your username and password. The callback returns an error if an issue occurred when authenticating.

surl.url(longurl,options,callback)

Converts the URL provided to a shortened URL and fires the callback. The callback is in the format of err,slug. Available options are:

  • shorturl - defines the slug to be used. If this is not set, a random slug will be generated
  • pubstats - determines whether statistics for your shortened URL should be publicly accessible (set to false by default)
  • urlpriv - determines whether the URL should be displayed on statistic pages, etc. (set to false by default)

surl.paste(text,options,callback)

Uploads the given text to SmallPaste and fires the callback. The callback is in the format of err,id. Available options are:

  • title - defines the title of the paste
  • private - determines whether the paste should be visible to the public or only people who you provide the URL to (set to true by default)
  • syntax_highlighting - determines whether the paste should be highlighted (set to true by default)

surl-node's People

Contributors

johnhoulder avatar

Watchers

 avatar Ethan Waite avatar Luke Thompson avatar

surl-node's Issues

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.