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 { createHash } from 'crypto';
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
import type { LoadedResource, Resource } from './types';
|
||||
|
||||
export async function getAuthorization(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
credentials?: ICredentialDataDecryptedObject,
|
||||
): Promise<string> {
|
||||
if (credentials === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), 'No credentials got returned!');
|
||||
}
|
||||
|
||||
const { password, username } = credentials;
|
||||
const options: IRequestOptions = {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
method: 'POST',
|
||||
body: {
|
||||
type: 'normal',
|
||||
password,
|
||||
username,
|
||||
},
|
||||
uri: credentials.url ? `${credentials.url}/api/v1/auth` : 'https://api.taiga.io/api/v1/auth',
|
||||
json: true,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await this.helpers.request(options);
|
||||
|
||||
return response.auth_token;
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export async function taigaApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body = {},
|
||||
query = {},
|
||||
uri?: string,
|
||||
option = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('taigaApi');
|
||||
|
||||
const authToken = await getAuthorization.call(this, credentials);
|
||||
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
auth: {
|
||||
bearer: authToken,
|
||||
},
|
||||
qs: query,
|
||||
method,
|
||||
body,
|
||||
uri:
|
||||
uri || credentials.url
|
||||
? `${credentials.url}/api/v1${resource}`
|
||||
: `https://api.taiga.io/api/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (Object.keys(option).length !== 0) {
|
||||
Object.assign(options, option);
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export async function taigaApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: IDataObject = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
let uri: string | undefined;
|
||||
|
||||
do {
|
||||
responseData = await taigaApiRequest.call(this, method, resource, body, query, uri, {
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
returnData.push.apply(returnData, responseData.body as IDataObject[]);
|
||||
uri = responseData.headers['x-pagination-next'];
|
||||
const limit = query.limit as number | undefined;
|
||||
if (limit && returnData.length >= limit) {
|
||||
return returnData;
|
||||
}
|
||||
} while (
|
||||
responseData.headers['x-pagination-next'] !== undefined &&
|
||||
responseData.headers['x-pagination-next'] !== ''
|
||||
);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function getAutomaticSecret(credentials: ICredentialDataDecryptedObject) {
|
||||
const data = `${credentials.username},${credentials.password}`;
|
||||
return createHash('md5').update(data).digest('hex');
|
||||
}
|
||||
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
qs: IDataObject,
|
||||
i: number,
|
||||
) {
|
||||
let responseData;
|
||||
qs.project = this.getNodeParameter('projectId', i) as number;
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
if (returnAll) {
|
||||
return await taigaApiRequestAllItems.call(this, method, endpoint, body, qs);
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', i);
|
||||
responseData = await taigaApiRequestAllItems.call(this, method, endpoint, body, qs);
|
||||
return responseData.splice(0, qs.limit);
|
||||
}
|
||||
}
|
||||
|
||||
export const toOptions = (items: LoadedResource[]) =>
|
||||
items.map(({ name, id }) => ({ name, value: id }));
|
||||
|
||||
export function throwOnEmptyUpdate(this: IExecuteFunctions, resource: Resource) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one field to update for the ${resource}.`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function getVersionForUpdate(this: IExecuteFunctions, endpoint: string) {
|
||||
return await taigaApiRequest.call(this, 'GET', endpoint).then((response) => response.version);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.taiga",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development", "Productivity"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/taiga/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.taiga/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,596 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
epicFields,
|
||||
epicOperations,
|
||||
issueFields,
|
||||
issueOperations,
|
||||
taskFields,
|
||||
taskOperations,
|
||||
userStoryFields,
|
||||
userStoryOperations,
|
||||
} from './descriptions';
|
||||
import {
|
||||
getVersionForUpdate,
|
||||
handleListing,
|
||||
taigaApiRequest,
|
||||
throwOnEmptyUpdate,
|
||||
toOptions,
|
||||
} from './GenericFunctions';
|
||||
import type {
|
||||
LoadedEpic,
|
||||
LoadedResource,
|
||||
LoadedTags,
|
||||
LoadedUser,
|
||||
LoadedUserStory,
|
||||
Operation,
|
||||
Resource,
|
||||
} from './types';
|
||||
|
||||
export class Taiga implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Taiga',
|
||||
name: 'taiga',
|
||||
icon: 'file:taiga.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Taiga API',
|
||||
defaults: {
|
||||
name: 'Taiga',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'taigaApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Epic',
|
||||
value: 'epic',
|
||||
},
|
||||
{
|
||||
name: 'Issue',
|
||||
value: 'issue',
|
||||
},
|
||||
{
|
||||
name: 'Task',
|
||||
value: 'task',
|
||||
},
|
||||
{
|
||||
name: 'User Story',
|
||||
value: 'userStory',
|
||||
},
|
||||
],
|
||||
default: 'issue',
|
||||
},
|
||||
...epicOperations,
|
||||
...epicFields,
|
||||
...issueOperations,
|
||||
...issueFields,
|
||||
...taskOperations,
|
||||
...taskFields,
|
||||
...userStoryOperations,
|
||||
...userStoryFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getEpics(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const epics = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/epics',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedEpic[];
|
||||
|
||||
return epics.map(({ subject, id }) => ({ name: subject, value: id }));
|
||||
},
|
||||
|
||||
async getMilestones(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const milestones = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/milestones',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(milestones);
|
||||
},
|
||||
|
||||
async getPriorities(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const priorities = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/priorities',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(priorities);
|
||||
},
|
||||
|
||||
async getProjects(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const { id } = (await taigaApiRequest.call(this, 'GET', '/users/me')) as { id: string };
|
||||
const projects = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/projects',
|
||||
{},
|
||||
{ member: id },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(projects);
|
||||
},
|
||||
|
||||
async getRoles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const roles = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/roles',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(roles);
|
||||
},
|
||||
|
||||
async getSeverities(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const severities = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/severities',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(severities);
|
||||
},
|
||||
|
||||
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const tags = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/projects/${project}/tags_colors`,
|
||||
)) as LoadedTags;
|
||||
|
||||
return Object.keys(tags).map((tag) => ({ name: tag, value: tag }));
|
||||
},
|
||||
|
||||
async getTypes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const types = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/issue-types',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(types);
|
||||
},
|
||||
|
||||
async getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const users = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/users',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedUser[];
|
||||
|
||||
return users.map(({ full_name_display, id }) => ({ name: full_name_display, value: id }));
|
||||
},
|
||||
|
||||
async getUserStories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const userStories = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/userstories',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedUserStory[];
|
||||
|
||||
return userStories.map(({ subject, id }) => ({ name: subject, value: id }));
|
||||
},
|
||||
|
||||
// statuses
|
||||
|
||||
async getIssueStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const statuses = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/issue-statuses',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(statuses);
|
||||
},
|
||||
|
||||
async getTaskStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const statuses = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/task-statuses',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(statuses);
|
||||
},
|
||||
|
||||
async getUserStoryStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const project = this.getCurrentNodeParameter('projectId') as string;
|
||||
const statuses = (await taigaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/userstory-statuses',
|
||||
{},
|
||||
{ project },
|
||||
)) as LoadedResource[];
|
||||
|
||||
return toOptions(statuses);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as Resource;
|
||||
const operation = this.getNodeParameter('operation', 0) as Operation;
|
||||
|
||||
let responseData;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
if (resource === 'epic') {
|
||||
// **********************************************************************
|
||||
// epic
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// epic: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
project: this.getNodeParameter('projectId', i),
|
||||
subject: this.getNodeParameter('subject', i),
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'POST', '/epics', body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// epic: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const epicId = this.getNodeParameter('epicId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'DELETE', `/epics/${epicId}`);
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// epic: get
|
||||
// ----------------------------------------
|
||||
|
||||
const epicId = this.getNodeParameter('epicId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'GET', `/epics/${epicId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// epic: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
Object.assign(qs, filters);
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'GET', '/epics', {}, qs, i);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// epic: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
if (Object.keys(updateFields).length) {
|
||||
Object.assign(body, updateFields);
|
||||
} else {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const epicId = this.getNodeParameter('epicId', i);
|
||||
body.version = await getVersionForUpdate.call(this, `/epics/${epicId}`);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'PATCH', `/epics/${epicId}`, body);
|
||||
}
|
||||
} else if (resource === 'issue') {
|
||||
// **********************************************************************
|
||||
// issue
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// issue: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
project: this.getNodeParameter('projectId', i),
|
||||
subject: this.getNodeParameter('subject', i),
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'POST', '/issues', body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// issue: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const issueId = this.getNodeParameter('issueId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'DELETE', `/issues/${issueId}`);
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// issue: get
|
||||
// ----------------------------------------
|
||||
|
||||
const issueId = this.getNodeParameter('issueId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'GET', `/issues/${issueId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// issue: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
Object.assign(qs, filters);
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'GET', '/issues', {}, qs, i);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// issue: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
if (Object.keys(updateFields).length) {
|
||||
Object.assign(body, updateFields);
|
||||
} else {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const issueId = this.getNodeParameter('issueId', i);
|
||||
body.version = await getVersionForUpdate.call(this, `/issues/${issueId}`);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'PATCH', `/issues/${issueId}`, body);
|
||||
}
|
||||
} else if (resource === 'task') {
|
||||
// **********************************************************************
|
||||
// task
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// task: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
project: this.getNodeParameter('projectId', i),
|
||||
subject: this.getNodeParameter('subject', i),
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'POST', '/tasks', body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// task: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const taskId = this.getNodeParameter('taskId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// task: get
|
||||
// ----------------------------------------
|
||||
|
||||
const taskId = this.getNodeParameter('taskId', i);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'GET', `/tasks/${taskId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// task: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
Object.assign(qs, filters);
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'GET', '/tasks', {}, qs, i);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// task: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
if (Object.keys(updateFields).length) {
|
||||
Object.assign(body, updateFields);
|
||||
} else {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const taskId = this.getNodeParameter('taskId', i);
|
||||
body.version = await getVersionForUpdate.call(this, `/tasks/${taskId}`);
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'PATCH', `/tasks/${taskId}`, body);
|
||||
}
|
||||
} else if (resource === 'userStory') {
|
||||
// **********************************************************************
|
||||
// userStory
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// userStory: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
project: this.getNodeParameter('projectId', i),
|
||||
subject: this.getNodeParameter('subject', i),
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await taigaApiRequest.call(this, 'POST', '/userstories', body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// userStory: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const userStoryId = this.getNodeParameter('userStoryId', i);
|
||||
|
||||
const endpoint = `/userstories/${userStoryId}`;
|
||||
responseData = await taigaApiRequest.call(this, 'DELETE', endpoint);
|
||||
responseData = { success: true };
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// userStory: get
|
||||
// ----------------------------------------
|
||||
|
||||
const userStoryId = this.getNodeParameter('userStoryId', i);
|
||||
|
||||
const endpoint = `/userstories/${userStoryId}`;
|
||||
responseData = await taigaApiRequest.call(this, 'GET', endpoint);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// userStory: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
Object.assign(qs, filters);
|
||||
}
|
||||
|
||||
responseData = await handleListing.call(this, 'GET', '/userstories', {}, qs, i);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// userStory: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
if (Object.keys(updateFields).length) {
|
||||
Object.assign(body, updateFields);
|
||||
} else {
|
||||
throwOnEmptyUpdate.call(this, resource);
|
||||
}
|
||||
|
||||
const userStoryId = this.getNodeParameter('userStoryId', i);
|
||||
body.version = await getVersionForUpdate.call(this, `/userstories/${userStoryId}`);
|
||||
|
||||
responseData = await taigaApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
`/userstories/${userStoryId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.taigaTrigger",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development", "Productivity"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/taiga/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.taigatrigger/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
import {
|
||||
type IHookFunctions,
|
||||
type IDataObject,
|
||||
type ILoadOptionsFunctions,
|
||||
type INodePropertyOptions,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type IWebhookFunctions,
|
||||
type IWebhookResponseData,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { getAutomaticSecret, taigaApiRequest } from './GenericFunctions';
|
||||
import type { Operations, Resources, WebhookPayload } from './types';
|
||||
|
||||
// import {
|
||||
// createHmac,
|
||||
// } from 'crypto';
|
||||
|
||||
export class TaigaTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Taiga Trigger',
|
||||
name: 'taigaTrigger',
|
||||
icon: 'file:taiga.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
subtitle: '={{"project:" + $parameter["projectSlug"]}}',
|
||||
description: 'Handle Taiga events via webhook',
|
||||
defaults: {
|
||||
name: 'Taiga Trigger',
|
||||
},
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'taigaApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
{
|
||||
name: 'default',
|
||||
httpMethod: 'POST',
|
||||
responseMode: 'onReceived',
|
||||
path: 'webhook',
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
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: 'getUserProjects',
|
||||
},
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Resources',
|
||||
name: 'resources',
|
||||
type: 'multiOptions',
|
||||
required: true,
|
||||
default: ['all'],
|
||||
options: [
|
||||
{
|
||||
name: 'All',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
name: 'Issue',
|
||||
value: 'issue',
|
||||
},
|
||||
{
|
||||
name: 'Milestone (Sprint)',
|
||||
value: 'milestone',
|
||||
},
|
||||
{
|
||||
name: 'Task',
|
||||
value: 'task',
|
||||
},
|
||||
{
|
||||
name: 'User Story',
|
||||
value: 'userstory',
|
||||
},
|
||||
{
|
||||
name: 'Wikipage',
|
||||
value: 'wikipage',
|
||||
},
|
||||
],
|
||||
description: 'Resources to listen to',
|
||||
},
|
||||
{
|
||||
displayName: 'Operations',
|
||||
name: 'operations',
|
||||
type: 'multiOptions',
|
||||
required: true,
|
||||
default: ['all'],
|
||||
description: 'Operations to listen to',
|
||||
options: [
|
||||
{
|
||||
name: 'All',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'change',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the available projects to display them to user so that they can
|
||||
// select them easily
|
||||
async getUserProjects(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
const { id } = await taigaApiRequest.call(this, 'GET', '/users/me');
|
||||
|
||||
const projects = await taigaApiRequest.call(this, 'GET', '/projects', {}, { member: id });
|
||||
for (const project of projects) {
|
||||
const projectName = project.name;
|
||||
const projectId = project.id;
|
||||
returnData.push({
|
||||
name: projectName,
|
||||
value: projectId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
webhookMethods = {
|
||||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookUrl = this.getNodeWebhookUrl('default') as string;
|
||||
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
|
||||
const endpoint = '/webhooks';
|
||||
|
||||
const webhooks = await taigaApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
for (const webhook of webhooks) {
|
||||
if (webhook.url === webhookUrl) {
|
||||
webhookData.webhookId = webhook.id;
|
||||
webhookData.key = webhook.key;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
const credentials = await this.getCredentials('taigaApi');
|
||||
|
||||
const webhookUrl = this.getNodeWebhookUrl('default') as string;
|
||||
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
|
||||
const projectId = this.getNodeParameter('projectId') as string;
|
||||
|
||||
const key = getAutomaticSecret(credentials);
|
||||
|
||||
const body: IDataObject = {
|
||||
name: `n8n-webhook:${webhookUrl}`,
|
||||
url: webhookUrl,
|
||||
key,
|
||||
project: projectId,
|
||||
};
|
||||
const { id } = await taigaApiRequest.call(this, 'POST', '/webhooks', body);
|
||||
|
||||
webhookData.webhookId = id;
|
||||
webhookData.key = key;
|
||||
|
||||
return true;
|
||||
},
|
||||
async delete(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
try {
|
||||
await taigaApiRequest.call(this, 'DELETE', `/webhooks/${webhookData.webhookId}`);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
delete webhookData.webhookId;
|
||||
delete webhookData.key;
|
||||
return true;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const body = this.getRequestObject().body as WebhookPayload;
|
||||
|
||||
const operations = this.getNodeParameter('operations', []) as Operations[];
|
||||
const resources = this.getNodeParameter('resources', []) as Resources[];
|
||||
|
||||
if (!operations.includes('all') && !operations.includes(body.action)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!resources.includes('all') && !resources.includes(body.type)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// TODO: Signature does not match payload hash
|
||||
// https://github.com/taigaio/taiga-back/issues/1031
|
||||
|
||||
// const webhookData = this.getWorkflowStaticData('node');
|
||||
// const headerData = this.getHeaderData();
|
||||
|
||||
// // @ts-ignore
|
||||
// const requestSignature = headerData['x-taiga-webhook-signature'];
|
||||
|
||||
// if (requestSignature === undefined) {
|
||||
// return {};
|
||||
// }
|
||||
|
||||
// const computedSignature = createHmac('sha1', webhookData.key as string).update(JSON.stringify(body)).digest('hex');
|
||||
|
||||
// if (requestSignature !== computedSignature) {
|
||||
// return {};
|
||||
// }
|
||||
|
||||
return {
|
||||
workflowData: [this.helpers.returnJsonArray(body)],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const epicOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an epic',
|
||||
action: 'Create an epic',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an epic',
|
||||
action: 'Delete an epic',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an epic',
|
||||
action: 'Get an epic',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many epics',
|
||||
action: 'Get many epics',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an epic',
|
||||
action: 'Update an epic',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const epicFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// epic: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the epic belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assigned To Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to assign the epic to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the epic is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Color',
|
||||
name: 'color',
|
||||
type: 'color',
|
||||
default: '0000FF',
|
||||
description: 'Color code in hexadecimal notation',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the issue is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// epic: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Epic ID',
|
||||
name: 'epicId',
|
||||
description: 'ID of the epic to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// epic: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Epic ID',
|
||||
name: 'epicId',
|
||||
description: 'ID of the epic to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// epic: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the epic belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
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: ['epic'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user whom the epic is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Closed',
|
||||
name: 'statusIsClosed',
|
||||
description: 'Whether the epic is closed',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// epic: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the project to set the epic to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Epic ID',
|
||||
name: 'epicId',
|
||||
description: 'ID of the epic to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['epic'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assigned To Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to whom the epic is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the epic is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Color',
|
||||
name: 'color',
|
||||
type: 'color',
|
||||
default: '0000FF',
|
||||
description: 'Color code in hexadecimal notation',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the epic is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,608 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const issueOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an issue',
|
||||
action: 'Create an issue',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an issue',
|
||||
action: 'Delete an issue',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an issue',
|
||||
action: 'Get an issue',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many issues',
|
||||
action: 'Get many issues',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an issue',
|
||||
action: 'Update an issue',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const issueFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// issue: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the issue belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to whom the issue is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the issue is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the issue is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority Name or ID',
|
||||
name: 'priority',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getPriorities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Severity Name or ID',
|
||||
name: 'severity',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getSeverities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getIssueStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Type Name or ID',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// issue: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Issue ID',
|
||||
name: 'issueId',
|
||||
description: 'ID of the issue to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// issue: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Issue ID',
|
||||
name: 'issueId',
|
||||
description: 'ID of the issue to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// issue: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the issue belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
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: ['issue'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
description:
|
||||
'ID of the user to assign the issue to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Order By',
|
||||
name: 'orderBy',
|
||||
description: 'Field to order the issues by',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Assigned To',
|
||||
value: 'assigned_to',
|
||||
},
|
||||
{
|
||||
name: 'Created Date',
|
||||
value: 'created_date',
|
||||
},
|
||||
{
|
||||
name: 'Modified Date',
|
||||
value: 'modified_date',
|
||||
},
|
||||
{
|
||||
name: 'Owner',
|
||||
value: 'owner',
|
||||
},
|
||||
{
|
||||
name: 'Priority',
|
||||
value: 'priority',
|
||||
},
|
||||
{
|
||||
name: 'Severity',
|
||||
value: 'severity',
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
value: 'status',
|
||||
},
|
||||
{
|
||||
name: 'Subject',
|
||||
value: 'subject',
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
value: 'type',
|
||||
},
|
||||
],
|
||||
default: 'assigned_to',
|
||||
},
|
||||
{
|
||||
displayName: 'Owner Name or ID',
|
||||
name: 'owner',
|
||||
description:
|
||||
'ID of the owner of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority Name or ID',
|
||||
name: 'priority',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getPriorities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Role Name or ID',
|
||||
name: 'role',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getRoles',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Severity Name or ID',
|
||||
name: 'severity',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getSeverities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
description:
|
||||
'ID of the status of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getIssueStatuses',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Type Name or ID',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// issue: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the project to set the issue to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Issue ID',
|
||||
name: 'issueId',
|
||||
description: 'ID of the issue to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['issue'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user whom the issue is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the issue is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the issue is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority Name or ID',
|
||||
name: 'priority',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getPriorities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Severity Name or ID',
|
||||
name: 'severity',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getSeverities',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getIssueStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the issue. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Type Name or ID',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,550 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const taskOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a task',
|
||||
action: 'Create a task',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a task',
|
||||
action: 'Delete a task',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a task',
|
||||
action: 'Get a task',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many tasks',
|
||||
action: 'Get many tasks',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a task',
|
||||
action: 'Update a task',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const taskFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// task: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the task belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to whom the task is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the task is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the task is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTaskStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Taskboard Order',
|
||||
name: 'taskboard_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
description: 'Order of the task in the taskboard',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'User Story Name or ID',
|
||||
name: 'user_story',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStories',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user story of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'User Story Order',
|
||||
name: 'us_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
description: 'Order of the task in the user story',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// task: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
description: 'ID of the task to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// task: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
description: 'ID of the task to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// task: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the task belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
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: ['task'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user whom the task is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Closed',
|
||||
name: 'statusIsClosed',
|
||||
description: 'Whether the task is closed',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Owner Name or ID',
|
||||
name: 'owner',
|
||||
description:
|
||||
'ID of the owner of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Role Name or ID',
|
||||
name: 'role',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getRoles',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
description:
|
||||
'ID of the status of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTaskStatuses',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'User Story Name or ID',
|
||||
name: 'userStory',
|
||||
description:
|
||||
'ID of the user story to which the task belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStories',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// task: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to set the task to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
description: 'ID of the task to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to assign the task to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Reason why the task is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the task is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTaskStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'User Story Name or ID',
|
||||
name: 'user_story',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStories',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user story of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'User Story Order',
|
||||
name: 'us_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the task in the user story',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Taskboard Order',
|
||||
name: 'taskboard_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the task in the taskboard',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,567 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const userStoryOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a user story',
|
||||
action: 'Create a user story',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a user story',
|
||||
action: 'Delete a user story',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a user story',
|
||||
action: 'Get a user story',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many user stories',
|
||||
action: 'Get many user stories',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a user story',
|
||||
action: 'Update a user story',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const userStoryFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// userStory: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the user story belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to whom the user story is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Backlog Order',
|
||||
name: 'backlog_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the backlog',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'Reason why the user story is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the user story is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Kanban Order',
|
||||
name: 'kanban_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the kanban',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sprint Order',
|
||||
name: 'sprint_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the milestone',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStoryStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Type Name or ID',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// userStory: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'User Story ID',
|
||||
name: 'userStoryId',
|
||||
description: 'ID of the user story to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// userStory: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'User Story ID',
|
||||
name: 'userStoryId',
|
||||
description: 'ID of the user story to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// userStory: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
description:
|
||||
'ID of the project to which the user story belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
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: ['userStory'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
description:
|
||||
'ID of the user whom the user story is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Epic Name or ID',
|
||||
name: 'epic',
|
||||
description:
|
||||
'ID of the epic to which the user story belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getEpics',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Closed',
|
||||
name: 'statusIsClosed',
|
||||
description: 'Whether the user story is closed',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Is Archived',
|
||||
name: 'statusIsArchived',
|
||||
description: 'Whether the user story has been archived',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Role Name or ID',
|
||||
name: 'role',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getRoles',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
description:
|
||||
'ID of the status of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStoryStatuses',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// userStory: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Project Name or ID',
|
||||
name: 'projectId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProjects',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the project to set the user story to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'User Story ID',
|
||||
name: 'userStoryId',
|
||||
description: 'ID of the user story to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['userStory'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee Name or ID',
|
||||
name: 'assigned_to',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the user to assign the the user story to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Backlog Order',
|
||||
name: 'backlog_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the backlog',
|
||||
},
|
||||
{
|
||||
displayName: 'Blocked Note',
|
||||
name: 'blocked_note',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'Reason why the user story is blocked. Requires "Is Blocked" toggle to be enabled.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Blocked',
|
||||
name: 'is_blocked',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the user story is blocked',
|
||||
},
|
||||
{
|
||||
displayName: 'Kanban Order',
|
||||
name: 'kanban_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the kanban',
|
||||
},
|
||||
{
|
||||
displayName: 'Milestone (Sprint) Name or ID',
|
||||
name: 'milestone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getMilestones',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the milestone of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sprint Order',
|
||||
name: 'sprint_order',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
description: 'Order of the user story in the milestone',
|
||||
},
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getUserStoryStatuses',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'ID of the status of the user story. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
description:
|
||||
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Type Name or ID',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['projectId'],
|
||||
loadOptionsMethod: 'getTypes',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from './EpicDescription';
|
||||
export * from './IssueDescription';
|
||||
export * from './TaskDescription';
|
||||
export * from './UserStoryDescription';
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="2500" height="2500" preserveAspectRatio="xMinYMin meet" viewBox="0 0 256 256"><path fill="#A295AE" d="m224.288 43.916-11.963 84.2-84.2-11.963 11.963-84.2z" opacity=".8"/><path fill="#5D6F6D" d="m31.885 212.291 11.963-84.2 84.2 11.963-11.963 84.2z" opacity=".8"/><path fill="#8CD592" d="m43.848 32.065 84.2 11.962-11.963 84.2-84.2-11.963z" opacity=".8"/><path fill="#665E74" d="m212.226 224.264-84.2-11.963 11.963-84.2 84.2 11.963z" opacity=".8"/><path fill="#3C3647" d="m119.642 255.595-51.08-67.997 67.998-51.08 51.08 67.998-67.998 51.08z" opacity=".8"/><path fill="#837193" d="m255.463 136.39-67.997 51.079-51.08-67.997 67.998-51.08 51.08 67.998z" opacity=".8"/><path fill="#A2F4AC" d="m136.437.554 51.079 67.997-67.997 51.08-51.08-67.998L136.437.553z" opacity=".8"/><path fill="#7EA685" d="m.463 119.7 67.998-51.08 51.079 67.998-67.997 51.08z" opacity=".8"/><path fill="#3C3647" d="m127.963 95.742 32.332 32.333-32.332 32.332-32.332-32.332z"/></svg>
|
||||
|
After Width: | Height: | Size: 999 B |
@@ -0,0 +1,41 @@
|
||||
export type Resource = 'epic' | 'issue' | 'task' | 'userStory';
|
||||
|
||||
export type Operation = 'create' | 'delete' | 'update' | 'get' | 'getAll';
|
||||
|
||||
export type LoadedResource = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type LoadOption = {
|
||||
value: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type LoadedUser = {
|
||||
id: string;
|
||||
full_name_display: string;
|
||||
};
|
||||
|
||||
export type LoadedUserStory = {
|
||||
id: string;
|
||||
subject: string;
|
||||
};
|
||||
|
||||
export type LoadedEpic = LoadedUserStory;
|
||||
|
||||
export type LoadedTags = {
|
||||
[tagName: string]: string | null; // hex color
|
||||
};
|
||||
|
||||
export type Operations = 'all' | 'create' | 'delete' | 'change';
|
||||
|
||||
export type Resources = 'all' | 'issue' | 'milestone' | 'task' | 'userstory' | 'wikipage';
|
||||
|
||||
export type WebhookPayload = {
|
||||
action: Operations;
|
||||
type: Resources;
|
||||
by: Record<string, string | number>;
|
||||
date: string;
|
||||
data: Record<string, string | number | object | string[]>;
|
||||
};
|
||||
Reference in New Issue
Block a user