mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Linear Node): Add options to add a link and a comment to an issue (#13464)
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { commentFields, commentOperations } from './CommentDescription';
|
||||
import {
|
||||
linearApiRequest,
|
||||
linearApiRequestAllItems,
|
||||
@@ -85,6 +86,10 @@ export class Linear implements INodeType {
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Comment',
|
||||
value: 'comment',
|
||||
},
|
||||
{
|
||||
name: 'Issue',
|
||||
value: 'issue',
|
||||
@@ -92,6 +97,8 @@ export class Linear implements INodeType {
|
||||
],
|
||||
default: 'issue',
|
||||
},
|
||||
...commentOperations,
|
||||
...commentFields,
|
||||
...issueOperations,
|
||||
...issueFields,
|
||||
],
|
||||
@@ -289,6 +296,39 @@ export class Linear implements INodeType {
|
||||
responseData = await linearApiRequest.call(this, body);
|
||||
responseData = responseData?.data?.issueUpdate?.issue;
|
||||
}
|
||||
if (operation === 'addLink') {
|
||||
const issueId = this.getNodeParameter('issueId', i) as string;
|
||||
const body: IGraphqlBody = {
|
||||
query: query.addIssueLink(),
|
||||
variables: {
|
||||
issueId,
|
||||
url: this.getNodeParameter('link', i),
|
||||
},
|
||||
};
|
||||
|
||||
responseData = await linearApiRequest.call(this, body);
|
||||
responseData = responseData?.data?.attachmentLinkURL;
|
||||
}
|
||||
} else if (resource === 'comment') {
|
||||
if (operation === 'addComment') {
|
||||
const issueId = this.getNodeParameter('issueId', i) as string;
|
||||
const body = this.getNodeParameter('comment', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const requestBody: IGraphqlBody = {
|
||||
query: query.addComment(),
|
||||
variables: {
|
||||
issueId,
|
||||
body,
|
||||
},
|
||||
};
|
||||
|
||||
if (additionalFields.parentId && (additionalFields.parentId as string).trim() !== '') {
|
||||
requestBody.variables.parentId = additionalFields.parentId as string;
|
||||
}
|
||||
|
||||
responseData = await linearApiRequest.call(this, requestBody);
|
||||
responseData = responseData?.data?.commentCreate;
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
|
||||
Reference in New Issue
Block a user