Code Monkey home page Code Monkey logo

rentry-client's Introduction

Rentry-Client

A javascript library for creating and managing entries in rentry.co

Installation

npm install rentry-client

Usage

Import the library

const RentryClient = require("rentry-client");

Create a new paste

  • return the response in a callback function:
    RentryClient.new({
      id: "<ID>", // optional, skip for random id
      data: "Hello World",
    }, callback);
    
    function callback(res) {
      console.log(res);
    }
  • return the response as an object :
    async function test() {
      var res = await RentryClient.new({
        id: "<ID>", // optional, skip for random id
        data: "Hello World",
      });
      console.log(res);
    }
  • Output
    {
      "status": "200",
      "content": "OK",
      "url": "https://rentry.co/abc123",
      "edit_code": "abxx12xx", // <TOKEN> for editing the paste
      "id": "abc123" // <ID>
    }

Edit an exist paste

  • return the response in a callback function :
    RentryClient.edit({
      id: "<ID>",
      token: "<TOKEN>",
      data: "## Hi\nHello World",
    }, callback);
    
    function callback(res) {
      console.log(res);
    }
  • return the response as an object :
    async function test() {
      var res = await RentryClient.edit({
        id: "<ID>",
        token: "<TOKEN>",
        data: "## Hi\nHello World",
      });
      console.log(res);
    }
  • Output
    {
      "status": "200",
      "content": "OK"
    }

Raw a paste

  • return the response in a callback function :

    RentryClient.raw("<ID>", callback);
    
    function callback(res) {
      console.log(res);
    }
  • return the response as an object :

    async function test() {
      var res = await RentryClient.raw("<ID>");
      console.log(res);
    }
  • Output

    {
      "status": "200",
      "content": "## Hi\nHello World"
    }

License

MIT License

rentry-client's People

Contributors

hima-pro avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

vaginessa

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.