n8n/packages/nodes-base/credentials/LinearOAuth2Api.credentials.ts
Jon 410ea9a2ef
Some checks failed
Test Master / install-and-build (push) Has been cancelled
Test Master / Unit tests (18.x) (push) Has been cancelled
Test Master / Unit tests (20.x) (push) Has been cancelled
Test Master / Unit tests (22.4) (push) Has been cancelled
Test Master / Lint (push) Has been cancelled
Test Master / Notify Slack on failure (push) Has been cancelled
feat(Linear Trigger Node): Add support for admin scope (#12211)
2024-12-13 20:45:08 +00:00

80 lines
1.7 KiB
TypeScript

import type { ICredentialType, INodeProperties } from 'n8n-workflow';
export class LinearOAuth2Api implements ICredentialType {
name = 'linearOAuth2Api';
extends = ['oAuth2Api'];
displayName = 'Linear OAuth2 API';
documentationUrl = 'linear';
properties: INodeProperties[] = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'authorizationCode',
},
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden',
default: 'https://linear.app/oauth/authorize',
required: true,
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
default: 'https://api.linear.app/oauth/token',
required: true,
},
{
displayName: 'Actor',
name: 'actor',
type: 'options',
options: [
{
name: 'User',
value: 'user',
description: 'Resources are created as the user who authorized the application',
},
{
name: 'Application',
value: 'application',
description: 'Resources are created as the application',
},
],
default: 'user',
},
{
displayName: 'Include Admin Scope',
name: 'includeAdminScope',
type: 'boolean',
default: false,
description: 'Grants the "Admin" scope, Needed to create webhooks',
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default:
'={{$self["includeAdminScope"] ? "read write issues:create comments:create admin" : "read write issues:create comments:create"}}',
required: true,
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
default: '={{"actor="+$self["actor"]}}',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'body',
},
];
}