@disruptive-learning/n8n-nodes-gigstack 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/GigstackApi.credentials.d.ts +2 -1
- package/dist/credentials/GigstackApi.credentials.js +30 -17
- package/dist/nodes/Gigstack/GenericFunctions.d.ts +5 -0
- package/dist/nodes/Gigstack/GenericFunctions.js +78 -0
- package/dist/nodes/{Gigstack.node.d.ts → Gigstack/Gigstack.node.d.ts} +1 -1
- package/dist/nodes/Gigstack/Gigstack.node.js +952 -0
- package/dist/nodes/Gigstack/GigstackTrigger.node.d.ts +12 -0
- package/dist/nodes/Gigstack/GigstackTrigger.node.js +207 -0
- package/dist/nodes/Gigstack/descriptions/ClientDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/ClientDescription.js +595 -0
- package/dist/nodes/Gigstack/descriptions/InvoiceDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/InvoiceDescription.js +503 -0
- package/dist/nodes/Gigstack/descriptions/PaymentDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/PaymentDescription.js +454 -0
- package/dist/nodes/Gigstack/descriptions/ReceiptDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/ReceiptDescription.js +369 -0
- package/dist/nodes/Gigstack/descriptions/ServiceDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/ServiceDescription.js +381 -0
- package/dist/nodes/Gigstack/descriptions/TeamDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/TeamDescription.js +599 -0
- package/dist/nodes/Gigstack/descriptions/UserDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/UserDescription.js +362 -0
- package/dist/nodes/Gigstack/descriptions/WebhookDescription.d.ts +3 -0
- package/dist/nodes/Gigstack/descriptions/WebhookDescription.js +293 -0
- package/dist/nodes/Gigstack/descriptions/index.d.ts +8 -0
- package/dist/nodes/Gigstack/descriptions/index.js +24 -0
- package/dist/nodes/Gigstack/gigstack.svg +1 -0
- package/package.json +64 -71
- package/LICENSE +0 -21
- package/README.md +0 -81
- package/dist/nodes/Gigstack.node.js +0 -1207
- package/dist/nodes/gigstack.svg +0 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
export declare class GigstackApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
documentationUrl: string;
|
|
6
6
|
properties: INodeProperties[];
|
|
7
7
|
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
8
9
|
}
|
|
@@ -3,41 +3,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GigstackApi = void 0;
|
|
4
4
|
class GigstackApi {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.name =
|
|
7
|
-
this.displayName =
|
|
8
|
-
this.documentationUrl =
|
|
6
|
+
this.name = 'gigstackApi';
|
|
7
|
+
this.displayName = 'Gigstack API';
|
|
8
|
+
this.documentationUrl = 'https://docs.gigstack.io';
|
|
9
9
|
this.properties = [
|
|
10
10
|
{
|
|
11
|
-
displayName:
|
|
12
|
-
name:
|
|
13
|
-
type:
|
|
11
|
+
displayName: 'API Token',
|
|
12
|
+
name: 'apiToken',
|
|
13
|
+
type: 'string',
|
|
14
14
|
typeOptions: {
|
|
15
15
|
password: true,
|
|
16
16
|
},
|
|
17
|
-
default:
|
|
17
|
+
default: '',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'Your Gigstack API token. Get it from <a href="https://app.gigstack.pro/settings?tab=api" target="_blank">app.gigstack.pro/settings</a>',
|
|
18
20
|
},
|
|
19
21
|
{
|
|
20
|
-
displayName:
|
|
21
|
-
name:
|
|
22
|
-
type:
|
|
22
|
+
displayName: 'Environment',
|
|
23
|
+
name: 'environment',
|
|
24
|
+
type: 'options',
|
|
23
25
|
options: [
|
|
24
26
|
{
|
|
25
|
-
name:
|
|
26
|
-
value:
|
|
27
|
+
name: 'Production',
|
|
28
|
+
value: 'production',
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
|
-
name:
|
|
30
|
-
value:
|
|
31
|
+
name: 'Test',
|
|
32
|
+
value: 'test',
|
|
31
33
|
},
|
|
32
34
|
],
|
|
33
|
-
default:
|
|
35
|
+
default: 'production',
|
|
36
|
+
description: 'The environment to use. Test mode uses test data and does not create real invoices.',
|
|
34
37
|
},
|
|
35
38
|
];
|
|
36
39
|
this.authenticate = {
|
|
37
|
-
type:
|
|
40
|
+
type: 'generic',
|
|
38
41
|
properties: {
|
|
39
42
|
headers: {
|
|
40
|
-
Authorization:
|
|
43
|
+
Authorization: '=Bearer {{$credentials.apiToken}}',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
this.test = {
|
|
48
|
+
request: {
|
|
49
|
+
baseURL: 'https://api.gigstack.io/v2',
|
|
50
|
+
url: '/teams',
|
|
51
|
+
method: 'GET',
|
|
52
|
+
qs: {
|
|
53
|
+
limit: 1,
|
|
41
54
|
},
|
|
42
55
|
},
|
|
43
56
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function gigstackApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject>;
|
|
3
|
+
export declare function gigstackApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, limit?: number): Promise<IDataObject[]>;
|
|
4
|
+
export declare function simplifyResponse(response: IDataObject): IDataObject;
|
|
5
|
+
export declare function buildFilterQuery(filters: IDataObject): IDataObject;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gigstackApiRequest = gigstackApiRequest;
|
|
4
|
+
exports.gigstackApiRequestAllItems = gigstackApiRequestAllItems;
|
|
5
|
+
exports.simplifyResponse = simplifyResponse;
|
|
6
|
+
exports.buildFilterQuery = buildFilterQuery;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
async function gigstackApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
9
|
+
const options = {
|
|
10
|
+
method,
|
|
11
|
+
body,
|
|
12
|
+
qs,
|
|
13
|
+
url: `https://api.gigstack.io/v2${endpoint}`,
|
|
14
|
+
json: true,
|
|
15
|
+
};
|
|
16
|
+
if (Object.keys(body).length === 0) {
|
|
17
|
+
delete options.body;
|
|
18
|
+
}
|
|
19
|
+
if (Object.keys(qs).length === 0) {
|
|
20
|
+
delete options.qs;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'gigstackApi', options);
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function gigstackApiRequestAllItems(method, endpoint, body = {}, qs = {}, limit) {
|
|
31
|
+
const returnData = [];
|
|
32
|
+
let responseData;
|
|
33
|
+
let nextCursor;
|
|
34
|
+
qs.limit = qs.limit || 100;
|
|
35
|
+
do {
|
|
36
|
+
if (nextCursor) {
|
|
37
|
+
qs.next = nextCursor;
|
|
38
|
+
}
|
|
39
|
+
responseData = await gigstackApiRequest.call(this, method, endpoint, body, qs);
|
|
40
|
+
const data = responseData.data;
|
|
41
|
+
if (data) {
|
|
42
|
+
returnData.push(...data);
|
|
43
|
+
}
|
|
44
|
+
nextCursor = responseData.next;
|
|
45
|
+
if (limit && returnData.length >= limit) {
|
|
46
|
+
return returnData.slice(0, limit);
|
|
47
|
+
}
|
|
48
|
+
} while (responseData.has_more === true && nextCursor);
|
|
49
|
+
return returnData;
|
|
50
|
+
}
|
|
51
|
+
function simplifyResponse(response) {
|
|
52
|
+
if (response.data !== undefined) {
|
|
53
|
+
return response.data;
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
function buildFilterQuery(filters) {
|
|
58
|
+
const qs = {};
|
|
59
|
+
if (filters.limit) {
|
|
60
|
+
qs.limit = filters.limit;
|
|
61
|
+
}
|
|
62
|
+
if (filters.orderBy) {
|
|
63
|
+
qs.order_by = filters.orderBy;
|
|
64
|
+
}
|
|
65
|
+
if (filters.sort) {
|
|
66
|
+
qs.sort = filters.sort;
|
|
67
|
+
}
|
|
68
|
+
if (filters.team) {
|
|
69
|
+
qs.team = filters.team;
|
|
70
|
+
}
|
|
71
|
+
if (filters.createdAfter) {
|
|
72
|
+
qs['created[gte]'] = Math.floor(new Date(filters.createdAfter).getTime() / 1000);
|
|
73
|
+
}
|
|
74
|
+
if (filters.createdBefore) {
|
|
75
|
+
qs['created[lte]'] = Math.floor(new Date(filters.createdBefore).getTime() / 1000);
|
|
76
|
+
}
|
|
77
|
+
return qs;
|
|
78
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
export declare class Gigstack implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
4
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|