Skip to content

Commit 08e5e6d

Browse files
committed
Add Credentials test + bump package version
1 parent 3be38cb commit 08e5e6d

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

credentials/WinstonAiApi.credentials.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable n8n-nodes-base/cred-class-field-name-uppercase-first-char */
2-
import { IAuthenticateGeneric, Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
2+
import { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
33

44
export class WinstonAiApi implements ICredentialType {
55
name = 'WinstonAiApi';
@@ -15,6 +15,12 @@ export class WinstonAiApi implements ICredentialType {
1515
typeOptions: { password: true },
1616
default: '',
1717
},
18+
{
19+
displayName: 'Domain',
20+
name: 'domain',
21+
type: 'string',
22+
default: 'https://api.gowinston.ai',
23+
},
1824
];
1925
authenticate: IAuthenticateGeneric = {
2026
type: 'generic',
@@ -24,4 +30,17 @@ export class WinstonAiApi implements ICredentialType {
2430
},
2531
},
2632
};
33+
34+
test: ICredentialTestRequest = {
35+
request: {
36+
baseURL: '={{$credentials.domain}}',
37+
url: '/credits',
38+
headers: {
39+
Authorization: '={{"Bearer " + $credentials.apiKey}}',
40+
},
41+
method: 'GET',
42+
}
43+
}
44+
45+
2746
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { IAuthenticateGeneric, Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
2+
3+
export class ExampleCredentialsApi implements ICredentialType {
4+
name = 'exampleCredentialsApi';
5+
displayName = 'Example Credentials API';
6+
icon = 'file:example.svg' as Icon;
7+
documentationUrl = 'https://your-docs-url';
8+
9+
properties: INodeProperties[] = [
10+
{
11+
displayName: 'API Key',
12+
name: 'apiKey',
13+
type: 'string',
14+
typeOptions: { password: true },
15+
default: '',
16+
},
17+
];
18+
authenticate: IAuthenticateGeneric = {
19+
type: 'generic',
20+
properties: {
21+
headers: {
22+
Authorization: '={{"Bearer " + $credentials.apiKey}}',
23+
},
24+
},
25+
};
26+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "n8n-nodes-winston-ai",
3-
"version": "1.0.1",
3+
"version": "1.0.3",
44
"description": "AI detector with industry leading accuracy rates in detecting use of AI in text and images. The Winston AI tools also offers a robust plagiarism checker to help maintain integrity.",
55
"keywords": [
66
"n8n-community-node-package",

0 commit comments

Comments
 (0)