A javascript library for creating and managing entries in rentry.co
npm install rentry-client
Import the library
const RentryClient = require("rentry-client");
- 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> }
- 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" }
-
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" }