n8n/packages/nodes-base/nodes/Zammad/descriptions/UserDescription.ts
Iván Ovejero 5528698c31
Add Zammad node (#2621)
* add zammad

*  First pass

* 👕 Fix lint

*  Refactor user resource

*  Refactor group resource

*  Refactor ticket resource

*  Minor improvements

*  Set workaround for broken endpoints

* 👕 Fix lint

*  Fix credentials test

* 📦 Update package-lock.json

*  Change defaults for active

*  Refactor creds

* 👕 Fix lint

* 📦 Update package-lock.json

*  Make first and last name required

*  Replace email with login

*  Switch defaults to true

*  Add custom fields to groups

*  Add inactive entities to loaders

*  Move email to optional fields

*  Validate for empty article

* 🔥 Remove `ticket:update` per feedback

* 📦 Update package-lock.json

* 🚚 Rename import

* 👕 Fix lint

*  Small improvements

*  Improvements

Co-authored-by: quansenB <inaki.breinbauer@gmail.com>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2022-02-12 08:40:54 +01:00

663 lines
12 KiB
TypeScript

import {
INodeProperties,
} from 'n8n-workflow';
export const userDescription: INodeProperties[] = [
// ----------------------------------
// operations
// ----------------------------------
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a user',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a user',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a user',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all users',
},
{
name: 'Get Self',
value: 'getSelf',
description: 'Retrieve currently logged-in user',
},
{
name: 'Update',
value: 'update',
description: 'Update a user',
},
],
default: 'create',
},
// ----------------------------------
// fields
// ----------------------------------
{
displayName: 'First Name',
name: 'firstname',
type: 'string',
default: '',
placeholder: 'John',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
placeholder: 'Smith',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
},
{
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to update. Specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
},
},
},
{
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to delete. Specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'delete',
],
},
},
},
{
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to retrieve. Specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
default: {},
placeholder: 'Add Field',
options: [
{
displayName: 'Active',
name: 'active',
type: 'boolean',
default: true,
},
{
displayName: 'Address',
name: 'addressUi',
type: 'fixedCollection',
placeholder: 'Add Address',
default: {},
options: [
{
displayName: 'Address Details',
name: 'addressDetails',
values: [
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
placeholder: 'Berlin',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
placeholder: 'Germany',
},
{
displayName: 'Street & Number',
name: 'address',
type: 'string',
default: '',
placeholder: 'Borsigstr. 27',
},
{
displayName: 'Zip Code',
name: 'zip',
type: 'string',
default: '',
placeholder: '10115',
},
],
},
],
},
{
displayName: 'Custom Fields',
name: 'customFieldsUi',
type: 'fixedCollection',
default: '',
placeholder: 'Add Custom Field',
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'customFieldPairs',
displayName: 'Custom Field',
values: [
{
displayName: 'Field Name',
name: 'name',
type: 'options',
typeOptions: {
loadOptionsMethod: 'loadUserCustomFields',
},
default: '',
description: 'Name of the custom field to set',
},
{
displayName: 'Field Value',
name: 'value',
type: 'string',
default: '',
description: 'Value to set on the custom field',
},
],
},
],
},
{
displayName: 'Department',
name: 'department',
type: 'string',
default: '',
placeholder: 'Finance',
},
{
displayName: 'Email Address',
name: 'email',
type: 'string',
default: '',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
placeholder: '+49 30 901820',
},
{
displayName: 'Notes',
name: 'note',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
{
displayName: 'Organization Name/ID',
name: 'organization',
type: 'options',
description: 'Name of the organization to assign to the user. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
default: '',
typeOptions: {
loadOptionsMethod: 'loadOrganizations',
},
},
{
displayName: 'Phone (Landline)',
name: 'phone',
type: 'string',
default: '',
placeholder: '+49 30 901820',
},
{
displayName: 'Phone (Mobile)',
name: 'mobile',
type: 'string',
default: '',
placeholder: '+49 1522 3433333',
},
{
displayName: 'Verified',
name: 'verified',
type: 'boolean',
default: false,
description: 'Whether the user has been verified',
},
{
displayName: 'VIP',
name: 'vip',
type: 'boolean',
default: false,
description: 'Whether the user is a Very Important Person',
},
{
displayName: 'Website',
name: 'web',
type: 'string',
default: '',
placeholder: 'https://n8n.io',
},
],
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'user',
],
},
},
default: {},
placeholder: 'Add Field',
options: [
{
displayName: 'Active',
name: 'active',
type: 'boolean',
default: true,
},
{
displayName: 'Address',
name: 'addressUi',
type: 'fixedCollection',
placeholder: 'Add Address',
default: {},
options: [
{
displayName: 'Address Details',
name: 'addressDetails',
values: [
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
placeholder: 'Berlin',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
placeholder: 'Germany',
},
{
displayName: 'Street & Number',
name: 'address',
type: 'string',
default: '',
placeholder: 'Borsigstr. 27',
},
{
displayName: 'Zip Code',
name: 'zip',
type: 'string',
default: '',
placeholder: '10115',
},
],
},
],
},
{
displayName: 'Custom Fields',
name: 'customFieldsUi',
type: 'fixedCollection',
default: '',
placeholder: 'Add Custom Field',
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'customFieldPairs',
displayName: 'Custom Field',
values: [
{
displayName: 'Field Name',
name: 'name',
type: 'options',
typeOptions: {
loadOptionsMethod: 'loadUserCustomFields',
},
default: '',
description: 'Name of the custom field to set',
},
{
displayName: 'Field Value',
name: 'value',
type: 'string',
default: '',
description: 'Value to set on the custom field',
},
],
},
],
},
{
displayName: 'Department',
name: 'department',
type: 'string',
default: '',
placeholder: 'Finance',
},
{
displayName: 'Email Address',
name: 'email',
type: 'string',
default: '',
placeholder: 'hello@n8n.io',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
placeholder: '+49 30 901820',
},
{
displayName: 'First Name',
name: 'firstname',
type: 'string',
default: '',
placeholder: 'John',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
placeholder: 'Smith',
},
{
displayName: 'Notes',
name: 'note',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
{
displayName: 'Organization Name/ID',
name: 'organization',
type: 'options',
description: 'Name of the organization to assign to the user. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
default: '',
typeOptions: {
loadOptionsMethod: 'loadOrganizationNames',
},
},
{
displayName: 'Phone (Landline)',
name: 'phone',
type: 'string',
default: '',
placeholder: '+49 30 901820',
},
{
displayName: 'Phone (Mobile)',
name: 'mobile',
type: 'string',
default: '',
placeholder: '+49 1522 3433333',
},
{
displayName: 'Verified',
name: 'verified',
type: 'boolean',
default: false,
description: 'Whether the user has been verified',
},
{
displayName: 'VIP',
name: 'vip',
type: 'boolean',
default: false,
description: 'Whether the user is a Very Important Person',
},
{
displayName: 'Website',
name: 'web',
type: 'string',
default: '',
placeholder: 'https://n8n.io',
},
],
},
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'search',
],
resource: [
'user',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
operation: [
'search',
],
resource: [
'user',
],
},
},
description: 'Max number of results to return',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
},
},
default: {},
placeholder: 'Add Filter',
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description: 'Query to filter results by',
placeholder: 'user.firstname:john',
},
{
displayName: 'Sort',
name: 'sortUi',
type: 'fixedCollection',
placeholder: 'Add Sort Options',
default: {},
options: [
{
displayName: 'Sort Options',
name: 'sortDetails',
values: [
{
displayName: 'Sort Key',
name: 'sort_by',
type: 'options',
typeOptions: {
loadOptionsMethod: 'loadUserFields',
},
default: '',
},
{
displayName: 'Sort Order',
name: 'order_by',
type: 'options',
options: [
{
name: 'Ascending',
value: 'asc',
},
{
name: 'Descending',
value: 'desc',
},
],
default: 'asc',
},
],
},
],
},
],
},
];