Skip to content

Commit f83388a

Browse files
feat: added auth and test in creds
1 parent eb151dc commit f83388a

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

credentials/JigsawStackApi.credentials.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import {
2-
ICredentialType,
3-
INodeProperties,
2+
IAuthenticateGeneric,
3+
ICredentialTestRequest,
4+
ICredentialType,
5+
INodeProperties,
46
} from 'n8n-workflow';
57

68
export class JigsawStackApi implements ICredentialType {
79
name = 'jigsawStackApi';
810
displayName = 'JigsawStack API';
911
documentationUrl = 'https://jigsawstack.com/docs';
12+
1013
properties: INodeProperties[] = [
1114
{
1215
displayName: 'API Key',
@@ -19,4 +22,27 @@ export class JigsawStackApi implements ICredentialType {
1922
required: true,
2023
},
2124
];
22-
}
25+
26+
authenticate: IAuthenticateGeneric = {
27+
type: 'generic',
28+
properties: {
29+
headers: {
30+
'x-api-key': '={{$credentials.apiKey}}',
31+
accept: 'application/json',
32+
'Content-Type': 'application/json',
33+
},
34+
},
35+
};
36+
37+
test: ICredentialTestRequest = {
38+
request: {
39+
method: 'POST',
40+
url: 'https://api.jigsawstack.com/v1/ai/translate',
41+
body: {
42+
text: ['Hello'],
43+
target_language: 'zh',
44+
},
45+
json: true,
46+
},
47+
};
48+
}

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-jigsawstack",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"description": "JigsawStack API integration for n8n",
55
"keywords": [
66
"n8n-community-node-package",

0 commit comments

Comments
 (0)