A Taio Action for Pastery

David Blue

--

Pastery Action - iPad Pro
Pastery Action — iPad Pro

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

Pastery Taio Action Demonstration

JSON

{
"actions" : [
{
"type" : "@flow.set-variable",
"parameters" : {
"value" : {
"value" : "{{YOURAPIKEY}}"
},
"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=markdown",
"tokens" : [
{
"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
}

--

--

No responses yet

Write a response