first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
import flow from 'lodash/flow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { Zammad } from './types';
|
||||
|
||||
export function tolerateTrailingSlash(url: string) {
|
||||
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
|
||||
}
|
||||
|
||||
export async function zammadApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: '',
|
||||
json: true,
|
||||
};
|
||||
|
||||
const authentication = this.getNodeParameter('authentication', 0) as 'basicAuth' | 'tokenAuth';
|
||||
|
||||
if (authentication === 'basicAuth') {
|
||||
const credentials =
|
||||
await this.getCredentials<Zammad.BasicAuthCredentials>('zammadBasicAuthApi');
|
||||
|
||||
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
|
||||
|
||||
options.uri = `${baseUrl}/api/v1${endpoint}`;
|
||||
|
||||
options.auth = {
|
||||
user: credentials.username,
|
||||
pass: credentials.password,
|
||||
};
|
||||
|
||||
options.rejectUnauthorized = !credentials.allowUnauthorizedCerts;
|
||||
} else {
|
||||
const credentials =
|
||||
await this.getCredentials<Zammad.TokenAuthCredentials>('zammadTokenAuthApi');
|
||||
|
||||
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
|
||||
|
||||
options.uri = `${baseUrl}/api/v1${endpoint}`;
|
||||
|
||||
options.headers = {
|
||||
Authorization: `Token token=${credentials.accessToken}`,
|
||||
};
|
||||
|
||||
options.rejectUnauthorized = !credentials.allowUnauthorizedCerts;
|
||||
}
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (!Object.keys(qs).length) {
|
||||
delete options.qs;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
} catch (error) {
|
||||
if (error.error.error === 'Object already exists!') {
|
||||
error.error.error = 'An entity with this name already exists.';
|
||||
}
|
||||
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export async function zammadApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
limit = 0,
|
||||
) {
|
||||
// https://docs.zammad.org/en/latest/api/intro.html#pagination
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
qs.per_page = 20;
|
||||
qs.page = 1;
|
||||
|
||||
do {
|
||||
responseData = await zammadApiRequest.call(this, method, endpoint, body, qs);
|
||||
returnData.push(...(responseData as IDataObject[]));
|
||||
|
||||
if (limit && returnData.length > limit) {
|
||||
return returnData.slice(0, limit);
|
||||
}
|
||||
|
||||
qs.page++;
|
||||
} while (responseData.length);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function throwOnEmptyUpdate(this: IExecuteFunctions, resource: string) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one field to update for the ${resource}`,
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// loadOptions utils
|
||||
// ----------------------------------
|
||||
|
||||
export const prettifyDisplayName = (fieldName: string) => fieldName.replace('name', ' Name');
|
||||
|
||||
export const fieldToLoadOption = (i: Zammad.Field) => {
|
||||
return { name: i.display ? prettifyDisplayName(i.display) : i.name, value: i.name };
|
||||
};
|
||||
|
||||
export const isCustomer = (user: Zammad.User) =>
|
||||
user.role_ids.includes(3) && !user.email.endsWith('@zammad.org');
|
||||
|
||||
export async function getAllFields(this: ILoadOptionsFunctions) {
|
||||
return (await zammadApiRequest.call(this, 'GET', '/object_manager_attributes')) as Zammad.Field[];
|
||||
}
|
||||
|
||||
const isTypeField =
|
||||
(resource: 'Group' | 'Organization' | 'Ticket' | 'User') => (arr: Zammad.Field[]) =>
|
||||
arr.filter((i) => i.object === resource);
|
||||
|
||||
export const getGroupFields = isTypeField('Group');
|
||||
export const getOrganizationFields = isTypeField('Organization');
|
||||
export const getUserFields = isTypeField('User');
|
||||
export const getTicketFields = isTypeField('Ticket');
|
||||
|
||||
const getCustomFields = (arr: Zammad.Field[]) => arr.filter((i) => i.created_by_id !== 1);
|
||||
|
||||
export const getGroupCustomFields = flow(getGroupFields, getCustomFields);
|
||||
export const getOrganizationCustomFields = flow(getOrganizationFields, getCustomFields);
|
||||
export const getUserCustomFields = flow(getUserFields, getCustomFields);
|
||||
export const getTicketCustomFields = flow(getTicketFields, getCustomFields);
|
||||
|
||||
export const isNotZammadFoundation = (i: Zammad.Organization) => i.name !== 'Zammad Foundation';
|
||||
|
||||
export const doesNotBelongToZammad = (i: Zammad.User) =>
|
||||
!i.email.endsWith('@zammad.org') && i.login !== '-';
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.zammad",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Communication"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/zammad/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.zammad/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,760 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ICredentialsDecrypted,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeCredentialTestResult,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
groupDescription,
|
||||
organizationDescription,
|
||||
ticketDescription,
|
||||
userDescription,
|
||||
} from './descriptions';
|
||||
import {
|
||||
doesNotBelongToZammad,
|
||||
fieldToLoadOption,
|
||||
getAllFields,
|
||||
getGroupCustomFields,
|
||||
getGroupFields,
|
||||
getOrganizationCustomFields,
|
||||
getOrganizationFields,
|
||||
getTicketCustomFields,
|
||||
getTicketFields,
|
||||
getUserCustomFields,
|
||||
getUserFields,
|
||||
isCustomer,
|
||||
isNotZammadFoundation,
|
||||
throwOnEmptyUpdate,
|
||||
tolerateTrailingSlash,
|
||||
zammadApiRequest,
|
||||
zammadApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import type { Zammad as ZammadTypes } from './types';
|
||||
|
||||
export class Zammad implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Zammad',
|
||||
name: 'zammad',
|
||||
icon: 'file:zammad.svg',
|
||||
group: ['input'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume the Zammad API',
|
||||
defaults: {
|
||||
name: 'Zammad',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'zammadBasicAuthApi',
|
||||
required: true,
|
||||
testedBy: 'zammadBasicAuthApiTest',
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: ['basicAuth'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'zammadTokenAuthApi',
|
||||
required: true,
|
||||
testedBy: 'zammadTokenAuthApiTest',
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: ['tokenAuth'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Basic Auth',
|
||||
value: 'basicAuth',
|
||||
},
|
||||
{
|
||||
name: 'Token Auth',
|
||||
value: 'tokenAuth',
|
||||
},
|
||||
],
|
||||
default: 'tokenAuth',
|
||||
},
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
noDataExpression: true,
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Group',
|
||||
value: 'group',
|
||||
},
|
||||
{
|
||||
name: 'Organization',
|
||||
value: 'organization',
|
||||
},
|
||||
{
|
||||
name: 'Ticket',
|
||||
value: 'ticket',
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
],
|
||||
default: 'user',
|
||||
},
|
||||
|
||||
...groupDescription,
|
||||
...organizationDescription,
|
||||
...ticketDescription,
|
||||
...userDescription,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// ----------------------------------
|
||||
// custom fields
|
||||
// ----------------------------------
|
||||
|
||||
async loadGroupCustomFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getGroupCustomFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadOrganizationCustomFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getOrganizationCustomFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadUserCustomFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getUserCustomFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadTicketCustomFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getTicketCustomFields(allFields).map((i) => ({ name: i.name, value: i.id }));
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// built-in fields
|
||||
// ----------------------------------
|
||||
|
||||
async loadGroupFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getGroupFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadOrganizationFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getOrganizationFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadTicketFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getTicketFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
async loadUserFields(this: ILoadOptionsFunctions) {
|
||||
const allFields = await getAllFields.call(this);
|
||||
|
||||
return getUserFields(allFields).map(fieldToLoadOption);
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// resources
|
||||
// ----------------------------------
|
||||
|
||||
// by non-ID attribute
|
||||
|
||||
/**
|
||||
* POST /tickets requires group name instead of group ID.
|
||||
*/
|
||||
async loadGroupNames(this: ILoadOptionsFunctions) {
|
||||
const groups = (await zammadApiRequest.call(this, 'GET', '/groups')) as ZammadTypes.Group[];
|
||||
|
||||
return groups.map((i) => ({ name: i.name, value: i.name }));
|
||||
},
|
||||
|
||||
/**
|
||||
* PUT /users requires organization name instead of organization ID.
|
||||
*/
|
||||
async loadOrganizationNames(this: ILoadOptionsFunctions) {
|
||||
const orgs = (await zammadApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/organizations',
|
||||
)) as ZammadTypes.Group[];
|
||||
|
||||
return orgs.filter(isNotZammadFoundation).map((i) => ({ name: i.name, value: i.name }));
|
||||
},
|
||||
|
||||
/**
|
||||
* POST & PUT /tickets requires customer email instead of customer ID.
|
||||
*/
|
||||
async loadCustomerEmails(this: ILoadOptionsFunctions) {
|
||||
const users = (await zammadApiRequest.call(this, 'GET', '/users')) as ZammadTypes.User[];
|
||||
|
||||
return users.filter(isCustomer).map((i) => ({ name: i.email, value: i.email }));
|
||||
},
|
||||
|
||||
// by ID
|
||||
|
||||
async loadGroups(this: ILoadOptionsFunctions) {
|
||||
const groups = (await zammadApiRequest.call(this, 'GET', '/groups')) as ZammadTypes.Group[];
|
||||
|
||||
return groups.map((i) => ({ name: i.name, value: i.id }));
|
||||
},
|
||||
|
||||
async loadOrganizations(this: ILoadOptionsFunctions) {
|
||||
const orgs = (await zammadApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/organizations',
|
||||
)) as ZammadTypes.Organization[];
|
||||
|
||||
return orgs.filter(isNotZammadFoundation).map((i) => ({ name: i.name, value: i.id }));
|
||||
},
|
||||
|
||||
async loadUsers(this: ILoadOptionsFunctions) {
|
||||
const users = (await zammadApiRequest.call(this, 'GET', '/users')) as ZammadTypes.User[];
|
||||
|
||||
return users.filter(doesNotBelongToZammad).map((i) => ({ name: i.login, value: i.id }));
|
||||
},
|
||||
},
|
||||
credentialTest: {
|
||||
async zammadBasicAuthApiTest(
|
||||
this: ICredentialTestFunctions,
|
||||
credential: ICredentialsDecrypted,
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data as ZammadTypes.BasicAuthCredentials;
|
||||
|
||||
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
|
||||
|
||||
const options: IRequestOptions = {
|
||||
method: 'GET',
|
||||
uri: `${baseUrl}/api/v1/users/me`,
|
||||
json: true,
|
||||
rejectUnauthorized: !credentials.allowUnauthorizedCerts,
|
||||
auth: {
|
||||
user: credentials.username,
|
||||
pass: credentials.password,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
await this.helpers.request(options);
|
||||
return {
|
||||
status: 'OK',
|
||||
message: 'Authentication successful',
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 'Error',
|
||||
message: error.message,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
async zammadTokenAuthApiTest(
|
||||
this: ICredentialTestFunctions,
|
||||
credential: ICredentialsDecrypted,
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data as ZammadTypes.TokenAuthCredentials;
|
||||
|
||||
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
|
||||
|
||||
const options: IRequestOptions = {
|
||||
method: 'GET',
|
||||
uri: `${baseUrl}/api/v1/users/me`,
|
||||
json: true,
|
||||
rejectUnauthorized: !credentials.allowUnauthorizedCerts,
|
||||
headers: {
|
||||
Authorization: `Token token=${credentials.accessToken}`,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
await this.helpers.request(options);
|
||||
return {
|
||||
status: 'OK',
|
||||
message: 'Authentication successful',
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 'Error',
|
||||
message: error.message,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as ZammadTypes.Resource;
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let responseData;
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
if (resource === 'user') {
|
||||
// **********************************************************************
|
||||
// user
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// user:create
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#create
|
||||
|
||||
const body: IDataObject = {
|
||||
firstname: this.getNodeParameter('firstname', i),
|
||||
lastname: this.getNodeParameter('lastname', i),
|
||||
};
|
||||
|
||||
const { addressUi, customFieldsUi, ...rest } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i,
|
||||
) as ZammadTypes.UserAdditionalFields;
|
||||
|
||||
Object.assign(body, addressUi?.addressDetails);
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'POST', '/users', body);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// user:update
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#update
|
||||
|
||||
const id = this.getNodeParameter('id', i);
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
const updateFields = this.getNodeParameter(
|
||||
'updateFields',
|
||||
i,
|
||||
) as ZammadTypes.UserUpdateFields;
|
||||
|
||||
if (!Object.keys(updateFields).length) {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const { addressUi, customFieldsUi, ...rest } = updateFields;
|
||||
|
||||
Object.assign(body, addressUi?.addressDetails);
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'PUT', `/users/${id}`, body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// user:delete
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#delete
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
await zammadApiRequest.call(this, 'DELETE', `/users/${id}`);
|
||||
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// user:get
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#show
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'GET', `/users/${id}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// user:getAll
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#list
|
||||
// https://docs.zammad.org/en/latest/api/user.html#search
|
||||
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const { sortUi, ...rest } = this.getNodeParameter(
|
||||
'filters',
|
||||
i,
|
||||
) as ZammadTypes.UserFilterFields;
|
||||
|
||||
Object.assign(qs, sortUi?.sortDetails);
|
||||
|
||||
Object.assign(qs, rest);
|
||||
|
||||
qs.query ||= ''; // otherwise triggers 500
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
const limit = returnAll ? 0 : this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await zammadApiRequestAllItems
|
||||
.call(this, 'GET', '/users/search', {}, qs, limit)
|
||||
.then((response) => {
|
||||
return response.map((user) => {
|
||||
const { _preferences, ...data } = user;
|
||||
return data;
|
||||
});
|
||||
});
|
||||
} else if (operation === 'getSelf') {
|
||||
// ----------------------------------
|
||||
// user:me
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/user.html#me-current-user
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'GET', '/users/me');
|
||||
}
|
||||
} else if (resource === 'organization') {
|
||||
// **********************************************************************
|
||||
// organization
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// organization:create
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#create
|
||||
|
||||
const body: IDataObject = {
|
||||
name: this.getNodeParameter('name', i),
|
||||
};
|
||||
|
||||
const { customFieldsUi, ...rest } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i,
|
||||
) as ZammadTypes.UserAdditionalFields;
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'POST', '/organizations', body);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// organization:update
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#update
|
||||
|
||||
const id = this.getNodeParameter('id', i);
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
const updateFields = this.getNodeParameter(
|
||||
'updateFields',
|
||||
i,
|
||||
) as ZammadTypes.UserUpdateFields;
|
||||
|
||||
if (!Object.keys(updateFields).length) {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const { customFieldsUi, ...rest } = updateFields;
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'PUT', `/organizations/${id}`, body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// organization:delete
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#delete
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
await zammadApiRequest.call(this, 'DELETE', `/organizations/${id}`);
|
||||
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// organization:get
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#show
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'GET', `/organizations/${id}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// organization:getAll
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#list
|
||||
// https://docs.zammad.org/en/latest/api/organization.html#search - returning empty always
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
const limit = returnAll ? 0 : this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await zammadApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/organizations',
|
||||
{},
|
||||
{},
|
||||
limit,
|
||||
);
|
||||
}
|
||||
} else if (resource === 'group') {
|
||||
// **********************************************************************
|
||||
// group
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// group:create
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/group.html#create
|
||||
|
||||
const body: IDataObject = {
|
||||
name: this.getNodeParameter('name', i) as string,
|
||||
};
|
||||
|
||||
const { customFieldsUi, ...rest } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i,
|
||||
) as ZammadTypes.UserAdditionalFields;
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'POST', '/groups', body);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// group:update
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/group.html#update
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
const updateFields = this.getNodeParameter(
|
||||
'updateFields',
|
||||
i,
|
||||
) as ZammadTypes.GroupUpdateFields;
|
||||
|
||||
if (!Object.keys(updateFields).length) {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const { customFieldsUi, ...rest } = updateFields;
|
||||
|
||||
customFieldsUi?.customFieldPairs.forEach((pair) => {
|
||||
body[pair.name] = pair.value;
|
||||
});
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'PUT', `/groups/${id}`, body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// group:delete
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/group.html#delete
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
await zammadApiRequest.call(this, 'DELETE', `/groups/${id}`);
|
||||
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// group:get
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/group.html#show
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'GET', `/groups/${id}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// group:getAll
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/group.html#list
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
const limit = returnAll ? 0 : this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await zammadApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/groups',
|
||||
{},
|
||||
{},
|
||||
limit,
|
||||
);
|
||||
}
|
||||
} else if (resource === 'ticket') {
|
||||
// **********************************************************************
|
||||
// ticket
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// ticket:create
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/ticket/index.html#create
|
||||
|
||||
const body = {
|
||||
article: {},
|
||||
title: this.getNodeParameter('title', i) as string,
|
||||
group: this.getNodeParameter('group', i) as string,
|
||||
customer: this.getNodeParameter('customer', i) as string,
|
||||
};
|
||||
|
||||
const article = this.getNodeParameter('article', i) as ZammadTypes.Article;
|
||||
|
||||
if (!Object.keys(article).length) {
|
||||
throw new NodeOperationError(this.getNode(), 'Article is required', { itemIndex: i });
|
||||
}
|
||||
|
||||
const {
|
||||
articleDetails: { visibility, ...rest },
|
||||
} = article;
|
||||
|
||||
body.article = {
|
||||
...rest,
|
||||
internal: visibility === 'internal',
|
||||
};
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'POST', '/tickets', body);
|
||||
|
||||
const { id } = responseData;
|
||||
|
||||
responseData.articles = await zammadApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/ticket_articles/by_ticket/${id}`,
|
||||
);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// ticket:delete
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/ticket/index.html#delete
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
await zammadApiRequest.call(this, 'DELETE', `/tickets/${id}`);
|
||||
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// ticket:get
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/ticket/index.html#show
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await zammadApiRequest.call(this, 'GET', `/tickets/${id}`);
|
||||
responseData.articles = await zammadApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/ticket_articles/by_ticket/${id}`,
|
||||
);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// ticket:getAll
|
||||
// ----------------------------------
|
||||
|
||||
// https://docs.zammad.org/en/latest/api/ticket/index.html#list
|
||||
// https://docs.zammad.org/en/latest/api/ticket/index.html#search - returning empty always
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
const limit = returnAll ? 0 : this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await zammadApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/tickets',
|
||||
{},
|
||||
{},
|
||||
limit,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ json: { error: error.message } });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"cod_torre": {
|
||||
"type": "string"
|
||||
},
|
||||
"contrato_sla": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"dom_2nd": {
|
||||
"type": "string"
|
||||
},
|
||||
"domain": {
|
||||
"type": "string"
|
||||
},
|
||||
"domain_assignment": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id_tele": {
|
||||
"type": "string"
|
||||
},
|
||||
"member_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"r7regiao": {
|
||||
"type": "string"
|
||||
},
|
||||
"sctntid": {
|
||||
"type": "string"
|
||||
},
|
||||
"secondary_member_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"shared": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"stellar_case_min_score": {
|
||||
"type": "integer"
|
||||
},
|
||||
"stellar_ia": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"stellarcyber_cases": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"vip": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"article_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"articles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"filename": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"preferences": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Content-Disposition": {
|
||||
"type": "string"
|
||||
},
|
||||
"Content-ID": {
|
||||
"type": "string"
|
||||
},
|
||||
"Content-Type": {
|
||||
"type": "string"
|
||||
},
|
||||
"Mime-Type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"type": "string"
|
||||
},
|
||||
"store_file_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "string"
|
||||
},
|
||||
"content_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"internal": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sender": {
|
||||
"type": "string"
|
||||
},
|
||||
"sender_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"ticket_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"type_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"checklist_id": {
|
||||
"type": "null"
|
||||
},
|
||||
"create_article_sender_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"create_article_type_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"group_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"internal_issue_type": {
|
||||
"type": "null"
|
||||
},
|
||||
"internal_ticket": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"note": {
|
||||
"type": "null"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"owner_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"preferences": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"escalation_calculation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"calendar_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"calendar_updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"escalation_disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"first_response_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_contact_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_update_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"sla_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"sla_updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"priority_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"product": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolution": {
|
||||
"type": "string"
|
||||
},
|
||||
"state_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"sub_priority": {
|
||||
"type": "string"
|
||||
},
|
||||
"ticket_severity": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type_from_ahlsell": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"wait_for_3rd_party": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"article_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"create_article_sender_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"create_article_type_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"escalation_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"group_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"note": {
|
||||
"type": "null"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"owner_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pending_time": {
|
||||
"type": "null"
|
||||
},
|
||||
"preferences": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"priority_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"state_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"authorization_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"firstname": {
|
||||
"type": "string"
|
||||
},
|
||||
"group_ids": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"1": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"lastname": {
|
||||
"type": "string"
|
||||
},
|
||||
"login": {
|
||||
"type": "string"
|
||||
},
|
||||
"login_failed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mobile": {
|
||||
"type": "string"
|
||||
},
|
||||
"out_of_office": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"preferences": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"intro": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"locale": {
|
||||
"type": "string"
|
||||
},
|
||||
"notification_config": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matrix": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"create": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"criteria": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"no": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_nobody": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subscribed": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"escalation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"criteria": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"no": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_nobody": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subscribed": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"reminder_reached": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"criteria": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"no": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_nobody": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subscribed": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"criteria": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"no": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"owned_by_nobody": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subscribed": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification_sound": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"file": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"secondaryAction": {
|
||||
"type": "string"
|
||||
},
|
||||
"theme": {
|
||||
"type": "string"
|
||||
},
|
||||
"tickets_closed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tickets_open": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"role_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"street": {
|
||||
"type": "string"
|
||||
},
|
||||
"two_factor_preference_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_by_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"verified": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"vip": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"web": {
|
||||
"type": "string"
|
||||
},
|
||||
"zip": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const groupDescription: INodeProperties[] = [
|
||||
// ----------------------------------
|
||||
// operations
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a group',
|
||||
action: 'Create a group',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a group',
|
||||
action: 'Delete a group',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a group',
|
||||
action: 'Get a group',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many groups',
|
||||
action: 'Get many groups',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a group',
|
||||
action: 'Update a group',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// fields
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Group Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create'],
|
||||
resource: ['group'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Group ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Group to update. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Group ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Group to delete. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Group ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Group to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Active',
|
||||
name: 'active',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadGroupCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Field Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on the custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['update'],
|
||||
resource: ['group'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Active',
|
||||
name: 'active',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadGroupCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Field Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on the custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Group Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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: ['group'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['group'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,329 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const organizationDescription: INodeProperties[] = [
|
||||
// ----------------------------------
|
||||
// operations
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organization'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an organization',
|
||||
action: 'Create an organization',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an organization',
|
||||
action: 'Delete an organization',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve an organization',
|
||||
action: 'Get an organization',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many organizations',
|
||||
action: 'Get many organizations',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an organization',
|
||||
action: 'Update an organization',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// fields
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Organization Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create'],
|
||||
resource: ['organization'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Organization to update. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organization'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Organization to delete. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organization'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Organization to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organization'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create'],
|
||||
resource: ['organization'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Shared',
|
||||
name: 'shared',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the organization is shared with other instances',
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The domain associated with the organization',
|
||||
},
|
||||
{
|
||||
displayName: 'Domain Assignment',
|
||||
name: 'domain_assignment',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether to assign users based on their email domain',
|
||||
},
|
||||
{
|
||||
displayName: 'Active',
|
||||
name: 'active',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether the organization is active',
|
||||
},
|
||||
{
|
||||
displayName: 'VIP',
|
||||
name: 'vip',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the organization is marked as VIP',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A note about the organization',
|
||||
},
|
||||
{
|
||||
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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadOrganizationCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on the custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['update'],
|
||||
resource: ['organization'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Shared',
|
||||
name: 'shared',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the organization is shared with other instances',
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The domain associated with the organization',
|
||||
},
|
||||
{
|
||||
displayName: 'Domain Assignment',
|
||||
name: 'domain_assignment',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether to assign users based on their email domain',
|
||||
},
|
||||
{
|
||||
displayName: 'Active',
|
||||
name: 'active',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether the organization is active',
|
||||
},
|
||||
{
|
||||
displayName: 'VIP',
|
||||
name: 'vip',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the organization is marked as VIP',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A note about the organization',
|
||||
},
|
||||
{
|
||||
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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadOrganizationCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on the custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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: ['organization'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organization'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,325 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const ticketDescription: INodeProperties[] = [
|
||||
// ----------------------------------
|
||||
// operations
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a ticket',
|
||||
action: 'Create a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a ticket',
|
||||
action: 'Delete a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a ticket',
|
||||
action: 'Get a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many tickets',
|
||||
action: 'Get many tickets',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// fields
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
description: 'Title of the ticket to create',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Group Name or ID',
|
||||
name: 'group',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadGroupNames',
|
||||
},
|
||||
placeholder: 'First-Level Helpdesk',
|
||||
description:
|
||||
'Group that will own the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email Name or ID',
|
||||
name: 'customer',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadCustomerEmails',
|
||||
},
|
||||
description:
|
||||
'Email address of the customer concerned in the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
placeholder: 'hello@n8n.io',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Ticket ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
description:
|
||||
'Ticket to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Ticket ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'Ticket to delete. Specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Article',
|
||||
name: 'article',
|
||||
type: 'fixedCollection',
|
||||
placeholder: 'Add Article',
|
||||
required: true,
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Article Details',
|
||||
name: 'articleDetails',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Body',
|
||||
name: 'body',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Visibility',
|
||||
name: 'visibility',
|
||||
type: 'options',
|
||||
default: 'internal',
|
||||
options: [
|
||||
{
|
||||
name: 'External',
|
||||
value: 'external',
|
||||
description: 'Visible to customers',
|
||||
},
|
||||
{
|
||||
name: 'Internal',
|
||||
value: 'internal',
|
||||
description: 'Visible to help desk',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Sender',
|
||||
name: 'sender',
|
||||
type: 'options',
|
||||
// https://docs.zammad.org/en/latest/api/ticket/articles.html
|
||||
options: [
|
||||
{
|
||||
name: 'Agent',
|
||||
value: 'Agent',
|
||||
},
|
||||
{
|
||||
name: 'Customer',
|
||||
value: 'Customer',
|
||||
},
|
||||
{
|
||||
name: 'System',
|
||||
value: 'System',
|
||||
description: 'Only subject will be displayed in Zammad',
|
||||
},
|
||||
],
|
||||
default: 'Agent',
|
||||
},
|
||||
{
|
||||
displayName: 'Article Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
// https://docs.zammad.org/en/latest/api/ticket/articles.html
|
||||
options: [
|
||||
{
|
||||
name: 'Chat',
|
||||
value: 'chat',
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
},
|
||||
{
|
||||
name: 'Fax',
|
||||
value: 'fax',
|
||||
},
|
||||
{
|
||||
name: 'Note',
|
||||
value: 'note',
|
||||
},
|
||||
{
|
||||
name: 'Phone',
|
||||
value: 'phone',
|
||||
},
|
||||
{
|
||||
name: 'SMS',
|
||||
value: 'sms',
|
||||
},
|
||||
],
|
||||
default: 'note',
|
||||
},
|
||||
{
|
||||
displayName: 'Reply To',
|
||||
name: 'reply_to',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: [
|
||||
{
|
||||
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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadTicketCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on the custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,618 @@
|
||||
import type { 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',
|
||||
action: 'Create a user',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a user',
|
||||
action: 'Delete a user',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a user',
|
||||
action: 'Get a user',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many users',
|
||||
action: 'Get many users',
|
||||
},
|
||||
{
|
||||
name: 'Get Self',
|
||||
value: 'getSelf',
|
||||
description: 'Retrieve currently logged-in user',
|
||||
action: 'Get currently logged-in user',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a user',
|
||||
action: '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/code/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/code/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/code/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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadUserCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
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',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '+49 30 901820',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Organization Name or 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/code/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 or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadUserCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
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: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Organization Name or 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/code/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 or ID',
|
||||
name: 'sort_by',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadUserFields',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort Order',
|
||||
name: 'order_by',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Ascending',
|
||||
value: 'asc',
|
||||
},
|
||||
{
|
||||
name: 'Descending',
|
||||
value: 'desc',
|
||||
},
|
||||
],
|
||||
default: 'asc',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from './GroupDescription';
|
||||
export * from './OrganizationDescription';
|
||||
export * from './TicketDescription';
|
||||
export * from './UserDescription';
|
||||
@@ -0,0 +1,97 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export declare namespace Zammad {
|
||||
export type Resource = 'group' | 'organization' | 'ticket' | 'user';
|
||||
|
||||
export type AuthMethod = 'basicAuth' | 'tokenAuth';
|
||||
|
||||
export type Credentials = BasicAuthCredentials | TokenAuthCredentials;
|
||||
|
||||
type CredentialsBase = {
|
||||
baseUrl: string;
|
||||
allowUnauthorizedCerts: boolean;
|
||||
};
|
||||
|
||||
export type BasicAuthCredentials = CredentialsBase & {
|
||||
authType: 'basicAuth';
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
|
||||
export type TokenAuthCredentials = CredentialsBase & {
|
||||
authType: 'tokenAuth';
|
||||
accessToken: string;
|
||||
};
|
||||
|
||||
export type UserAdditionalFields = IDataObject & CustomFieldsUi & AddressUi;
|
||||
export type UserUpdateFields = UserAdditionalFields;
|
||||
export type UserFilterFields = IDataObject & SortUi;
|
||||
|
||||
export type Organization = {
|
||||
active: boolean;
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type Group = Organization;
|
||||
|
||||
export type GroupUpdateFields = UserUpdateFields;
|
||||
|
||||
export type User = {
|
||||
id: number;
|
||||
login: string;
|
||||
lastname: string;
|
||||
email: string;
|
||||
role_ids: number[];
|
||||
};
|
||||
|
||||
export type Field = {
|
||||
id: number;
|
||||
display: string;
|
||||
name: string;
|
||||
object: string;
|
||||
created_by_id: number;
|
||||
};
|
||||
|
||||
export type UserField = {
|
||||
display: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type CustomFieldsUi = {
|
||||
customFieldsUi?: {
|
||||
customFieldPairs: Array<{ name: string; value: string }>;
|
||||
};
|
||||
};
|
||||
|
||||
export type SortUi = {
|
||||
sortUi?: {
|
||||
sortDetails: {
|
||||
sort_by: string;
|
||||
order_by: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type AddressUi = {
|
||||
addressUi?: {
|
||||
addressDetails: {
|
||||
city: string;
|
||||
country: string;
|
||||
street: string;
|
||||
zip: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type Article = {
|
||||
articleDetails: {
|
||||
visibility: 'external' | 'internal';
|
||||
subject: string;
|
||||
body: string;
|
||||
sender: 'Agent' | 'Customer' | 'System';
|
||||
type: 'chat' | 'email' | 'fax' | 'note' | 'phone' | 'sms';
|
||||
reply_to: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="140 210 140 140"><path fill="#CA2317" d="m230.5 250 41.7-12.8-24.7 15.7z"/><path fill="#E84F83" d="m255.9 281.2-8.4-28.3 24.7-15.7-7.4 25.4z"/><path fill="#CA2317" d="m284.4 229.5-4.6 7.7-15 25.4 7.4-25.4z"/><path fill="#E54011" d="m285.9 234.5-11.6 11.9 5.5-9.2zm-52.9 7.6 34.1-3.4-23.7 7.3z"/><path fill="#CA2317" d="m234.3 261.4 13.2-8.5 8.4 28.3-4.4 9z"/><path fill="#B7DFF2" d="m214.6 295-6.3-77 43.2 72.2z"/><path fill="#E54011" d="m196.7 314.7 17.9-19.7 36.9-4.8z"/><path fill="#FFCE33" d="m109.7 353.4 87-38.7 17.9-19.7-28.4-2.9z"/><path fill="#D6B12D" d="m113 321.8 44.7-6.8 13.9-11.2-6.8-3z"/><path fill="#FFDE85" d="m129.1 285.3 42.5 18.5 14.6-11.7z"/><path fill="#009EC6" d="m205.1 245.9-5.4.9-13.5 45.3 14.6-9.2z"/><path fill="#5EAFCE" d="m213 275.1-12.2 7.8 7.5-64.9z"/><path fill="#045972" d="m166.9 252 38.2-6.1 1.7-15.1z"/><path fill="#5A8591" d="m162.8 216.6 33.2 20 10.8-5.8.3-2.1z"/><path fill="#009EC6" d="m169.3 194.8 30.2 31.8 7.6 2.1 1.2-10.7z"/><path fill="#F39804" d="m186.2 292.1 26.8-17 1.6 19.9z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user