Skip to content

Instantly share code, notes, and snippets.

@darrenmothersele
Created December 3, 2019 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenmothersele/3cd3b703c8b70c874049133440707f22 to your computer and use it in GitHub Desktop.
Save darrenmothersele/3cd3b703c8b70c874049133440707f22 to your computer and use it in GitHub Desktop.
Read file from Dropbox API and convert to a binary file
{
"adapterName": "dropbox",
"label": "Dropbox",
"description": null,
"infoUrl": null,
"supportUrl": null,
"maintainer": null,
"version": "0.0.0",
"tags": [],
"name": "dropbox",
"modified": true,
"workflow": [
{
"workflowId": "downloadFile",
"title": "Download File",
"adapterName": "dropbox",
"modified": true,
"config": "configs/downloadFile.json"
}
],
"database": [],
"forms": [],
"attachments": {
"configs/downloadFile.json": {
"workflowId": "downloadFile",
"title": "Download File",
"adapterName": "dropbox",
"blocks": [
{
"type": "init"
},
{
"type": "context",
"contextPath": "dropboxAuth",
"contextBlocks": [
{
"type": "auth0",
"provider": "dropbox"
}
],
"blocks": [
{
"type": "mapping",
"mapping": "{ path: '/uploads' }"
},
{
"type": "http",
"method": "post",
"notify": false,
"endpoint": {
"protocol": "https:",
"host": "api.dropboxapi.com",
"pathname": "/2/files/list_folder"
},
"authentication": {
"type": "bearer",
"valueGetters": {
"jwt": "context.dropboxAuth.access_token"
}
}
}
]
},
{
"type": "mapping",
"mapping": "data.entries"
},
{
"type": "reference",
"fieldLabel": "File",
"labelField": "name",
"valueField": "id"
},
{
"type": "debug",
"open": 0,
"showContext": false
},
{
"type": "mapping",
"mapping": "{ path: data }"
},
{
"type": "actions",
"buttons": [
{
"label": "Download",
"color": "default",
"blocks": [
{
"type": "context",
"skipFirst": true,
"contextPath": "dropboxAuth",
"contextBlocks": [
{
"type": "auth0",
"provider": "dropbox"
}
],
"blocks": [
{
"type": "http",
"method": "post",
"notify": false,
"endpoint": {
"protocol": "https:",
"host": "api.dropboxapi.com",
"pathname": "/2/files/get_temporary_link"
},
"authentication": {
"type": "bearer",
"valueGetters": {
"jwt": "context.dropboxAuth.access_token"
}
}
}
]
}
]
}
]
},
{
"type": "debug",
"open": 1,
"showContext": false
},
{
"type": "http",
"method": "get",
"endpoint": {
"valueGetter": "data.link"
},
"responseType": "blob"
},
{
"type": "read-file",
"readMode": "dataUrl",
"fileGetter": "data",
"mode": "replace",
"skipFirst": true
},
{
"type": "debug",
"open": 1,
"showContext": false
}
],
"modified": true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment