mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
parent
0a63701a13
commit
be02fc8752
|
@ -14,5 +14,21 @@ export class DropboxApi implements ICredentialType {
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'APP Access Type',
|
||||||
|
name: 'accessType',
|
||||||
|
type: 'options' as NodePropertyTypes,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'App Folder',
|
||||||
|
value: 'folder',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Full Dropbox',
|
||||||
|
value: 'full',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'full',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,21 @@ export class DropboxOAuth2Api implements ICredentialType {
|
||||||
type: 'hidden' as NodePropertyTypes,
|
type: 'hidden' as NodePropertyTypes,
|
||||||
default: 'header',
|
default: 'header',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'APP Access Type',
|
||||||
|
name: 'accessType',
|
||||||
|
type: 'options' as NodePropertyTypes,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'App Folder',
|
||||||
|
value: 'folder',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Full Dropbox',
|
||||||
|
value: 'full',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'full',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
import {
|
import {
|
||||||
dropboxApiRequest,
|
dropboxApiRequest,
|
||||||
dropboxpiRequestAllItems,
|
dropboxpiRequestAllItems,
|
||||||
|
getCredentials,
|
||||||
getRootDirectory,
|
getRootDirectory,
|
||||||
simplify,
|
simplify,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
@ -793,15 +794,20 @@ export class Dropbox implements INodeType {
|
||||||
let headers: IDataObject = {};
|
let headers: IDataObject = {};
|
||||||
let simple = false;
|
let simple = false;
|
||||||
|
|
||||||
// get the root directory to set it as the default search folder
|
|
||||||
const { root_info: { root_namespace_id } } = await getRootDirectory.call(this);
|
|
||||||
|
|
||||||
headers = {
|
const { accessType } = getCredentials.call(this);
|
||||||
'dropbox-api-path-root': JSON.stringify({
|
|
||||||
'.tag': 'root',
|
if (accessType === 'full') {
|
||||||
'root': root_namespace_id,
|
// get the root directory to set it as the default for all operations
|
||||||
}),
|
const { root_info: { root_namespace_id } } = await getRootDirectory.call(this);
|
||||||
};
|
|
||||||
|
headers = {
|
||||||
|
'dropbox-api-path-root': JSON.stringify({
|
||||||
|
'.tag': 'root',
|
||||||
|
'root': root_namespace_id,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
body = {};
|
body = {};
|
||||||
|
|
|
@ -114,4 +114,12 @@ export function simplify(data: IDataObject[]) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCredentials(this: IExecuteFunctions) {
|
||||||
|
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
|
||||||
|
if (authenticationMethod === 'accessToken') {
|
||||||
|
return this.getCredentials('dropboxApi') as IDataObject;
|
||||||
|
} else {
|
||||||
|
return this.getCredentials('dropboxOAuth2Api') as IDataObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue