Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n8n 3704 node improvement pr 3248 add more ressources #3411

Merged
merged 12 commits into from
Jun 29, 2022
19 changes: 16 additions & 3 deletions packages/nodes-base/credentials/ClockifyApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
Expand All @@ -9,14 +11,25 @@ export class ClockifyApi implements ICredentialType {
displayName = 'Clockify API';
documentationUrl = 'clockify';
properties: INodeProperties[] = [
// The credentials to get from user and save encrypted.
// Properties can be defined exactly in the same way
// as node properties.
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'X-Api-Key': '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.clockify.me/api/v1',
url: '/workspaces',
},
};
}
271 changes: 271 additions & 0 deletions packages/nodes-base/nodes/Clockify/ClientDescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
import {
INodeProperties,
} from 'n8n-workflow';

export const clientOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'client',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a client',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a client',
},
{
name: 'Get',
value: 'get',
description: 'Get a client',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all clients',
},
{
name: 'Update',
value: 'update',
description: 'Update a client',
},
],
default: 'create',
},
];

export const clientFields: INodeProperties[] = [

/* -------------------------------------------------------------------------- */
/* client:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Name',
name: 'name',
type: 'string',
required: true,
default: '',
description: 'Name of client being created',
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'create',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* client:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client ID',
name: 'clientId',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'delete',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* client:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client ID',
name: 'clientId',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'get',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* client:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'client',
],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'client',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'getAll',
],
},
},
default: {},
options: [
{
displayName: 'Archived',
name: 'archived',
type: 'boolean',
default: false,
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'If provided, clients will be filtered by name',
},
{
displayName: 'Sort Order',
name: 'sort-order',
type: 'options',
options: [
{
name: 'Ascending',
value: 'ASCENDING',
},
{
name: 'Descending',
value: 'DESCENDING',
},
],
default: '',
},
],
},

/* -------------------------------------------------------------------------- */
/* client:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client ID',
name: 'clientId',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'client',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'client',
],
},
},
default: {},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of client being created/updated',
},
{
displayName: 'Archived',
name: 'archived',
type: 'boolean',
default: false,
},
],
},
];
Loading