Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(pastebin): let AI agents list and delete pastes and read account details (#16711)

Kishan Parmar58946d227399
diff --git a/bun.lock b/bun.lock
index 05c8076ec94..2d9467bb8ce 100644
--- a/bun.lock
+++ b/bun.lock
@@ -6920,7 +6920,7 @@
},
"packages/pieces/community/pastebin": {
"name": "@activepieces/piece-pastebin",
- "version": "0.2.8",
+ "version": "0.3.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/pastebin/package.json b/packages/pieces/community/pastebin/package.json
index 4d47e385a5c..bb14f50c8f5 100644
--- a/packages/pieces/community/pastebin/package.json
+++ b/packages/pieces/community/pastebin/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-pastebin",
- "version": "0.2.8",
+ "version": "0.3.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/pastebin/src/i18n/translation.json b/packages/pieces/community/pastebin/src/i18n/translation.json
index 1681e095393..ad0600554d8 100644
--- a/packages/pieces/community/pastebin/src/i18n/translation.json
+++ b/packages/pieces/community/pastebin/src/i18n/translation.json
@@ -6,8 +6,14 @@
"\nHere are the simple steps to get your credentials:\n\n1. Make an account, If you don't have one yet.\n2. Go to **https://pastebin.com/doc_api**.\n3. Copy your unique Developer API Key and paste it.\n4. Provide your username and password if you want to create **private pastes** under your account.\n": "\nHere are the simple steps to get your credentials:\n\n1. Make an account, If you don't have one yet.\n2. Go to **https://pastebin.com/doc_api**.\n3. Copy your unique Developer API Key and paste it.\n4. Provide your username and password if you want to create **private pastes** under your account.\n",
"Create Paste": "Create Paste",
"Get Paste Content": "Get Paste Content",
+ "List Pastes": "List Pastes",
+ "Delete Paste": "Delete Paste",
+ "Get Account Details": "Get Account Details",
"Creates a new paste": "Creates a new paste",
"Retrieves the content of a paste": "Retrieves the content of a paste",
+ "Lists the account's own pastes, oldest first.": "Lists the account's own pastes, oldest first.",
+ "Permanently deletes one of the account's pastes.": "Permanently deletes one of the account's pastes.",
+ "Gets the connected account's details and paste defaults.": "Gets the connected account's details and paste defaults.",
"Content": "Content",
"Format": "Format",
"Name": "Name",
@@ -15,6 +21,10 @@
"Expiry": "Expiry",
"Folder": "Folder",
"Paste ID": "Paste ID",
+ "Limit": "Limit",
+ "Paste Key": "Paste Key",
+ "How many pastes to return, 1 to 1000. Defaults to 50.": "How many pastes to return, 1 to 1000. Defaults to 50.",
+ "The paste key, from List Pastes or Create Paste.": "The paste key, from List Pastes or Create Paste.",
"4CS4cs": "4CS4cs",
"6502 ACME Cross Asse...": "6502 ACME Cross Asse...",
"6502 Kick Assembler": "6502 Kick Assembler",
diff --git a/packages/pieces/community/pastebin/src/index.ts b/packages/pieces/community/pastebin/src/index.ts
index cb48b12c047..0548090cedb 100644
--- a/packages/pieces/community/pastebin/src/index.ts
+++ b/packages/pieces/community/pastebin/src/index.ts
@@ -1,48 +1,18 @@
-import {
- PieceAuth,
- Property,
- createPiece,
-} from '@activepieces/pieces-framework';
-import { PieceCategory } from '@activepieces/pieces-framework';
-import actions from './lib/actions';
-
-const markdownDescription = `
-Here are the simple steps to get your credentials:
-
-1. Make an account, If you don't have one yet.
-2. Go to **https://pastebin.com/doc_api**.
-3. Copy your unique Developer API Key and paste it.
-4. Provide your username and password if you want to create **private pastes** under your account.
-`;
-
-export const pastebinAuth = PieceAuth.CustomAuth({
- required: true,
- description: markdownDescription,
- props: {
- token: PieceAuth.SecretText({
- displayName: 'Developer Key',
- required: true,
- }),
- username: Property.ShortText({
- displayName: 'Username',
- required: false,
- }),
- password: PieceAuth.SecretText({
- displayName: 'Password',
- required: false,
- }),
- },
-});
+import { createPiece } from '@activepieces/pieces-framework';
+import { pastebinAiActions } from './lib/actions/ai';
+import { createPasteAction } from './lib/actions/create-paste';
+import { getPasteContentAction } from './lib/actions/get-paste-content';
+import { pastebinAuth } from './lib/auth';
export const pastebin = createPiece({
displayName: 'Pastebin',
description: 'Simple and secure text sharing',
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/pastebin.png',
authors: ["JanHolger","kishanprmr","khaledmashaly","abuaboud"],
categories: [],
auth: pastebinAuth,
- actions,
+ actions: [createPasteAction, getPasteContentAction, ...pastebinAiActions],
triggers: [],
});
diff --git a/packages/pieces/community/pastebin/src/lib/actions/ai/delete-paste.ts b/packages/pieces/community/pastebin/src/lib/actions/ai/delete-paste.ts
new file mode 100644
index 00000000000..62e9ae0a60c
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/actions/ai/delete-paste.ts
@@ -0,0 +1,34 @@
+import { Property, createAction } from '@activepieces/pieces-framework';
+
+import { pastebinAuth } from '../../auth';
+import { pastebinApi } from '../../common/api';
+import { pastebinDeletePasteOutputSchema } from '../../output-schemas';
+
+export const pastebinDeletePasteAction = createAction({
+ auth: pastebinAuth,
+ name: 'pastebin_delete_paste',
+ outputSchema: pastebinDeletePasteOutputSchema,
+ displayName: 'Delete Paste',
+ description: "Permanently deletes one of the account's pastes.",
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ "Permanently deletes one of the connected account's own pastes by its paste key; it can't be undone. Get the key from List Pastes or Create Paste. Needs the username and password on the connection.",
+ idempotent: false,
+ },
+ props: {
+ pasteKey: Property.ShortText({
+ displayName: 'Paste Key',
+ description: 'The paste key, from List Pastes or Create Paste.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const message = await pastebinApi.deletePaste({
+ auth: context.auth,
+ pasteKey: context.propsValue.pasteKey,
+ });
+ return { paste_key: context.propsValue.pasteKey, message };
+ },
+});
diff --git a/packages/pieces/community/pastebin/src/lib/actions/ai/get-account-details.ts b/packages/pieces/community/pastebin/src/lib/actions/ai/get-account-details.ts
new file mode 100644
index 00000000000..1cd2387a371
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/actions/ai/get-account-details.ts
@@ -0,0 +1,24 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { pastebinAuth } from '../../auth';
+import { pastebinApi } from '../../common/api';
+import { pastebinGetAccountDetailsOutputSchema } from '../../output-schemas';
+
+export const pastebinGetAccountDetailsAction = createAction({
+ auth: pastebinAuth,
+ name: 'pastebin_get_account_details',
+ outputSchema: pastebinGetAccountDetailsOutputSchema,
+ displayName: 'Get Account Details',
+ description: "Gets the connected account's details and paste defaults.",
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ "Gets the connected Pastebin account's username, email, account type (0 free, 1 PRO) and its default paste format, privacy (0 public, 1 unlisted, 2 private) and expiry. Use it to match Create Paste to the user's own defaults. Needs the username and password on the connection.",
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ return await pastebinApi.getAccountDetails({ auth: context.auth });
+ },
+});
diff --git a/packages/pieces/community/pastebin/src/lib/actions/ai/index.ts b/packages/pieces/community/pastebin/src/lib/actions/ai/index.ts
new file mode 100644
index 00000000000..228f5a680f0
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/actions/ai/index.ts
@@ -0,0 +1,9 @@
+import { pastebinDeletePasteAction } from './delete-paste';
+import { pastebinGetAccountDetailsAction } from './get-account-details';
+import { pastebinListPastesAction } from './list-pastes';
+
+export const pastebinAiActions = [
+ pastebinListPastesAction,
+ pastebinDeletePasteAction,
+ pastebinGetAccountDetailsAction,
+];
diff --git a/packages/pieces/community/pastebin/src/lib/actions/ai/list-pastes.ts b/packages/pieces/community/pastebin/src/lib/actions/ai/list-pastes.ts
new file mode 100644
index 00000000000..4569366a01a
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/actions/ai/list-pastes.ts
@@ -0,0 +1,34 @@
+import { Property, createAction } from '@activepieces/pieces-framework';
+
+import { pastebinAuth } from '../../auth';
+import { pastebinApi } from '../../common/api';
+import { pastebinListPastesOutputSchema } from '../../output-schemas';
+
+export const pastebinListPastesAction = createAction({
+ auth: pastebinAuth,
+ name: 'pastebin_list_pastes',
+ outputSchema: pastebinListPastesOutputSchema,
+ displayName: 'List Pastes',
+ description: "Lists the account's own pastes, oldest first.",
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Lists the connected account's own pastes, oldest first (Pastebin's order, so a limit keeps the oldest ones), with each paste's key, title, URL, format, privacy, expiry, size and hits. Use it to find the paste key that Get Paste Content and Delete Paste take. Needs the username and password on the connection.",
+ idempotent: true,
+ },
+ props: {
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'How many pastes to return, 1 to 1000. Defaults to 50.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const pastes = await pastebinApi.listPastes({
+ auth: context.auth,
+ limit: context.propsValue.limit,
+ });
+ return { pastes, count: pastes.length };
+ },
+});
diff --git a/packages/pieces/community/pastebin/src/lib/actions/create-paste.ts b/packages/pieces/community/pastebin/src/lib/actions/create-paste.ts
index b341db8bcfa..efdb89ef1a5 100644
--- a/packages/pieces/community/pastebin/src/lib/actions/create-paste.ts
+++ b/packages/pieces/community/pastebin/src/lib/actions/create-paste.ts
@@ -1,11 +1,281 @@
import { Property, createAction } from '@activepieces/pieces-framework';
-import { makeClient, pastebinCommon } from '../common';
-import { PasteExpiry, PastePrivacy } from '../common/client';
-import { pastebinAuth } from '../..';
+import { pastebinAuth } from '../auth';
+import { pastebinApi } from '../common/api';
+import { createPasteOutputSchema } from '../output-schemas';
-export default createAction({
+const FORMAT_OPTIONS = [
+ { label: '4CS4cs', value: '4cs' },
+ { label: '6502 ACME Cross Asse...', value: '6502acme' },
+ { label: '6502 Kick Assembler', value: '6502kickass' },
+ { label: '6502 TASM/64TASS', value: '6502tasm' },
+ { label: 'ABAP', value: 'abap' },
+ { label: 'ActionScript', value: 'actionscript' },
+ { label: 'ActionScript 3', value: 'actionscript3' },
+ { label: 'Ada', value: 'ada' },
+ { label: 'AIMMS', value: 'aimms' },
+ { label: 'ALGOL 68', value: 'algol68' },
+ { label: 'Apache Log', value: 'apache' },
+ { label: 'AppleScript', value: 'applescript' },
+ { label: 'APT Sources', value: 'apt_sources' },
+ { label: 'Arduino', value: 'arduino' },
+ { label: 'ARM', value: 'arm' },
+ { label: 'ASM (NASM)', value: 'asm' },
+ { label: 'ASP', value: 'asp' },
+ { label: 'Asymptote', value: 'asymptote' },
+ { label: 'autoconf', value: 'autoconf' },
+ { label: 'Autohotkey', value: 'autohotkey' },
+ { label: 'AutoIt', value: 'autoit' },
+ { label: 'Avisynth', value: 'avisynth' },
+ { label: 'Awk', value: 'awk' },
+ { label: 'BASCOM AVR', value: 'bascomavr' },
+ { label: 'Bash', value: 'bash' },
+ { label: 'Basic4GL', value: 'basic4gl' },
+ { label: 'Batch', value: 'dos' },
+ { label: 'BibTeX', value: 'bibtex' },
+ { label: 'Blitz3D', value: 'b3d' },
+ { label: 'Blitz Basic', value: 'blitzbasic' },
+ { label: 'BlitzMax', value: 'bmx' },
+ { label: 'BNF', value: 'bnf' },
+ { label: 'BOO', value: 'boo' },
+ { label: 'BrainFuck', value: 'bf' },
+ { label: 'C', value: 'c' },
+ { label: 'C#', value: 'csharp' },
+ { label: 'C (WinAPI)', value: 'c_winapi' },
+ { label: 'C++', value: 'cpp' },
+ { label: 'C++ (WinAPI)', value: 'cpp-winapi' },
+ { label: 'C++ (with Qt extensi...', value: 'cpp-qt' },
+ { label: 'C: Loadrunner', value: 'c_loadrunner' },
+ { label: 'CAD DCL', value: 'caddcl' },
+ { label: 'CAD Lisp', value: 'cadlisp' },
+ { label: 'Ceylon', value: 'ceylon' },
+ { label: 'CFDG', value: 'cfdg' },
+ { label: 'C for Macs', value: 'c_mac' },
+ { label: 'ChaiScript', value: 'chaiscript' },
+ { label: 'Chapel', value: 'chapel' },
+ { label: 'C Intermediate Langu...', value: 'cil' },
+ { label: 'Clojure', value: 'clojure' },
+ { label: 'Clone C', value: 'klonec' },
+ { label: 'Clone C++', value: 'klonecpp' },
+ { label: 'CMake', value: 'cmake' },
+ { label: 'COBOL', value: 'cobol' },
+ { label: 'CoffeeScript', value: 'coffeescript' },
+ { label: 'ColdFusion', value: 'cfm' },
+ { label: 'CSS', value: 'css' },
+ { label: 'Cuesheet', value: 'cuesheet' },
+ { label: 'D', value: 'd' },
+ { label: 'Dart', value: 'dart' },
+ { label: 'DCL', value: 'dcl' },
+ { label: 'DCPU-16', value: 'dcpu16' },
+ { label: 'DCS', value: 'dcs' },
+ { label: 'Delphi', value: 'delphi' },
+ { label: 'Delphi Prism (Oxygen...', value: 'oxygene' },
+ { label: 'Diff', value: 'diff' },
+ { label: 'DIV', value: 'div' },
+ { label: 'DOT', value: 'dot' },
+ { label: 'E', value: 'e' },
+ { label: 'Easytrieve', value: 'ezt' },
+ { label: 'ECMAScript', value: 'ecmascript' },
+ { label: 'Eiffel', value: 'eiffel' },
+ { label: 'Email', value: 'email' },
+ { label: 'EPC', value: 'epc' },
+ { label: 'Erlang', value: 'erlang' },
+ { label: 'Euphoria', value: 'euphoria' },
+ { label: 'F#', value: 'fsharp' },
+ { label: 'Falcon', value: 'falcon' },
+ { label: 'Filemaker', value: 'filemaker' },
+ { label: 'FO Language', value: 'fo' },
+ { label: 'Formula One', value: 'f1' },
+ { label: 'Fortran', value: 'fortran' },
+ { label: 'FreeBasic', value: 'freebasic' },
+ { label: 'FreeSWITCH', value: 'freeswitch' },
+ { label: 'GAMBAS', value: 'gambas' },
+ { label: 'Game Maker', value: 'gml' },
+ { label: 'GDB', value: 'gdb' },
+ { label: 'GDScript', value: 'gdscript' },
+ { label: 'Genero', value: 'genero' },
+ { label: 'Genie', value: 'genie' },
+ { label: 'GetText', value: 'gettext' },
+ { label: 'Go', value: 'go' },
+ { label: 'Godot GLSL', value: 'godot-glsl' },
+ { label: 'Groovy', value: 'groovy' },
+ { label: 'GwBasic', value: 'gwbasic' },
+ { label: 'Haskell', value: 'haskell' },
+ { label: 'Haxe', value: 'haxe' },
+ { label: 'HicEst', value: 'hicest' },
+ { label: 'HQ9 Plus', value: 'hq9plus' },
+ { label: 'HTML', value: 'html4strict' },
+ { label: 'HTML 5', value: 'html5' },
+ { label: 'Icon', value: 'icon' },
+ { label: 'IDL', value: 'idl' },
+ { label: 'INI file', value: 'ini' },
+ { label: 'Inno Script', value: 'inno' },
+ { label: 'INTERCAL', value: 'intercal' },
+ { label: 'IO', value: 'io' },
+ { label: 'ISPF Panel Definition...', value: 'ispfpanel' },
+ { label: 'J', value: 'j' },
+ { label: 'Java', value: 'java' },
+ { label: 'Java 5', value: 'java5' },
+ { label: 'JavaScript', value: 'javascript' },
+ { label: 'JCL', value: 'jcl' },
+ { label: 'jQuery', value: 'jquery' },
+ { label: 'JSON', value: 'json' },
+ { label: 'Julia', value: 'julia' },
+ { label: 'KiXtart', value: 'kixtart' },
+ { label: 'Kotlin', value: 'kotlin' },
+ { label: 'KSP (Kontakt Script)', value: 'ksp' },
+ { label: 'Latex', value: 'latex' },
+ { label: 'LDIF', value: 'ldif' },
+ { label: 'Liberty BASIC', value: 'lb' },
+ { label: 'Linden Scripting', value: 'lsl2' },
+ { label: 'Lisp', value: 'lisp' },
+ { label: 'LLVM', value: 'llvm' },
+ { label: 'Loco Basic', value: 'locobasic' },
+ { label: 'Logtalk', value: 'logtalk' },
+ { label: 'LOL Code', value: 'lolcode' },
+ { label: 'Lotus Formulas', value: 'lotusformulas' },
+ { label: 'Lotus Script', value: 'lotusscript' },
+ { label: 'LScript', value: 'lscript' },
+ { label: 'Lua', value: 'lua' },
+ { label: 'M68000 Assembler', value: 'm68k' },
+ { label: 'MagikSF', value: 'magiksf' },
+ { label: 'Make', value: 'make' },
+ { label: 'MapBasic', value: 'mapbasic' },
+ { label: 'Markdown', value: 'markdown' },
+ { label: 'MatLab', value: 'matlab' },
+ { label: 'Mercury', value: 'mercury' },
+ { label: 'MetaPost', value: 'metapost' },
+ { label: 'mIRC', value: 'mirc' },
+ { label: 'MIX Assembler', value: 'mmix' },
+ { label: 'MK-61/52', value: 'mk-61' },
+ { label: 'Modula 2', value: 'modula2' },
+ { label: 'Modula 3', value: 'modula3' },
+ { label: 'Motorola 68000 HiSof...', value: '68000devpac' },
+ { label: 'MPASM', value: 'mpasm' },
+ { label: 'MXML', value: 'mxml' },
+ { label: 'MySQL', value: 'mysql' },
+ { label: 'Nagios', value: 'nagios' },
+ { label: 'NetRexx', value: 'netrexx' },
+ { label: 'newLISP', value: 'newlisp' },
+ { label: 'Nginx', value: 'nginx' },
+ { label: 'Nim', value: 'nim' },
+ { label: 'NullSoft Installer', value: 'nsis' },
+ { label: 'Oberon 2', value: 'oberon2' },
+ { label: 'Objeck Programming L...', value: 'objeck' },
+ { label: 'Objective C', value: 'objc' },
+ { label: 'OCaml', value: 'ocaml' },
+ { label: 'OCaml Brief', value: 'ocaml-brief' },
+ { label: 'Octave', value: 'octave' },
+ { label: 'OpenBSD PACKET FILTE...', value: 'pf' },
+ { label: 'OpenGL Shading', value: 'glsl' },
+ { label: 'Open Object Rexx', value: 'oorexx' },
+ { label: 'Openoffice BASIC', value: 'oobas' },
+ { label: 'Oracle 8', value: 'oracle8' },
+ { label: 'Oracle 11', value: 'oracle11' },
+ { label: 'Oz', value: 'oz' },
+ { label: 'ParaSail', value: 'parasail' },
+ { label: 'PARI/GP', value: 'parigp' },
+ { label: 'Pascal', value: 'pascal' },
+ { label: 'Pawn', value: 'pawn' },
+ { label: 'PCRE', value: 'pcre' },
+ { label: 'Per', value: 'per' },
+ { label: 'Perl', value: 'perl' },
+ { label: 'Perl 6', value: 'perl6' },
+ { label: 'Phix', value: 'phix' },
+ { label: 'PHP', value: 'php' },
+ { label: 'PHP Brief', value: 'php-brief' },
+ { label: 'Pic 16', value: 'pic16' },
+ { label: 'Pike', value: 'pike' },
+ { label: 'Pixel Bender', value: 'pixelbender' },
+ { label: 'PL/I', value: 'pli' },
+ { label: 'PL/SQL', value: 'plsql' },
+ { label: 'PostgreSQL', value: 'postgresql' },
+ { label: 'PostScript', value: 'postscript' },
+ { label: 'POV-Ray', value: 'povray' },
+ { label: 'PowerBuilder', value: 'powerbuilder' },
+ { label: 'PowerShell', value: 'powershell' },
+ { label: 'ProFTPd', value: 'proftpd' },
+ { label: 'Progress', value: 'progress' },
+ { label: 'Prolog', value: 'prolog' },
+ { label: 'Properties', value: 'properties' },
+ { label: 'ProvideX', value: 'providex' },
+ { label: 'Puppet', value: 'puppet' },
+ { label: 'PureBasic', value: 'purebasic' },
+ { label: 'PyCon', value: 'pycon' },
+ { label: 'Python', value: 'python' },
+ { label: 'Python for S60', value: 'pys60' },
+ { label: 'q/kdb+', value: 'q' },
+ { label: 'QBasic', value: 'qbasic' },
+ { label: 'QML', value: 'qml' },
+ { label: 'R', value: 'rsplus' },
+ { label: 'Racket', value: 'racket' },
+ { label: 'Rails', value: 'rails' },
+ { label: 'RBScript', value: 'rbs' },
+ { label: 'REBOL', value: 'rebol' },
+ { label: 'REG', value: 'reg' },
+ { label: 'Rexx', value: 'rexx' },
+ { label: 'Robots', value: 'robots' },
+ { label: 'Roff Manpage', value: 'roff' },
+ { label: 'RPM Spec', value: 'rpmspec' },
+ { label: 'Ruby', value: 'ruby' },
+ { label: 'Ruby Gnuplot', value: 'gnuplot' },
+ { label: 'Rust', value: 'rust' },
+ { label: 'SAS', value: 'sas' },
+ { label: 'Scala', value: 'scala' },
+ { label: 'Scheme', value: 'scheme' },
+ { label: 'Scilab', value: 'scilab' },
+ { label: 'SCL', value: 'scl' },
+ { label: 'SdlBasic', value: 'sdlbasic' },
+ { label: 'Smalltalk', value: 'smalltalk' },
+ { label: 'Smarty', value: 'smarty' },
+ { label: 'SPARK', value: 'spark' },
+ { label: 'SPARQL', value: 'sparql' },
+ { label: 'SQF', value: 'sqf' },
+ { label: 'SQL', value: 'sql' },
+ { label: 'SSH Config', value: 'sshconfig' },
+ { label: 'StandardML', value: 'standardml' },
+ { label: 'StoneScript', value: 'stonescript' },
+ { label: 'SuperCollider', value: 'sclang' },
+ { label: 'Swift', value: 'swift' },
+ { label: 'SystemVerilog', value: 'systemverilog' },
+ { label: 'T-SQL', value: 'tsql' },
+ { label: 'TCL', value: 'tcl' },
+ { label: 'Tera Term', value: 'teraterm' },
+ { label: 'TeXgraph', value: 'texgraph' },
+ { label: 'thinBasic', value: 'thinbasic' },
+ { label: 'TypeScript', value: 'typescript' },
+ { label: 'TypoScript', value: 'typoscript' },
+ { label: 'Unicon', value: 'unicon' },
+ { label: 'UnrealScript', value: 'uscript' },
+ { label: 'UPC', value: 'upc' },
+ { label: 'Urbi', value: 'urbi' },
+ { label: 'Vala', value: 'vala' },
+ { label: 'VB.NET', value: 'vbnet' },
+ { label: 'VBScript', value: 'vbscript' },
+ { label: 'Vedit', value: 'vedit' },
+ { label: 'VeriLog', value: 'verilog' },
+ { label: 'VHDL', value: 'vhdl' },
+ { label: 'VIM', value: 'vim' },
+ { label: 'VisualBasic', value: 'vb' },
+ { label: 'VisualFoxPro', value: 'visualfoxpro' },
+ { label: 'Visual Pro Log', value: 'visualprolog' },
+ { label: 'WhiteSpace', value: 'whitespace' },
+ { label: 'WHOIS', value: 'whois' },
+ { label: 'Winbatch', value: 'winbatch' },
+ { label: 'XBasic', value: 'xbasic' },
+ { label: 'XML', value: 'xml' },
+ { label: 'Xojo', value: 'xojo' },
+ { label: 'Xorg Config', value: 'xorg_conf' },
+ { label: 'XPP', value: 'xpp' },
+ { label: 'YAML', value: 'yaml' },
+ { label: 'YARA', value: 'yara' },
+ { label: 'Z80 Assembler', value: 'z80' },
+ { label: 'ZXBasic', value: 'zxbasic' },
+];
+
+export const createPasteAction = createAction({
auth: pastebinAuth,
name: 'create_paste',
+ outputSchema: createPasteOutputSchema,
classification: 'WRITE',
displayName: 'Create Paste',
description: 'Creates a new paste',
@@ -16,7 +286,13 @@ export default createAction({
displayName: 'Content',
required: true,
}),
- format: pastebinCommon.paste_format(false),
+ format: Property.StaticDropdown({
+ displayName: 'Format',
+ required: false,
+ options: {
+ options: FORMAT_OPTIONS,
+ },
+ }),
name: Property.ShortText({
displayName: 'Name',
required: false,
@@ -26,9 +302,9 @@ export default createAction({
required: false,
options: {
options: [
- { label: 'Public', value: PastePrivacy.PUBLIC },
- { label: 'Unlisted', value: PastePrivacy.UNLISTED },
- { label: 'Private', value: PastePrivacy.PRIVATE },
+ { label: 'Public', value: '0' },
+ { label: 'Unlisted', value: '1' },
+ { label: 'Private', value: '2' },
],
},
}),
@@ -37,15 +313,15 @@ export default createAction({
required: false,
options: {
options: [
- { label: 'Never', value: PasteExpiry.NEVER },
- { label: '10 Minutes', value: PasteExpiry.TEN_MINUTES },
- { label: '1 Hour', value: PasteExpiry.ONE_HOUR },
- { label: '1 Day', value: PasteExpiry.ONE_DAY },
- { label: '1 Week', value: PasteExpiry.ONE_WEEK },
- { label: '2 Weeks', value: PasteExpiry.TWO_WEEKS },
- { label: '1 Month', value: PasteExpiry.ONE_MONTH },
- { label: '6 Months', value: PasteExpiry.SIX_MONTHS },
- { label: '1 Year', value: PasteExpiry.ONE_YEAR },
+ { label: 'Never', value: 'N' },
+ { label: '10 Minutes', value: '10M' },
+ { label: '1 Hour', value: '1H' },
+ { label: '1 Day', value: '1D' },
+ { label: '1 Week', value: '1W' },
+ { label: '2 Weeks', value: '2W' },
+ { label: '1 Month', value: '1M' },
+ { label: '6 Months', value: '6M' },
+ { label: '1 Year', value: '1Y' },
],
},
}),
@@ -55,14 +331,16 @@ export default createAction({
}),
},
async run(context) {
- const client = await makeClient(context.auth);
- const url = await client.createPaste({
- paste_code: context.propsValue.content,
- paste_format: context.propsValue.format,
- paste_name: context.propsValue.name,
- paste_private: context.propsValue.privacy,
- paste_expiry_date: context.propsValue.expiry,
- folder_key: context.propsValue.folder,
+ const url = await pastebinApi.createPaste({
+ auth: context.auth,
+ paste: {
+ paste_code: context.propsValue.content,
+ paste_format: context.propsValue.format,
+ paste_name: context.propsValue.name,
+ paste_private: context.propsValue.privacy,
+ paste_expire_date: context.propsValue.expiry,
+ folder_key: context.propsValue.folder,
+ },
});
const id = url.split('/').reduce((c, v) => v);
return {
diff --git a/packages/pieces/community/pastebin/src/lib/actions/get-paste-content.ts b/packages/pieces/community/pastebin/src/lib/actions/get-paste-content.ts
index 1159d156e9d..045d2d380e3 100644
--- a/packages/pieces/community/pastebin/src/lib/actions/get-paste-content.ts
+++ b/packages/pieces/community/pastebin/src/lib/actions/get-paste-content.ts
@@ -1,10 +1,12 @@
import { Property, createAction } from '@activepieces/pieces-framework';
-import { makeClient, pastebinCommon } from '../common';
-import { pastebinAuth } from '../..';
+import { pastebinAuth } from '../auth';
+import { pastebinApi } from '../common/api';
+import { getPasteContentOutputSchema } from '../output-schemas';
-export default createAction({
+export const getPasteContentAction = createAction({
auth: pastebinAuth,
name: 'get_paste_content',
+ outputSchema: getPasteContentOutputSchema,
classification: 'READ',
displayName: 'Get Paste Content',
description: 'Retrieves the content of a paste',
@@ -17,8 +19,10 @@ export default createAction({
}),
},
async run(context) {
- const client = await makeClient(context.auth);
- const content = await client.getPasteContent(context.propsValue.paste_id);
+ const content = await pastebinApi.getPasteContent({
+ auth: context.auth,
+ pasteKey: context.propsValue.paste_id,
+ });
return {
content,
};
diff --git a/packages/pieces/community/pastebin/src/lib/actions/index.ts b/packages/pieces/community/pastebin/src/lib/actions/index.ts
deleted file mode 100644
index fdc74440ea5..00000000000
--- a/packages/pieces/community/pastebin/src/lib/actions/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import createPaste from './create-paste';
-import getPasteContent from './get-paste-content';
-
-export default [createPaste, getPasteContent];
diff --git a/packages/pieces/community/pastebin/src/lib/auth.ts b/packages/pieces/community/pastebin/src/lib/auth.ts
new file mode 100644
index 00000000000..0397f8d5690
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/auth.ts
@@ -0,0 +1,69 @@
+import {
+ AppConnectionType,
+ PieceAuth,
+ Property,
+ tryCatch,
+} from '@activepieces/pieces-framework';
+
+import { pastebinApi } from './common/api';
+
+import type { PastebinAuthValue } from './common/types';
+
+const markdownDescription = `
+Here are the simple steps to get your credentials:
+
+1. Make an account, If you don't have one yet.
+2. Go to **https://pastebin.com/doc_api**.
+3. Copy your unique Developer API Key and paste it.
+4. Provide your username and password if you want to create **private pastes** under your account.
+`;
+
+export const pastebinAuth = PieceAuth.CustomAuth({
+ required: true,
+ description: markdownDescription,
+ props: {
+ token: PieceAuth.SecretText({
+ displayName: 'Developer Key',
+ required: true,
+ }),
+ username: Property.ShortText({
+ displayName: 'Username',
+ required: false,
+ }),
+ password: PieceAuth.SecretText({
+ displayName: 'Password',
+ required: false,
+ }),
+ },
+ validate: async ({ auth }) => {
+ const connection: PastebinAuthValue = {
+ type: AppConnectionType.CUSTOM_AUTH,
+ props: auth,
+ };
+ if (Boolean(auth.username) !== Boolean(auth.password)) {
+ return {
+ valid: false,
+ error: 'Enter both username and password, or leave both empty.',
+ };
+ }
+ const { data: isValid, error } = await tryCatch(() =>
+ pastebinApi.verifyCredentials({ auth: connection })
+ );
+ if (error) {
+ return {
+ valid: false,
+ error:
+ 'Could not reach Pastebin to check the connection. Please try again.',
+ };
+ }
+ if (isValid) {
+ return { valid: true };
+ }
+ return {
+ valid: false,
+ error: auth.username
+ ? 'Invalid developer key, username or password.'
+ : 'Invalid developer key.',
+ };
+ },
+});
diff --git a/packages/pieces/community/pastebin/src/lib/common/api.ts b/packages/pieces/community/pastebin/src/lib/common/api.ts
new file mode 100644
index 00000000000..b3b3b30722a
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/common/api.ts
@@ -0,0 +1,219 @@
+import { HttpError } from '@activepieces/pieces-common';
+
+import { pastebinClient } from './client';
+
+import type {
+ PastebinAuthValue,
+ PastebinAccount,
+ PastebinCreatePasteRequest,
+ PastebinPaste,
+} from './types';
+
+async function login({
+ auth,
+ username,
+ password,
+}: {
+ auth: PastebinAuthValue;
+ username: string;
+ password: string;
+}): Promise<string> {
+ return await pastebinClient.request({
+ auth,
+ script: 'api_login.php',
+ option: 'login',
+ fields: { user_name: username, user_password: password },
+ });
+}
+
+async function getUserKey({
+ auth,
+}: {
+ auth: PastebinAuthValue;
+}): Promise<string | undefined> {
+ const { username, password } = auth.props;
+ if (username && password) {
+ return await login({ auth, username, password });
+ }
+ return undefined;
+}
+
+async function requireUserKey({
+ auth,
+}: {
+ auth: PastebinAuthValue;
+}): Promise<string> {
+ const userKey = await getUserKey({ auth });
+ if (!userKey) {
+ throw new Error(
+ 'This action works on your own pastes: add your Pastebin username and password to the connection.'
+ );
+ }
+ return userKey;
+}
+
+async function createPaste({
+ auth,
+ paste,
+}: {
+ auth: PastebinAuthValue;
+ paste: PastebinCreatePasteRequest;
+}): Promise<string> {
+ const userKey = await getUserKey({ auth });
+ return await pastebinClient.request({
+ auth,
+ userKey,
+ script: 'api_post.php',
+ option: 'paste',
+ fields: paste,
+ });
+}
+
+async function getPasteContent({
+ auth,
+ pasteKey,
+}: {
+ auth: PastebinAuthValue;
+ pasteKey: string;
+}): Promise<string> {
+ const userKey = await getUserKey({ auth });
+ if (userKey) {
+ return await pastebinClient.request({
+ auth,
+ userKey,
+ script: 'api_raw.php',
+ option: 'show_paste',
+ fields: { paste_key: pasteKey },
+ });
+ }
+ return await pastebinClient.getText({ path: `/raw/${pasteKey}` });
+}
+
+async function verifyCredentials({
+ auth,
+}: {
+ auth: PastebinAuthValue;
+}): Promise<boolean> {
+ const { username, password } = auth.props;
+ try {
+ if (username && password) {
+ await login({ auth, username, password });
+ return true;
+ }
+ await pastebinClient.request({
+ auth,
+ script: 'api_post.php',
+ option: 'userdetails',
+ fields: {},
+ });
+ return true;
+ } catch (error) {
+ if (
+ error instanceof HttpError &&
+ REJECTED_STATUSES.includes(error.response.status)
+ ) {
+ if (username && password) {
+ return false;
+ }
+ return !JSON.stringify(error.response.body).includes(
+ 'invalid api_dev_key'
+ );
+ }
+ throw error;
+ }
+}
+
+async function listPastes({
+ auth,
+ limit,
+}: {
+ auth: PastebinAuthValue;
+ limit?: number;
+}): Promise<PastebinPaste[]> {
+ const userKey = await requireUserKey({ auth });
+ const xml = await pastebinClient.request({
+ auth,
+ userKey,
+ script: 'api_post.php',
+ option: 'list',
+ fields: {
+ results_limit: limit === undefined ? undefined : String(limit),
+ },
+ });
+ return parseElements({ xml, tag: 'paste' });
+}
+
+async function deletePaste({
+ auth,
+ pasteKey,
+}: {
+ auth: PastebinAuthValue;
+ pasteKey: string;
+}): Promise<string> {
+ const userKey = await requireUserKey({ auth });
+ return await pastebinClient.request({
+ auth,
+ userKey,
+ script: 'api_post.php',
+ option: 'delete',
+ fields: { paste_key: pasteKey },
+ });
+}
+
+async function getAccountDetails({
+ auth,
+}: {
+ auth: PastebinAuthValue;
+}): Promise<PastebinAccount> {
+ const userKey = await requireUserKey({ auth });
+ const xml = await pastebinClient.request({
+ auth,
+ userKey,
+ script: 'api_post.php',
+ option: 'userdetails',
+ fields: {},
+ });
+ const [account] = parseElements({ xml, tag: 'user' });
+ if (!account) {
+ throw new Error(`Unexpected response from Pastebin: ${xml}`);
+ }
+ return account;
+}
+
+function parseElements({
+ xml,
+ tag,
+}: {
+ xml: string;
+ tag: string;
+}): Record<string, string>[] {
+ const pattern = new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`, 'g');
+ return [...xml.matchAll(pattern)].map((match) =>
+ Object.fromEntries(
+ [...match[1].matchAll(/<(\w+)>([\s\S]*?)<\/\1>/g)].map(
+ ([, key, value]) => [key, decodeEntities({ text: value })]
+ )
+ )
+ );
+}
+
+function decodeEntities({ text }: { text: string }): string {
+ return text
+ .replace(/&lt;/g, '<')
+ .replace(/&gt;/g, '>')
+ .replace(/&quot;/g, '"')
+ .replace(/&#0?39;/g, "'")
+ .replace(/&amp;/g, '&');
+}
+
+export const pastebinApi = {
+ getUserKey,
+ createPaste,
+ getPasteContent,
+ verifyCredentials,
+ listPastes,
+ deletePaste,
+ getAccountDetails,
+};
+
+const REJECTED_STATUSES = [401, 422];
diff --git a/packages/pieces/community/pastebin/src/lib/common/client.ts b/packages/pieces/community/pastebin/src/lib/common/client.ts
index 0ac9c953ec0..982f25540a6 100644
--- a/packages/pieces/community/pastebin/src/lib/common/client.ts
+++ b/packages/pieces/community/pastebin/src/lib/common/client.ts
@@ -1,92 +1,59 @@
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { HttpMethod, httpClient } from '@activepieces/pieces-common';
-export enum PastePrivacy {
- PUBLIC = '0',
- UNLISTED = '1',
- PRIVATE = '2',
-}
-
-export enum PasteExpiry {
- NEVER = 'N',
- TEN_MINUTES = '10M',
- ONE_HOUR = '1H',
- ONE_DAY = '1D',
- ONE_WEEK = '1W',
- TWO_WEEKS = '2W',
- ONE_MONTH = '1M',
- SIX_MONTHS = '6M',
- ONE_YEAR = '1Y',
-}
+import type { PastebinAuthValue } from './types';
-export interface PasteCreateRequest {
- paste_code: string;
- paste_private?: PastePrivacy;
- paste_name?: string;
- paste_expiry_date?: string;
- paste_format?: string;
- folder_key?: string;
+function baseUrl(): string {
+ return BASE_URL;
}
-export class PastebinClient {
- private user_key?: string;
-
- constructor(private token: string) {}
-
- setUserKey(user_key: string) {
- this.user_key = user_key;
+async function request({
+ auth,
+ userKey,
+ script,
+ option,
+ fields,
+}: RequestParams & { auth: PastebinAuthValue }): Promise<string> {
+ const body = new URLSearchParams({
+ api_option: option,
+ api_dev_key: auth.props.token,
+ });
+ if (userKey) {
+ body.append('api_user_key', userKey);
}
-
- async makeRequest(
- script: string,
- option: string,
- body: Record<string, any>
- ): Promise<string> {
- const req = new URLSearchParams({
- api_option: option,
- api_dev_key: this.token,
- });
- if (this.user_key) {
- req.append('api_user_key', this.user_key);
+ for (const [key, value] of Object.entries(fields)) {
+ if (value !== undefined && value !== null) {
+ body.append('api_' + key, value);
}
- Object.keys(body)
- .filter((k) => body[k] !== undefined && body[k] !== null)
- .forEach((k) => req.append('api_' + k, body[k]));
- const res = await httpClient.sendRequest<string>({
- method: HttpMethod.POST,
- url: 'https://pastebin.com/api/' + script,
- headers: {
- 'content-type': 'application/x-www-form-urlencoded',
- },
- body: req,
- responseType: 'text',
- });
- return res.body;
}
+ const response = await httpClient.sendRequest<string>({
+ method: HttpMethod.POST,
+ url: `${BASE_URL}/api/${script}`,
+ headers: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ Accept: '*/*',
+ },
+ body,
+ responseType: 'text',
+ });
+ return response.body;
+}
- async login(username: string, password: string): Promise<string> {
- return await this.makeRequest('api_login.php', 'login', {
- user_name: username,
- user_password: password,
- });
- }
+async function getText({ path }: { path: string }): Promise<string> {
+ const response = await httpClient.sendRequest<string>({
+ method: HttpMethod.GET,
+ url: `${BASE_URL}${path}`,
+ responseType: 'text',
+ });
+ return response.body;
+}
- async createPaste(request: PasteCreateRequest): Promise<string> {
- return await this.makeRequest('api_post.php', 'paste', request);
- }
+export const pastebinClient = { baseUrl, request, getText };
- async getPasteContent(id: string): Promise<string> {
- if (this.user_key) {
- return await this.makeRequest('api_raw.php', 'show_paste', {
- paste_key: id,
- });
- } else {
- return (
- await httpClient.sendRequest<string>({
- method: HttpMethod.GET,
- url: 'https://pastebin.com/raw/' + id,
- responseType: 'text',
- })
- ).body;
- }
- }
-}
+const BASE_URL = 'https://pastebin.com';
+
+type RequestParams = {
+ userKey?: string;
+ script: string;
+ option: string;
+ fields: Record<string, string | undefined>;
+};
diff --git a/packages/pieces/community/pastebin/src/lib/common/index.ts b/packages/pieces/community/pastebin/src/lib/common/index.ts
deleted file mode 100644
index f09023b8060..00000000000
--- a/packages/pieces/community/pastebin/src/lib/common/index.ts
+++ /dev/null
@@ -1,292 +0,0 @@
-import { AppConnectionValueForAuthProperty, PiecePropValueSchema, Property } from '@activepieces/pieces-framework';
-import { PastebinClient } from './client';
-import { pastebinAuth } from '../..';
-
-export const pastebinCommon = {
- paste_format: (required = true) =>
- Property.StaticDropdown({
- displayName: 'Format',
- required,
- options: {
- options: [
- { label: '4CS4cs', value: '4cs' },
- { label: '6502 ACME Cross Asse...', value: '6502acme' },
- { label: '6502 Kick Assembler', value: '6502kickass' },
- { label: '6502 TASM/64TASS', value: '6502tasm' },
- { label: 'ABAP', value: 'abap' },
- { label: 'ActionScript', value: 'actionscript' },
- { label: 'ActionScript 3', value: 'actionscript3' },
- { label: 'Ada', value: 'ada' },
- { label: 'AIMMS', value: 'aimms' },
- { label: 'ALGOL 68', value: 'algol68' },
- { label: 'Apache Log', value: 'apache' },
- { label: 'AppleScript', value: 'applescript' },
- { label: 'APT Sources', value: 'apt_sources' },
- { label: 'Arduino', value: 'arduino' },
- { label: 'ARM', value: 'arm' },
- { label: 'ASM (NASM)', value: 'asm' },
- { label: 'ASP', value: 'asp' },
- { label: 'Asymptote', value: 'asymptote' },
- { label: 'autoconf', value: 'autoconf' },
- { label: 'Autohotkey', value: 'autohotkey' },
- { label: 'AutoIt', value: 'autoit' },
- { label: 'Avisynth', value: 'avisynth' },
- { label: 'Awk', value: 'awk' },
- { label: 'BASCOM AVR', value: 'bascomavr' },
- { label: 'Bash', value: 'bash' },
- { label: 'Basic4GL', value: 'basic4gl' },
- { label: 'Batch', value: 'dos' },
- { label: 'BibTeX', value: 'bibtex' },
- { label: 'Blitz3D', value: 'b3d' },
- { label: 'Blitz Basic', value: 'blitzbasic' },
- { label: 'BlitzMax', value: 'bmx' },
- { label: 'BNF', value: 'bnf' },
- { label: 'BOO', value: 'boo' },
- { label: 'BrainFuck', value: 'bf' },
- { label: 'C', value: 'c' },
- { label: 'C#', value: 'csharp' },
- { label: 'C (WinAPI)', value: 'c_winapi' },
- { label: 'C++', value: 'cpp' },
- { label: 'C++ (WinAPI)', value: 'cpp-winapi' },
- { label: 'C++ (with Qt extensi...', value: 'cpp-qt' },
- { label: 'C: Loadrunner', value: 'c_loadrunner' },
- { label: 'CAD DCL', value: 'caddcl' },
- { label: 'CAD Lisp', value: 'cadlisp' },
- { label: 'Ceylon', value: 'ceylon' },
- { label: 'CFDG', value: 'cfdg' },
- { label: 'C for Macs', value: 'c_mac' },
- { label: 'ChaiScript', value: 'chaiscript' },
- { label: 'Chapel', value: 'chapel' },
- { label: 'C Intermediate Langu...', value: 'cil' },
- { label: 'Clojure', value: 'clojure' },
- { label: 'Clone C', value: 'klonec' },
- { label: 'Clone C++', value: 'klonecpp' },
- { label: 'CMake', value: 'cmake' },
- { label: 'COBOL', value: 'cobol' },
- { label: 'CoffeeScript', value: 'coffeescript' },
- { label: 'ColdFusion', value: 'cfm' },
- { label: 'CSS', value: 'css' },
- { label: 'Cuesheet', value: 'cuesheet' },
- { label: 'D', value: 'd' },
- { label: 'Dart', value: 'dart' },
- { label: 'DCL', value: 'dcl' },
- { label: 'DCPU-16', value: 'dcpu16' },
- { label: 'DCS', value: 'dcs' },
- { label: 'Delphi', value: 'delphi' },
- { label: 'Delphi Prism (Oxygen...', value: 'oxygene' },
- { label: 'Diff', value: 'diff' },
- { label: 'DIV', value: 'div' },
- { label: 'DOT', value: 'dot' },
- { label: 'E', value: 'e' },
- { label: 'Easytrieve', value: 'ezt' },
- { label: 'ECMAScript', value: 'ecmascript' },
- { label: 'Eiffel', value: 'eiffel' },
- { label: 'Email', value: 'email' },
- { label: 'EPC', value: 'epc' },
- { label: 'Erlang', value: 'erlang' },
- { label: 'Euphoria', value: 'euphoria' },
- { label: 'F#', value: 'fsharp' },
- { label: 'Falcon', value: 'falcon' },
- { label: 'Filemaker', value: 'filemaker' },
- { label: 'FO Language', value: 'fo' },
- { label: 'Formula One', value: 'f1' },
- { label: 'Fortran', value: 'fortran' },
- { label: 'FreeBasic', value: 'freebasic' },
- { label: 'FreeSWITCH', value: 'freeswitch' },
- { label: 'GAMBAS', value: 'gambas' },
- { label: 'Game Maker', value: 'gml' },
- { label: 'GDB', value: 'gdb' },
- { label: 'GDScript', value: 'gdscript' },
- { label: 'Genero', value: 'genero' },
- { label: 'Genie', value: 'genie' },
- { label: 'GetText', value: 'gettext' },
- { label: 'Go', value: 'go' },
- { label: 'Godot GLSL', value: 'godot-glsl' },
- { label: 'Groovy', value: 'groovy' },
- { label: 'GwBasic', value: 'gwbasic' },
- { label: 'Haskell', value: 'haskell' },
- { label: 'Haxe', value: 'haxe' },
- { label: 'HicEst', value: 'hicest' },
- { label: 'HQ9 Plus', value: 'hq9plus' },
- { label: 'HTML', value: 'html4strict' },
- { label: 'HTML 5', value: 'html5' },
- { label: 'Icon', value: 'icon' },
- { label: 'IDL', value: 'idl' },
- { label: 'INI file', value: 'ini' },
- { label: 'Inno Script', value: 'inno' },
- { label: 'INTERCAL', value: 'intercal' },
- { label: 'IO', value: 'io' },
- { label: 'ISPF Panel Definition...', value: 'ispfpanel' },
- { label: 'J', value: 'j' },
- { label: 'Java', value: 'java' },
- { label: 'Java 5', value: 'java5' },
- { label: 'JavaScript', value: 'javascript' },
- { label: 'JCL', value: 'jcl' },
- { label: 'jQuery', value: 'jquery' },
- { label: 'JSON', value: 'json' },
- { label: 'Julia', value: 'julia' },
- { label: 'KiXtart', value: 'kixtart' },
- { label: 'Kotlin', value: 'kotlin' },
- { label: 'KSP (Kontakt Script)', value: 'ksp' },
- { label: 'Latex', value: 'latex' },
- { label: 'LDIF', value: 'ldif' },
- { label: 'Liberty BASIC', value: 'lb' },
- { label: 'Linden Scripting', value: 'lsl2' },
- { label: 'Lisp', value: 'lisp' },
- { label: 'LLVM', value: 'llvm' },
- { label: 'Loco Basic', value: 'locobasic' },
- { label: 'Logtalk', value: 'logtalk' },
- { label: 'LOL Code', value: 'lolcode' },
- { label: 'Lotus Formulas', value: 'lotusformulas' },
- { label: 'Lotus Script', value: 'lotusscript' },
- { label: 'LScript', value: 'lscript' },
- { label: 'Lua', value: 'lua' },
- { label: 'M68000 Assembler', value: 'm68k' },
- { label: 'MagikSF', value: 'magiksf' },
- { label: 'Make', value: 'make' },
- { label: 'MapBasic', value: 'mapbasic' },
- { label: 'Markdown', value: 'markdown' },
- { label: 'MatLab', value: 'matlab' },
- { label: 'Mercury', value: 'mercury' },
- { label: 'MetaPost', value: 'metapost' },
- { label: 'mIRC', value: 'mirc' },
- { label: 'MIX Assembler', value: 'mmix' },
- { label: 'MK-61/52', value: 'mk-61' },
- { label: 'Modula 2', value: 'modula2' },
- { label: 'Modula 3', value: 'modula3' },
- { label: 'Motorola 68000 HiSof...', value: '68000devpac' },
- { label: 'MPASM', value: 'mpasm' },
- { label: 'MXML', value: 'mxml' },
- { label: 'MySQL', value: 'mysql' },
- { label: 'Nagios', value: 'nagios' },
- { label: 'NetRexx', value: 'netrexx' },
- { label: 'newLISP', value: 'newlisp' },
- { label: 'Nginx', value: 'nginx' },
- { label: 'Nim', value: 'nim' },
- { label: 'NullSoft Installer', value: 'nsis' },
- { label: 'Oberon 2', value: 'oberon2' },
- { label: 'Objeck Programming L...', value: 'objeck' },
- { label: 'Objective C', value: 'objc' },
- { label: 'OCaml', value: 'ocaml' },
- { label: 'OCaml Brief', value: 'ocaml-brief' },
- { label: 'Octave', value: 'octave' },
- { label: 'OpenBSD PACKET FILTE...', value: 'pf' },
- { label: 'OpenGL Shading', value: 'glsl' },
- { label: 'Open Object Rexx', value: 'oorexx' },
- { label: 'Openoffice BASIC', value: 'oobas' },
- { label: 'Oracle 8', value: 'oracle8' },
- { label: 'Oracle 11', value: 'oracle11' },
- { label: 'Oz', value: 'oz' },
- { label: 'ParaSail', value: 'parasail' },
- { label: 'PARI/GP', value: 'parigp' },
- { label: 'Pascal', value: 'pascal' },
- { label: 'Pawn', value: 'pawn' },
- { label: 'PCRE', value: 'pcre' },
- { label: 'Per', value: 'per' },
- { label: 'Perl', value: 'perl' },
- { label: 'Perl 6', value: 'perl6' },
- { label: 'Phix', value: 'phix' },
- { label: 'PHP', value: 'php' },
- { label: 'PHP Brief', value: 'php-brief' },
- { label: 'Pic 16', value: 'pic16' },
- { label: 'Pike', value: 'pike' },
- { label: 'Pixel Bender', value: 'pixelbender' },
- { label: 'PL/I', value: 'pli' },
- { label: 'PL/SQL', value: 'plsql' },
- { label: 'PostgreSQL', value: 'postgresql' },
- { label: 'PostScript', value: 'postscript' },
- { label: 'POV-Ray', value: 'povray' },
- { label: 'PowerBuilder', value: 'powerbuilder' },
- { label: 'PowerShell', value: 'powershell' },
- { label: 'ProFTPd', value: 'proftpd' },
- { label: 'Progress', value: 'progress' },
- { label: 'Prolog', value: 'prolog' },
- { label: 'Properties', value: 'properties' },
- { label: 'ProvideX', value: 'providex' },
- { label: 'Puppet', value: 'puppet' },
- { label: 'PureBasic', value: 'purebasic' },
- { label: 'PyCon', value: 'pycon' },
- { label: 'Python', value: 'python' },
- { label: 'Python for S60', value: 'pys60' },
- { label: 'q/kdb+', value: 'q' },
- { label: 'QBasic', value: 'qbasic' },
- { label: 'QML', value: 'qml' },
- { label: 'R', value: 'rsplus' },
- { label: 'Racket', value: 'racket' },
- { label: 'Rails', value: 'rails' },
- { label: 'RBScript', value: 'rbs' },
- { label: 'REBOL', value: 'rebol' },
- { label: 'REG', value: 'reg' },
- { label: 'Rexx', value: 'rexx' },
- { label: 'Robots', value: 'robots' },
- { label: 'Roff Manpage', value: 'roff' },
- { label: 'RPM Spec', value: 'rpmspec' },
- { label: 'Ruby', value: 'ruby' },
- { label: 'Ruby Gnuplot', value: 'gnuplot' },
- { label: 'Rust', value: 'rust' },
- { label: 'SAS', value: 'sas' },
- { label: 'Scala', value: 'scala' },
- { label: 'Scheme', value: 'scheme' },
- { label: 'Scilab', value: 'scilab' },
- { label: 'SCL', value: 'scl' },
- { label: 'SdlBasic', value: 'sdlbasic' },
- { label: 'Smalltalk', value: 'smalltalk' },
- { label: 'Smarty', value: 'smarty' },
- { label: 'SPARK', value: 'spark' },
- { label: 'SPARQL', value: 'sparql' },
- { label: 'SQF', value: 'sqf' },
- { label: 'SQL', value: 'sql' },
- { label: 'SSH Config', value: 'sshconfig' },
- { label: 'StandardML', value: 'standardml' },
- { label: 'StoneScript', value: 'stonescript' },
- { label: 'SuperCollider', value: 'sclang' },
- { label: 'Swift', value: 'swift' },
- { label: 'SystemVerilog', value: 'systemverilog' },
- { label: 'T-SQL', value: 'tsql' },
- { label: 'TCL', value: 'tcl' },
- { label: 'Tera Term', value: 'teraterm' },
- { label: 'TeXgraph', value: 'texgraph' },
- { label: 'thinBasic', value: 'thinbasic' },
- { label: 'TypeScript', value: 'typescript' },
- { label: 'TypoScript', value: 'typoscript' },
- { label: 'Unicon', value: 'unicon' },
- { label: 'UnrealScript', value: 'uscript' },
- { label: 'UPC', value: 'upc' },
- { label: 'Urbi', value: 'urbi' },
- { label: 'Vala', value: 'vala' },
- { label: 'VB.NET', value: 'vbnet' },
- { label: 'VBScript', value: 'vbscript' },
- { label: 'Vedit', value: 'vedit' },
- { label: 'VeriLog', value: 'verilog' },
- { label: 'VHDL', value: 'vhdl' },
- { label: 'VIM', value: 'vim' },
- { label: 'VisualBasic', value: 'vb' },
- { label: 'VisualFoxPro', value: 'visualfoxpro' },
- { label: 'Visual Pro Log', value: 'visualprolog' },
- { label: 'WhiteSpace', value: 'whitespace' },
- { label: 'WHOIS', value: 'whois' },
- { label: 'Winbatch', value: 'winbatch' },
- { label: 'XBasic', value: 'xbasic' },
- { label: 'XML', value: 'xml' },
- { label: 'Xojo', value: 'xojo' },
- { label: 'Xorg Config', value: 'xorg_conf' },
- { label: 'XPP', value: 'xpp' },
- { label: 'YAML', value: 'yaml' },
- { label: 'YARA', value: 'yara' },
- { label: 'Z80 Assembler', value: 'z80' },
- { label: 'ZXBasic', value: 'zxbasic' },
- ],
- },
- }),
-};
-
-export async function makeClient(
- auth: AppConnectionValueForAuthProperty<typeof pastebinAuth>
-): Promise<PastebinClient> {
- const client = new PastebinClient(auth.props.token);
- if (auth.props.username && auth.props.password) {
- const userKey = await client.login(auth.props.username, auth.props.password);
- client.setUserKey(userKey);
- }
- return client;
-}
diff --git a/packages/pieces/community/pastebin/src/lib/common/types.ts b/packages/pieces/community/pastebin/src/lib/common/types.ts
new file mode 100644
index 00000000000..67364ab1e90
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/common/types.ts
@@ -0,0 +1,19 @@
+import type { AppConnectionType } from '@activepieces/pieces-framework';
+
+export type PastebinAuthValue = {
+ type: AppConnectionType.CUSTOM_AUTH;
+ props: { token: string; username?: string; password?: string };
+};
+
+export type PastebinCreatePasteRequest = {
+ paste_code: string;
+ paste_private?: string;
+ paste_name?: string;
+ paste_expire_date?: string;
+ paste_format?: string;
+ folder_key?: string;
+};
+
+export type PastebinPaste = Record<string, string>;
+
+export type PastebinAccount = Record<string, string>;
diff --git a/packages/pieces/community/pastebin/src/lib/output-schemas.ts b/packages/pieces/community/pastebin/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..65599420c99
--- /dev/null
+++ b/packages/pieces/community/pastebin/src/lib/output-schemas.ts
@@ -0,0 +1,65 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+export const pastebinGetAccountDetailsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'user_name', label: 'Username' },
+ { key: 'user_email', label: 'Email', format: 'email' },
+ { key: 'user_account_type', label: 'Account Type (0 Free, 1 PRO)' },
+ { key: 'user_format_short', label: 'Default Format' },
+ { key: 'user_expiration', label: 'Default Expiry' },
+ {
+ key: 'user_private',
+ label: 'Default Privacy (0 Public, 1 Unlisted, 2 Private)',
+ },
+ { key: 'user_avatar_url', label: 'Avatar URL', format: 'url' },
+ { key: 'user_website', label: 'Website' },
+ { key: 'user_location', label: 'Location' },
+ ],
+};
+
+export const createPasteOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Paste Key' },
+ { key: 'url', label: 'Paste URL', format: 'url' },
+ ],
+};
+
+export const pastebinDeletePasteOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'paste_key', label: 'Paste Key' },
+ { key: 'message', label: 'Message' },
+ ],
+};
+
+export const getPasteContentOutputSchema: OutputSchema = {
+ fields: [{ key: 'content', label: 'Content' }],
+};
+
+export const pastebinListPastesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'pastes',
+ label: 'Pastes',
+ labelKey: 'paste_title',
+ listItems: [
+ { key: 'paste_key', label: 'Paste Key' },
+ { key: 'paste_title', label: 'Title' },
+ { key: 'paste_url', label: 'URL', format: 'url' },
+ { key: 'paste_date', label: 'Created At (Unix Seconds)' },
+ {
+ key: 'paste_expire_date',
+ label: 'Expires At (Unix Seconds, 0 Never)',
+ },
+ {
+ key: 'paste_private',
+ label: 'Privacy (0 Public, 1 Unlisted, 2 Private)',
+ },
+ { key: 'paste_format_short', label: 'Format' },
+ { key: 'paste_format_long', label: 'Format Name' },
+ { key: 'paste_size', label: 'Size (Bytes)' },
+ { key: 'paste_hits', label: 'Hits' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};