Pastery Taio Action

Updated 10292022-064142


Social

Another simple API action for @TaioApp... This time, for *the greatest pastebin in the world*. https://t.co/N0BGTt8p8L pic.twitter.com/lawmfTWALo

— 𝗗 𝗔 𝗩 𝗢 𝗗 (@NeoYokel) October 12, 2022

Another simple API action for @TaioApp... This time, for the greatest pastebin in the world. https://davidblue.wtf/taio/pastery


Pastery Taio Action

Submission

Description

Create a Pastery paste via API with the current document's contents. The result's URL will be passed to the system clipboard.

You'll need to change the value of the apikey variable to your own Pastery API key.

See Pastery's API documentation: https://www.pastery.net/api

Directory Description

Create a Pastery paste via API with the current document's contents. At run, you'll be prompted to set the duration parameter of the call in minutes. The default value (10512000) equates to 20 years. You'll also be prompted to select a syntax highlighting language from Pastery's official supported list. The result's URL will be passed to the system clipboard.

Please note: Before running this action, you'll need to change the value of the apikey variable to your own Pastery API key.

See Pastery's API documentation

Video Demo

JSON

{
  "actions" : [
    {
      "type" : "@ui.text-input",
      "parameters" : {
        "prompt" : {
          "value" : "Set a lifespan for the output paste in minutes. (Default value is 20 years.)"
        },
        "keyboardType" : 2,
        "initialText" : {
          "value" : "10512000"
        },
        "singleLineText" : true
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@input"
            }
          ]
        },
        "name" : {
          "value" : "life"
        }
      }
    },
    {
      "type" : "@ui.menu",
      "parameters" : {
        "prompt" : {
          "value" : "Select a language."
        },
        "selectAllByDefault" : false,
        "multiValue" : false,
        "lines" : {
          "value" : "autodetect\nbash\nc\ncpp\ncsharp\ncss\nhtml\njava\njs\njson\nlua\nmarkdown\nobjective-c\nperl\nphp\npython\nswift\ntext\nautodetect\nabap\nada\nagda\nahk\nalloy\nantlr\nantlr-as\nantlr-cpp\nantlr-csharp\nantlr-java\nantlr-objc\nantlr-perl\nantlr-python\nantlr-ruby\napacheconf\napl\napplescript\nas\nas3\naspectj\naspx-cs\naspx-vb\nasy\nat\nautoit\nawk\nbasemake\nbat\nbbcode\nbefunge\nblitzbasic\nblitzmax\nboo\nbrainfuck\nbro\nbugs\nc-objdump\nca65\ncbmbas\nceylon\ncfc\ncfengine3\ncfm\ncfs\nchai\nchapel\ncheetah\ncirru\nclay\nclojure\nclojurescript\ncmake\ncobol\ncobolfree\ncoffee-script\ncommon-lisp\nconsole\ncontrol\ncoq\ncpp-objdump\ncroc\ncryptol\ncss+django\ncss+erb\ncss+genshitext\ncss+lasso\ncss+mako\ncss+mozpreproc\ncss+myghty\ncss+php\ncss+smarty\ncucumber\ncuda\ncypher\ncython\nd\nd-objdump\ndart\ndelphi\ndg\ndiff\ndjango\ndocker\ndpatch\ndtd\nduel\ndylan\ndylan-console\ndylan-lid\nebnf\nec\necl\neiffel\nelixir\nerb\nerl\nerlang\nevoque\nfactor\nfan\nfancy\nfelix\nfortran\nfoxpro\nfsharp\ngap\ngas\ngenshi\ngenshitext\nglsl\ngnuplot\ngo\ngolo\ngooddata-cl\ngosu\ngroff\ngroovy\ngst\nhaml\nhandlebars\nhaskell\nhaxeml\nhtml+cheetah\nhtml+django\nhtml+evoque\nhtml+genshi\nhtml+handlebars\nhtml+lasso\nhtml+mako\nhtml+myghty\nhtml+php\nhtml+smarty\nhtml+twig\nhtml+velocity\nhttp\nhx\nhybris\nhylang\ni6t\nidl\nidris\niex\nigor\ninform6\ninform7\nini\nio\nioke\nipython2\nipython3\nipythonconsole\nirc\nisabelle\njade\njags\njasmin\njavascript+mozpreproc\njlcon\njs+cheetah\njs+django\njs+erb\njs+genshitext\njs+lasso\njs+mako\njs+myghty\njs+php\njs+smarty\njsonld\njsp\njulia\nkal\nkconfig\nkoka\nkotlin\nlagda\nlasso\nlcry\nlean\nlhs\nlidr\nlighty\nlimbo\nliquid\nlive-script\nllvm\nlogos\nlogtalk\nlsl\nmake\nmako\nmaql\nmask\nmason\nmathematica\nmatlab\nmatlabsession\nminid\nmodelica\nmodula2\nmonkey\nmoocode\nmoon\nmozhashpreproc\nmozpercentpreproc\nmql\nmscgen\nmupad\nmxml\nmyghty\nmysql\nnasm\nnemerle\nnesc\nnewlisp\nnewspeak\nnginx\nnimrod\nnit\nnixos\nnsis\nnumpy\nobjdump\nobjdump-nasm\nobjective-c++\nobjective-j\nocaml\noctave\nooc\nopa\nopenedge\npan\npawn\nperl6\npig\npike\nplpgsql\npostgresql\npostscript\npot\npov\npowershell\nprolog\nproperties\nprotobuf\npsql\npuppet\npy3tb\npycon\npypylog\npytb\npython3\nqbasic\nqml\nracket\nragel\nragel-c\nragel-cpp\nragel-d\nragel-em\nragel-java\nragel-objc\nragel-ruby\nraw\nrb\nrbcon\nrconsole\nrd\nrebol\nred\nredcode\nregistry\nresource\nrexx\nrhtml\nrobotframework\nrql\nrsl\nrst\nrust\nsass\nscala\nscaml\nscheme\nscilab\nscss\nshell-session\nslim\nsmali\nsmalltalk\nsmarty\nsml\nsnobol\nsourceslist\nsp\nsparql\nspec\nsplus\nsql\nsqlite3\nsquidconf\nssp\nstan\nswig\nsystemverilog\ntads3\ntcl\ntcsh\ntea\ntex\ntextile\ntodotxt\ntrac-wiki\ntreetop\nts\ntwig\nurbiscript\nvala\nvb.net\nvctreestatus\nvelocity\nverilog\nvgl\nvhdl\nvim\nxml\nxml+cheetah\nxml+django\nxml+erb\nxml+evoque\nxml+lasso\nxml+mako\nxml+myghty\nxml+php\nxml+smarty\nxml+velocity\nxquery\nxslt\nxtend\nxul+mozpreproc\nyaml\nyaml+jinja\nzephir"
        }
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@input"
            }
          ]
        },
        "name" : {
          "value" : "lang"
        }
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "00000000000000000000000000000000"
        },
        "name" : {
          "value" : "apikey"
        }
      }
    },
    {
      "type" : "@editor.filename",
      "parameters" : {
        "mode" : 0,
        "includeExtension" : false
      }
    },
    {
      "type" : "@text.encode",
      "parameters" : {
        "mode" : 0,
        "decode" : false,
        "text" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@input"
            }
          ]
        },
        "base64Options" : 0
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@input"
            }
          ]
        },
        "name" : {
          "value" : "filename"
        }
      }
    },
    {
      "type" : "@text.encode",
      "parameters" : {
        "mode" : 0,
        "decode" : false,
        "text" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@editor.full-text"
            }
          ]
        },
        "base64Options" : 0
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@editor.full-text"
            }
          ]
        },
        "name" : {
          "value" : "body"
        }
      }
    },
    {
      "type" : "@util.request",
      "parameters" : {
        "body" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "body"
            }
          ]
        },
        "url" : {
          "value" : "https:\/\/www.pastery.net\/api\/paste\/?title=$&api_key=$&language=$&duration=$",
          "tokens" : [
            {
              "location" : 73,
              "value" : "life"
            },
            {
              "location" : 62,
              "value" : "lang"
            },
            {
              "location" : 51,
              "value" : "apikey"
            },
            {
              "location" : 41,
              "value" : "filename"
            }
          ]
        },
        "method" : 1,
        "headers" : {
          "value" : "{\"Content-Type\": \"text\/plain\"}"
        }
      }
    },
    {
      "type" : "@flow.javascript",
      "parameters" : {
        "script" : {
          "value" : "\/\/ Get input\nconst text = $actions.inputValue;\n\nlet data = JSON.parse(text)\n\n\/\/ Resolve with output\n$actions.resolve(data.url);\n\n\/\/ Exception handling:\n\/\/  $actions.reject(\"Error\");\n\/\/  $actions.finish();"
        }
      }
    },
    {
      "type" : "@flow.set-variable",
      "parameters" : {
        "value" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "@input"
            }
          ]
        },
        "name" : {
          "value" : "url"
        }
      }
    },
    {
      "type" : "@ui.toast",
      "parameters" : {
        "style" : 1,
        "waitUntilDone" : true,
        "title" : {
          "value" : "Paste created - URL passed to system clipboard"
        }
      }
    },
    {
      "type" : "@util.set-clipboard",
      "parameters" : {
        "mode" : 0,
        "localOnly" : false,
        "text" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "url"
            }
          ]
        },
        "expireAfter" : {
          "value" : "0"
        }
      }
    },
    {
      "type" : "@util.open-url",
      "parameters" : {
        "url" : {
          "value" : "$",
          "tokens" : [
            {
              "location" : 0,
              "value" : "url"
            }
          ]
        },
        "fullScreen" : false,
        "browser" : 2
      }
    }
  ],
  "buildVersion" : 1,
  "name" : "Pastery",
  "clientMinVersion" : 1,
  "summary" : "Create a Pastery paste via API with the current document's contents. The result's URL will be passed to the system clipboard.\n\nYou'll need to change the value of the `apikey` variable to your own Pastery API key.\n\nSee Pastery's API documentation: https:\/\/www.pastery.net\/api",
  "icon" : {
    "glyph" : "arrow.triangle.2.circlepath.doc.on.clipboard",
    "color" : "#FB6666"
  },
  "clientVersion" : 842
}