Giter VIP home page Giter VIP logo

pastefy-api's Introduction

pastefy

pastefy is an API-Wrapper for Pastefy.app.

image

Install the package📥

npm install pastefy

Functions📚

Pastes📄

Create 📝

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.paste.create("Title", "Content", options);
console.log(result);
Output
{
  success: true,
  paste: {
    exists: true,
    id: 'iXUlzofQ',
    content: 'Pastefy',
    title: 'Test',
    encrypted: false,
    visibility: 'UNLISTED',
    raw_url: 'https://pastefy.app/iXUlzofQ/raw',
    type: 'PASTE',
    created_at: '2023-07-04 18:16:19.35'
  }
}

Get 🔎

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.paste.get("iXUlzofQ");
console.log(result);
Output
{
  exists: true,
  id: 'iXUlzofQ',
  content: 'Pastefy',
  title: 'Test',
  encrypted: false,
  visibility: 'UNLISTED',
  raw_url: 'https://pastefy.app/iXUlzofQ/raw',
  type: 'PASTE',
  created_at: '2023-07-04 18:16:19.0'
}

Edit ✏️

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.paste.edit("iXUlzofQ", "New Content", options);
console.log(result);

Output

{ success: true }

Delete 🗑️

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.paste.delete("iXUlzofQ");
console.log(result);

Output

{ success: true }

Folders📁

Create 📝

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.folder.create("Title");
console.log(result);

Output

{
  success: true,
  folder: {
    exists: true,
    id: 'sr7Wcntu',
    name: 'Test',
    user_id: 'KSdtLPTK',
    children: [],
    pastes: [],
    created: '2023-07-04 18:34:53.722'
  }
}

Get 🔎

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.folder.get("sr7Wcntu");
console.log(result);

Output

{
  exists: true,
  id: 'sr7Wcntu',
  name: 'Test',
  user_id: 'KSdtLPTK',
  children: [],
  pastes: [
    {
      exists: true,
      id: 'TEiOgP7k',
      content: 'console.log("Hello World");',
      title: 'Test Paste',
      encrypted: false,
      folder: 'sr7Wcntu',
      user_id: 'KSdtLPTK',
      visibility: 'UNLISTED',
      raw_url: 'https://pastefy.app/TEiOgP7k/raw',
      type: 'PASTE',
      created_at: '2023-07-04 18:35:58.0'
    }
  ],
  created: '2023-07-04 18:34:53.0'
}

Edit ✏️

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.folder.edit("sr7Wcntu", "New Title");
console.log(result);

Output

{ success: true }

Delete 🗑️

import Pastefy from "pastefy";
const pastefy = new Pastefy("API_KEY");

const result = await pastefy.folder.delete("sr7Wcntu");
console.log(result);

Output

{ success: true }

pastefy-api's People

Contributors

dxkyy avatar

Stargazers

 avatar

Watchers

 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.