mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Add Linear Trigger node (#2767)
* ✨ Linear Trigger * 🎨 Replace PNG with SVG icon Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
45
packages/nodes-base/nodes/Linear/GenericFunctions.ts
Normal file
45
packages/nodes-base/nodes/Linear/GenericFunctions.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function linearApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, body: any = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = await this.getCredentials('linearApi') as IDataObject;
|
||||
|
||||
const endpoint = 'https://api.linear.app/graphql';
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: credentials.apiKey,
|
||||
},
|
||||
method: 'POST',
|
||||
body,
|
||||
uri: endpoint,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
try {
|
||||
|
||||
return await this.helpers.request!(options);
|
||||
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
}
|
||||
|
||||
export function capitalizeFirstLetter(data: string) {
|
||||
return data.charAt(0).toUpperCase() + data.slice(1);
|
||||
}
|
||||
Reference in New Issue
Block a user