GeoSortPhotos
@raymondcamden
code:
data:privatelast updated:3 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 800,000+ developers using the Pipedream platform
steps.
trigger
inactive
last updated:-last event:-
steps.
reversegeocode
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
}
17
const fetch = require('node-fetch');
const key = process.env.HERE_API_KEY;

if(steps.trigger.event['.tag'] !== 'file') $end('wrong type = ' + steps.trigger.event['.tag']);
let loc = steps.trigger.event.media_info.metadata.location.latitude + ',' + 
          steps.trigger.event.media_info.metadata.location.longitude;

let url = `https://revgeocode.search.hereapi.com/v1/revgeocode?apikey=${key}&at=${loc}`;
console.log(url);

let resp = await fetch(url);
let data = await resp.json();
console.log(data.items[0]);
return data.items[0];
steps.
makeDestPath
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
}
7
let destPath = `/documents/geosortedphotos/${steps.reversegeocode.$return_value.address.state}/${steps.reversegeocode.$return_value.address.city}/`;
let filename =  steps.trigger.event.path_lower.split('/').pop();
destPath += filename;
console.log(destPath);
return destPath;
steps.
dropbox_move_file
Moves a file
auth
(auths.dropbox)
params
From path

Full path name such as /Folder1/Folder2/File Name.pdf

 
string ·params.from_path
To path

New full path name such as /New Folder1/Folder2/File Name.pdf

 
string ·params.to_path
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
}
18
const fetch = require('isomorphic-fetch'); 
const { Dropbox } = require('dropbox'); 
const dbx = new Dropbox({ 
  accessToken: auths.dropbox.oauth_access_token, 
  fetch 
});

try {
    this.resp = await dbx.filesMoveV2({
      from_path: params.from_path, 
      to_path: params.to_path
    })
} catch (err) {
  this.err = err
}