-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(KoBoToolbox Node): Add KoBoToolbox Regular and Trigger Node (#2765)
* First version * Added hooks * Added Credentials test * Add support for downloading attachments * Slight restructure of downloaded binaries * Added Trigger node * Some linting * Reverting package-lock changes * Minor GeoJSON parsing fixes * KoboToolbox: improve GeoJSON format * Kobo: Support for get/set validation status * Remove some logs * [kobo] Fix default attachment options * Proper debug logging * Support for hook log status filter * Kobo: Review fixes * [kobo]: Add Get All Forms + lookup Form ID * [kobo] Lookup Form ID in Trigger node * [kobo] Update branded spelling * [kobo] Support pagination * ⚡ fix linting issue * ⚡ Improvements to #2510 * ⚡ Download files using n8n helper * ⚡ Improvements * ⚡ Improvements * 🐛 Fix filenames * ⚡ Fix some issues Co-authored-by: Yann Jouanique <yann.jouanique@oneacrefund.org> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
- Loading branch information
1 parent
8a88f94
commit 1a7f0a4
Showing
11 changed files
with
1,789 additions
and
213 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/nodes-base/credentials/KoBoToolboxApi.credentials.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
ICredentialType, | ||
NodePropertyTypes, | ||
} from 'n8n-workflow'; | ||
|
||
export class KoBoToolboxApi implements ICredentialType { | ||
name = 'koBoToolboxApi'; | ||
displayName = 'KoBoToolbox API Token'; | ||
// See https://support.kobotoolbox.org/api.html | ||
documentationUrl = 'koBoToolbox'; | ||
properties = [ | ||
{ | ||
displayName: 'API root URL', | ||
name: 'URL', | ||
type: 'string' as NodePropertyTypes, | ||
default: 'https://kf.kobotoolbox.org/', | ||
}, | ||
{ | ||
displayName: 'API Token', | ||
name: 'token', | ||
type: 'string' as NodePropertyTypes, | ||
default: '', | ||
hint: 'You can get your API token at https://[api-root]/token/?format=json (for a logged in user)', | ||
}, | ||
]; | ||
} |
202 changes: 202 additions & 0 deletions
202
packages/nodes-base/nodes/KoBoToolbox/FormDescription.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
import { | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export const formOperations: INodeProperties[] = [ | ||
{ | ||
displayName: 'Operation', | ||
name: 'operation', | ||
type: 'options', | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
}, | ||
}, | ||
options: [ | ||
{ | ||
name: 'Get', | ||
value: 'get', | ||
description: 'Get a form', | ||
}, | ||
{ | ||
name: 'Get All', | ||
value: 'getAll', | ||
description: 'Get all forms', | ||
}, | ||
], | ||
default: 'get', | ||
}, | ||
]; | ||
|
||
export const formFields: INodeProperties[] = [ | ||
|
||
/* -------------------------------------------------------------------------- */ | ||
/* form:get */ | ||
/* -------------------------------------------------------------------------- */ | ||
{ | ||
displayName: 'Form ID', | ||
name: 'formId', | ||
type: 'string', | ||
required: true, | ||
default: '', | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
operation: [ | ||
'get', | ||
], | ||
}, | ||
}, | ||
description: 'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg)', | ||
}, | ||
/* -------------------------------------------------------------------------- */ | ||
/* form:getAll */ | ||
/* -------------------------------------------------------------------------- */ | ||
{ | ||
displayName: 'Return All', | ||
name: 'returnAll', | ||
type: 'boolean', | ||
required: true, | ||
default: false, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
operation: [ | ||
'getAll', | ||
], | ||
}, | ||
}, | ||
description: 'Whether to return all results', | ||
}, | ||
{ | ||
displayName: 'Limit', | ||
name: 'limit', | ||
type: 'number', | ||
required: false, | ||
typeOptions: { | ||
maxValue: 3000, | ||
}, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
operation: [ | ||
'getAll', | ||
], | ||
returnAll: [ | ||
false, | ||
], | ||
}, | ||
}, | ||
default: 1000, | ||
description: 'The number of results to return', | ||
}, | ||
{ | ||
displayName: 'Options', | ||
name: 'options', | ||
placeholder: 'Add Option', | ||
type: 'collection', | ||
default: {}, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
operation: [ | ||
'getAll', | ||
], | ||
}, | ||
}, | ||
options: [ | ||
{ | ||
displayName: 'Sort', | ||
name: 'sort', | ||
type: 'fixedCollection', | ||
typeOptions: { | ||
multipleValues: false, | ||
}, | ||
default: '', | ||
placeholder: 'Add Sort', | ||
options: [ | ||
{ | ||
displayName: 'Sort', | ||
name: 'value', | ||
values: [ | ||
{ | ||
displayName: 'Descending', | ||
name: 'descending', | ||
type: 'boolean', | ||
default: true, | ||
description: 'Sort by descending order', | ||
}, | ||
{ | ||
displayName: 'Order By', | ||
name: 'ordering', | ||
type: 'options', | ||
required: false, | ||
default: 'date_modified', | ||
options: [ | ||
{ | ||
name: 'Asset Type', | ||
value: 'asset_type', | ||
}, | ||
{ | ||
name: 'Date Modified', | ||
value: 'date_modified', | ||
}, | ||
{ | ||
name: 'Name', | ||
value: 'name', | ||
}, | ||
{ | ||
name: 'Owner Username', | ||
value: 'owner__username', | ||
}, | ||
{ | ||
name: 'Subscribers Count', | ||
value: 'subscribers_count', | ||
}, | ||
], | ||
description: 'Field to order by', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
displayName: 'Filters', | ||
name: 'filters', | ||
type: 'collection', | ||
placeholder: 'Add Filter', | ||
default: {}, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'form', | ||
], | ||
operation: [ | ||
'getAll', | ||
], | ||
}, | ||
}, | ||
options: [ | ||
{ | ||
displayName: 'Filter', | ||
name: 'filter', | ||
type: 'string', | ||
default: 'asset_type:survey', | ||
required: false, | ||
description: 'A text search query based on form data - e.g. "owner__username:meg AND name__icontains:quixotic" - see <a href="https://github.com/kobotoolbox/kpi#searching" target="_blank">docs</a> for more details', | ||
}, | ||
], | ||
}, | ||
]; |
Oops, something went wrong.