extratone / taio

Configurables, actions, documentation, etc. for Taio.
Other
6 stars 0 forks source link

Pastery Action #18

Open extratone opened 1 year ago

extratone commented 1 year ago

Updated 10122022-084424


Social

Another simple API action for @TaioApp... This time, for the greatest pastebin in the world.


Pastery Taio Action

## 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 ## Video Demo - [Raw File](https://user-images.githubusercontent.com/43663476/195356023-5872afa1-23fb-4fdd-bcb5-2e424ca78a16.MOV) - [Twitter Media Studio](https://studio.twitter.com/library/13_1580195391965904899) ## JSON
```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 } ```
extratone commented 1 year ago

https://user-images.githubusercontent.com/43663476/195356023-5872afa1-23fb-4fdd-bcb5-2e424ca78a16.MOV

extratone commented 1 year ago

Updated Video Demo

https://user-images.githubusercontent.com/43663476/198829204-631db664-f411-4194-940e-a091fdd32986.MOV