diff --git a/packages/nodes-base/credentials/JiraSoftwareServerPatApi.credentials.ts b/packages/nodes-base/credentials/JiraSoftwareServerPatApi.credentials.ts new file mode 100644 index 0000000000..96dabd5808 --- /dev/null +++ b/packages/nodes-base/credentials/JiraSoftwareServerPatApi.credentials.ts @@ -0,0 +1,47 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class JiraSoftwareServerPatApi implements ICredentialType { + name = 'jiraSoftwareServerPatApi'; + + displayName = 'Jira SW Server (PAT) API'; + + documentationUrl = 'jira'; + + properties: INodeProperties[] = [ + { + displayName: 'Personal Access Token', + name: 'personalAccessToken', + typeOptions: { password: true }, + type: 'string', + default: '', + }, + { + displayName: 'Domain', + name: 'domain', + type: 'string', + default: '', + placeholder: 'https://example.com', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + Authorization: '=Bearer {{$credentials.personalAccessToken}}', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials?.domain}}', + url: '/rest/api/2/project', + }, + }; +} diff --git a/packages/nodes-base/nodes/Jira/GenericFunctions.ts b/packages/nodes-base/nodes/Jira/GenericFunctions.ts index b5ea100ca1..129b78ad73 100644 --- a/packages/nodes-base/nodes/Jira/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Jira/GenericFunctions.ts @@ -28,6 +28,9 @@ export async function jiraSoftwareCloudApiRequest( if (jiraVersion === 'server') { domain = (await this.getCredentials('jiraSoftwareServerApi')).domain as string; credentialType = 'jiraSoftwareServerApi'; + } else if (jiraVersion === 'serverPat') { + domain = (await this.getCredentials('jiraSoftwareServerPatApi')).domain as string; + credentialType = 'jiraSoftwareServerPatApi'; } else { domain = (await this.getCredentials('jiraSoftwareCloudApi')).domain as string; credentialType = 'jiraSoftwareCloudApi'; @@ -233,7 +236,7 @@ export async function getUsers(this: ILoadOptionsFunctions): Promise